On Sun, 2025-06-29 at 23:51 -0400, Aaron Merey wrote:
> Safely handle stdout output during concurrent calls to print_debug_*
> functions.
> 
> For any print_debug_* function and any function that could be called
> from print_debug_* which also prints to stdout: add a FILE * argument
> and replace all printf, puts, putchar with fprintf.  All printing
> to stdout will now be written to this FILE instead.
> 
> The FILE * is an interface to a per-thread dynamically-sized buffer.
> libthread.a manages the allocation, printing and deallocation of
> these buffers.
> 
> Signed-off-by: Aaron Merey <ame...@redhat.com>
> 
> ---
> v3: Reorder this patch to be 2/3 in the series instead of 3/3.
> 
> Remove unnecessary handling of null FILE *

Reviewed this first since it seems to apply independently of the rest
of the patches and it seems your other work on gettext adjustments also
depends on this one.

I spot checked the code and ran some quick tests. Looks good.

It should be easy to extend this to non-DWARF-section printing code.

We might want to think about how to better chop up print_debug_units so
that is can more easily to print just one unit at a time (so those can
be parallelized too). The attrcb_args callback support already seems
ready for that.

But that is all for some future.

Cheers,

Mark

Reply via email to