[fpc-devel] gdb driving me nuts => it's starting a 2nd thread for no apparent reason....

Martin lazarus at mfriebe.de
Mon Nov 8 23:59:30 CET 2010

Ok, anyone with an idea..

Attached is a simple program (appologies for the many commented lines, 
but all logs refer to the lines as in this source, and I didn't want to 
recreate the log yet another time)
Tested with various versions of gdb dwarf debug info (and IIRc (it's 
been a lot of trying) also stabs). Mainly used todays triunk of fpc, but 
the same with 2.4.0 (again IIRC)

In the log:
- lines with ">>" written to the debugger
- lines with "<<" read from the debugger

debugger started with this options:
gdb -silent -i mi -nx

the app pasically is
   Program Foo;
   procedure Test; begin writeln(); end;

- the output of writeln has no significance, and can even be commented away
- breakpoint is set on the first call to "Test"

then hit F8 (step-over) twice
- the first F8 stops (but for the wrong reason (should be 
- the 2nd F8 cause a sigill

they apparently stop half into an instruction, which may be part of the 

The biggest riddle is, why gdb says it's starting a 2nd thread?
(btw using gdb directly, same options, but piccking only the most 
relevant commands from the log => not reproducible)

Below is the communication of the first "F8 step-over", before that the 
breakpoint was hit, and some info queried (stack, etc).
All that is send is a single "-exec-next", yet a 2nd thread seems to get 
Strange too, the address at which it does hit the sig-trap...

 >> TCmdLineDebugger.SendCmdLn "-exec-next"
<< TCmdLineDebugger.ReadLn "^running"
<< TCmdLineDebugger.ReadLn "*running,thread-id="1""
<< TCmdLineDebugger.ReadLn "(gdb) "
<< TCmdLineDebugger.ReadLn "=thread-created,id="2",group-id="1032""
   [Debugger] Notify output: =thread-created,id="2",group-id="1032"
<< TCmdLineDebugger.ReadLn "~"[New Thread 1032.0x1774]\n""
   [Debugger] Console output: ~"[New Thread 1032.0x1774]\n"
<< TCmdLineDebugger.ReadLn "*running,thread-id="all""
   [DBGTGT] *
   [DBGTGT] running,thread-id="all"
<< TCmdLineDebugger.ReadLn "~"[Switching to Thread 1032.0x1774]\n""
   [Debugger] Console output: ~"[Switching to Thread 1032.0x1774]\n"
<< TCmdLineDebugger.ReadLn 
<< TCmdLineDebugger.ReadLn "=thread-selected,id="2""
   [Debugger] Notify output: =thread-selected,id="2"
<< TCmdLineDebugger.ReadLn "(gdb) "

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: project1.lpr
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20101108/538e61df/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debug_issue.log.txt
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20101108/538e61df/attachment.txt>

More information about the fpc-devel mailing list