This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: copy/paste error in sol-thread.c ?
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 30 Apr 2013 15:09:28 +0400
- Subject: FYI: copy/paste error in sol-thread.c ?
... 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:
if (ti.ti_startfunc != 0)
{
const struct bound_minimal_symbol msym
= lookup_minimal_symbol_by_pc (ti.ti_startfunc);
if (msym.minsym)
printf_filtered (" startfunc: %s\n",
SYMBOL_PRINT_NAME (msym.minsym));
else
printf_filtered (" startfunc: %s\n",
paddress (target_gdbarch (), ti.ti_startfunc));
}
In particular, the first block ("if (ti.ti_state == TD_THR_SLEEP)")
does a function name lookup using ti.ti_pc, not ti.ti_startfunc.
I am running against the clock today, but will try to look at it
again sometime this week, if I have a bit of time. A second pair
of eyes to confirm my understanding would be greatly appreciated.
--
Joel