Re: FYI: copy/paste error in sol-thread.c ?

Pedro Alves
2013-05-02T15:22:30Z

On 04/30/2013 12:09 PM, Joel Brobecker wrote:
> ... while working on fixing the few compilation errors in that file,
> I noticed:
>
> /* If thread is asleep, print function that went to sleep. */
> if (ti.ti_state == TD_THR_SLEEP)
> {
> const struct bound_minimal_symbol msym
> = lookup_minimal_symbol_by_pc (ti.ti_pc);
>
> if (msym.minsym)
> printf_filtered (" - Sleep func: %s\n",
> SYMBOL_PRINT_NAME (msym.minsym));
> else
> printf_filtered (" - Sleep func: %s\n",
> paddress (target_gdbarch (), ti.ti_startfunc));
> ^^^^^^^^^^^^^^^
> |||||||||||||||
> }
>
> I find the use of ti.ti_startfunc looks suspiciously like a copy/paste
> of the code right above:

I agree it looks like a copy/paste.

Very very very minor, but the prints look a little odd to me:

> printf_filtered (" startfunc: %s\n",
> printf_filtered (" - Sleep func: %s\n"

The first is lowercase, and doesn't start with '-', while the
other line is uppercase, and has a '-'... Looks odd.
It reads to me as if the original intention was to put this all
in the same line, but then the startfunc print includes \n,
breaking it...

--
Pedro Alves