@@ -261,16 +261,13 @@ debuginfod_is_enabled ()
261261/* Print the result of the most recent attempted download. */
262262
263263static void
264- print_outcome (user_data & data , int fd )
264+ print_outcome (int fd , const char * desc , const char * fname )
265265{
266- /* Clears the current line of progress output. */
267- current_uiout -> do_progress_end ();
268-
269266 if (fd < 0 && fd != - ENOENT )
270267 gdb_printf (_ ("Download failed: %s. Continuing without %s %ps.\n" ),
271268 safe_strerror (- fd ),
272- data . desc ,
273- styled_string (file_name_style .style (), data . fname ));
269+ desc ,
270+ styled_string (file_name_style .style (), fname ));
274271}
275272
276273/* See debuginfod-support.h */
@@ -290,23 +287,28 @@ debuginfod_source_query (const unsigned char *build_id,
290287 return scoped_fd (- ENOMEM );
291288
292289 char * dname = nullptr ;
293- user_data data ("source file" , srcpath );
294-
295- debuginfod_set_user_data (c , & data );
290+ scoped_fd fd ;
296291 gdb ::optional < target_terminal ::scoped_restore_terminal_state > term_state ;
297- if (target_supports_terminal_ours ())
298- {
299- term_state .emplace ();
300- target_terminal ::ours ();
301- }
302292
303- scoped_fd fd (debuginfod_find_source (c ,
304- build_id ,
305- build_id_len ,
306- srcpath ,
307- & dname ));
308- debuginfod_set_user_data (c , nullptr );
309- print_outcome (data , fd .get ());
293+ {
294+ user_data data ("source file" , srcpath );
295+
296+ debuginfod_set_user_data (c , & data );
297+ if (target_supports_terminal_ours ())
298+ {
299+ term_state .emplace ();
300+ target_terminal ::ours ();
301+ }
302+
303+ fd = scoped_fd (debuginfod_find_source (c ,
304+ build_id ,
305+ build_id_len ,
306+ srcpath ,
307+ & dname ));
308+ debuginfod_set_user_data (c , nullptr );
309+ }
310+
311+ print_outcome (fd .get (), "source file" , srcpath );
310312
311313 if (fd .get () >= 0 )
312314 destname -> reset (dname );
@@ -331,20 +333,25 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
331333 return scoped_fd (- ENOMEM );
332334
333335 char * dname = nullptr ;
334- user_data data ("separate debug info for" , filename );
335-
336- debuginfod_set_user_data (c , & data );
336+ scoped_fd fd ;
337337 gdb ::optional < target_terminal ::scoped_restore_terminal_state > term_state ;
338- if (target_supports_terminal_ours ())
339- {
340- term_state .emplace ();
341- target_terminal ::ours ();
342- }
343338
344- scoped_fd fd (debuginfod_find_debuginfo (c , build_id , build_id_len ,
345- & dname ));
346- debuginfod_set_user_data (c , nullptr );
347- print_outcome (data , fd .get ());
339+ {
340+ user_data data ("separate debug info for" , filename );
341+
342+ debuginfod_set_user_data (c , & data );
343+ if (target_supports_terminal_ours ())
344+ {
345+ term_state .emplace ();
346+ target_terminal ::ours ();
347+ }
348+
349+ fd = scoped_fd (debuginfod_find_debuginfo (c , build_id , build_id_len ,
350+ & dname ));
351+ debuginfod_set_user_data (c , nullptr );
352+ }
353+
354+ print_outcome (fd .get (), "separate debug info for" , filename );
348355
349356 if (fd .get () >= 0 )
350357 destname -> reset (dname );
@@ -369,19 +376,25 @@ debuginfod_exec_query (const unsigned char *build_id,
369376 return scoped_fd (- ENOMEM );
370377
371378 char * dname = nullptr ;
372- user_data data ("executable for" , filename );
373-
374- debuginfod_set_user_data (c , & data );
379+ scoped_fd fd ;
375380 gdb ::optional < target_terminal ::scoped_restore_terminal_state > term_state ;
376- if (target_supports_terminal_ours ())
377- {
378- term_state .emplace ();
379- target_terminal ::ours ();
380- }
381381
382- scoped_fd fd (debuginfod_find_executable (c , build_id , build_id_len , & dname ));
383- debuginfod_set_user_data (c , nullptr );
384- print_outcome (data , fd .get ());
382+ {
383+ user_data data ("executable for" , filename );
384+
385+ debuginfod_set_user_data (c , & data );
386+ if (target_supports_terminal_ours ())
387+ {
388+ term_state .emplace ();
389+ target_terminal ::ours ();
390+ }
391+
392+ fd = scoped_fd (debuginfod_find_executable (c , build_id , build_id_len ,
393+ & dname ));
394+ debuginfod_set_user_data (c , nullptr );
395+ }
396+
397+ print_outcome (fd .get (), "executable for" , filename );
385398
386399 if (fd .get () >= 0 )
387400 destname -> reset (dname );
0 commit comments