Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* FYI: copy/paste error in sol-thread.c ?
@ 2013-04-30 17:09 Joel Brobecker
  2013-05-02 15:22 ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Joel Brobecker @ 2013-04-30 17:09 UTC (permalink / raw)
  To: gdb-patches

... 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-05-08  6:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-30 17:09 FYI: copy/paste error in sol-thread.c ? Joel Brobecker
2013-05-02 15:22 ` Pedro Alves
2013-05-07 12:25   ` [RFA 2/3] Improve output of "maintenance info sol-threads" command Joel Brobecker
2013-05-07 14:26     ` Tom Tromey
2013-05-07 14:35     ` Pedro Alves
2013-05-08  6:27       ` Joel Brobecker
2013-05-08  6:28     ` Checked in: " Joel Brobecker
2013-05-07 12:25   ` [RFA/commit 1/3] ti.ti_pc vs ti.ti_startfunc copy-pasto in sol-thread.c:info_cb Joel Brobecker
2013-05-07 14:31     ` Pedro Alves
2013-05-08  6:28     ` Checked in: " Joel Brobecker
2013-05-07 12:25   ` [RFA 3/3] Avoid duplicating text " Joel Brobecker
2013-05-07 14:27     ` Tom Tromey
2013-05-08  6:28     ` Checked in: " Joel Brobecker
2013-05-07 12:25   ` FYI: copy/paste error in sol-thread.c ? Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox