Time to expand "Program received signal" ?

Pedro Alves palves@redhat.com
Thu Nov 15 10:36:00 GMT 2012


On 14-11-2012 19:54, John Gilmore wrote:
>>> GDB shouldn't mention threads at all, unless the program being debugged
>>> is multi-threaded.
>>
>> Since 7.0 GDB models non-threaded programs as single threaded.
> 
> OK, then, you can call it what you want.  

I call it what it is.

GDB shouldn't mention
> threads at all, unless the program being debugged has more than a
> single thread.

See?  If it has a single thread, GDB calls that thread "thread 1".

> Printing a thread identifier is extraneous information that the user
> will just have to skip over to get to the real information (that their
> program got a signal).

You're making things more complicated than they are.
There's nothing to skip over.  GDB's model calls the unit of scheduling
in the inferior that got the signal "Thread N".  You can "thread N" to
switch to it.

(gdb) maint print target-stack
The current target stack is:
  - child (Unix child process)
  - exec (Local exec file)
  - None (None)
(gdb) info threads
  Id   Target Id         Frame
* 1    process 9939 "break" main (argc=1, argv=0x7fffffffdc48, envp=0x7fffffffdc58) at ../../../src/gdb/testsuite/gdb.base/break.c:89
(gdb) clone-inferior
Added inferior 2.
(gdb) info inferiors
  Num  Description       Executable
  2    <null>            /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/break
* 1    process 9939      /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/break
(gdb) info threads
  Id   Target Id         Frame
* 1    process 9939 "break" main (argc=1, argv=0x7fffffffdc48, envp=0x7fffffffdc58) at ../../../src/gdb/testsuite/gdb.base/break.c:89
(gdb) inferior 2
[Switching to inferior 2 [<null>] (/home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/break)]
(gdb) start
Temporary breakpoint 2 at 0x4006bf: main. (2 locations)
Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/break

Temporary breakpoint 2,
main (argc=1, argv=0x7fffffffdc48, envp=0x7fffffffdc58) at ../../../src/gdb/testsuite/gdb.base/break.c:89
89          if (argc == 12345) {  /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */
(gdb) info inferiors
  Num  Description       Executable
* 2    process 9943      /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/break
  1    process 9939      /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/break
(gdb) info threads
  Id   Target Id         Frame
* 2    process 9943 "break" main (argc=1, argv=0x7fffffffdc48, envp=0x7fffffffdc58) at ../../../src/gdb/testsuite/gdb.base/break.c:89
  1    process 9939 "break" main (argc=1, argv=0x7fffffffdc48, envp=0x7fffffffdc58) at ../../../src/gdb/testsuite/gdb.base/break.c:89
(gdb)

-- 
Pedro Alves



More information about the Gdb mailing list