This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/6] gdbserver: Delimit debugging output for readability


> >>    if (debug_threads)
> >> -    fprintf (stderr, "stop pc is %08lx\n", pc);
> >> +    debug_printf ("stop pc is %08lx\n", pc);
> >>    return pc;
> >
> > IWBN to move "if (debug_threads)" into debug_printf too.
> 
> I thought of that, but there are times when you want to check
> debug_threads before calling debug_printf.

I used to think the same way as Yao. But I think the pattern that
has been followed pretty consistently is the one above. I've seen
also emails or articles (I can't remember which), which justify
the use of the current pattern. From memory, you're saving a function
call, the string formatting, and also, if you need to call functions
with side-effects, you're saving that too. It doesn't sound like
it is all such a big problem, but I think it's significant enough
that we want to continue with our currently established pattern.

Some units have dealt with that issue by defining a macro expanding
to "if (debug_[...]) call_debug_trace_fun ([...]);".

As Doug suggested, maybe for a followup patch, for those interested.

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]