View Issue Details

IDProjectCategoryView StatusLast Update
0017089LazarusDebuggerpublic2010-11-11 22:11
ReporterSven BarthAssigned ToMartin Friebe 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSLinuxOS Version2.6.34
Product Version0.9.29 (SVN)Product Build 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0017089: Can not debug a non-LCL application without including unit Interfaces
DescriptionI thought this bug was already reported, but well...

If I debug an application that doesn't use unit Interfaces (and thus does not rely on LCL in any way), I can set breakpoints without problems and they are "hit" if the application is run. But if I do a "step in" or "step over" the debugger jumps to the next breakpoint or the application terminates (gracefully) if it can't find another one.

This behavior persists until I include the LCL as a dependency and add the unit Interfaces to the uses list. Then debugging works as expected.

Note: This bug report is not about "start with terminal application" or "no I/O when debugging".
Steps To ReproduceThe following - simple - program (add LCL as a dependency):

program test;

// Include to "enable" debugging
{uses
  Interfaces;}

procedure Test;
begin
  Writeln('Hello World'); // output isn't important
end;

begin
  Test; // put breakpoint here
  Test;
  Test; // and here
end.

Without "Interfaces" it breaks at the first and third "Test" but nowhere else no matter if I "step in" or "step over". With "Interfaces" I can step into "Test" and also over the first "Test" to the second.
TagsNo tags attached.
Fixed in Revision28162
LazTarget0.9.30
WidgetsetGTK 2
Attached Files
  • dbg-failed-run.txt (9,982 bytes)
    (gdb)
    <-gdb-set confirm off>
    ^done
    (gdb)
    <-gdb-set new-console off>
    ^error,msg="No symbol table is loaded.  Use the \"file\" command."
    (gdb)
    <-gdb-version>
    ~"GNU gdb (GDB) 7.1\n"
    ~"Copyright (C) 2010 Free Software Foundation, Inc.\n"
    ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
    ~"This is free software: you are free to change and redistribute it.\n"
    ~"There is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\n"
    ~"and \"show warranty\" for details.\n"
    ~"This GDB was configured as \"i686-pc-linux-gnu\".\n"
    ~"For bug reporting instructions, please see:\n"
    ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
    ^done
    (gdb)
    <-gdb-version>
    ~"GNU gdb (GDB) 7.1\n"
    ~"Copyright (C) 2010 Free Software Foundation, Inc.\n"
    ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
    ~"This is free software: you are free to change and redistribute it.\n"
    ~"There is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\n"
    ~"and \"show warranty\" for details.\n"
    ~"This GDB was configured as \"i686-pc-linux-gnu\".\n"
    ~"For bug reporting instructions, please see:\n"
    ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
    ^done
    (gdb)
    <-gdb-set env ALSA_PLUGINS_DIR=/usr/lib/alsa-lib>
    ^done
    (gdb)
    <-gdb-set env COLORFGBG=default;0>
    ^done
    (gdb)
    <-gdb-set env COLORTERM=rxvt>
    ^done
    (gdb)
    <-gdb-set env DISPLAY=:0.0>
    ^done
    (gdb)
    <-gdb-set env EDITOR=nano>
    ^done
    (gdb)
    <-gdb-set env G_BROKEN_FILENAMES=1>
    ^done
    (gdb)
    <-gdb-set env HISTCONTROL=erasedups>
    ^done
    (gdb)
    <-gdb-set env HISTSIZE=1000>
    ^done
    (gdb)
    <-gdb-set env HOME=/home/sven>
    ^done
    (gdb)
    <-gdb-set env INPUTRC=/etc/inputrc>
    ^done
    (gdb)
    <-gdb-set env J2REDIR=/usr/lib/jvm/java-1.6.0-openjdk/jre>
    ^done
    (gdb)
    <-gdb-set env J2SDKDIR=/usr/lib/jvm/java-1.6.0-openjdk>
    ^done
    (gdb)
    <-gdb-set env JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk>
    ^done
    (gdb)
    <-gdb-set env LANG=de_DE.utf8>
    ^done
    (gdb)
    <-gdb-set env LESS=-R>
    ^done
    (gdb)
    <-gdb-set env LOGNAME=sven>
    ^done
    (gdb)
    <-gdb-set env MAIL=/var/mail/sven>
    ^done
    (gdb)
    <-gdb-set env _=/mnt/data/applications/lazarus/0.9.29/startlazarus>
    ^done
    (gdb)
    <-gdb-set env MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins>
    ^done
    (gdb)
    <-gdb-set env OOO_FORCE_DESKTOP=gnome>
    ^done
    (gdb)
    <-gdb-set env PATH=/usr/local/bin:/home/sven/.bin:/home/sven/.scripts:/usr/local/bin:/home/sven/.bin:/home/sven/.scripts:/bin:/usr/bin:/sbin:/usr/sbin:/opt/kde/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/opt/qt/bin>
    ^done
    (gdb)
    <-gdb-set env PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/qt/lib/pkgconfig>
    ^done
    (gdb)
    <-gdb-set env PROMPT_COMMAND=echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007">
    ^done
    (gdb)
    <-gdb-set env PS3=> >
    ^done
    (gdb)
    <-gdb-set env PS4=+ >
    ^done
    (gdb)
    <-gdb-set env PWD=/home/sven>
    ^done
    (gdb)
    <-gdb-set env QTDIR=/opt/qt>
    ^done
    (gdb)
    <-gdb-set env QT_XFT=true>
    ^done
    (gdb)
    <-gdb-set env SHELL=/bin/bash>
    ^done
    (gdb)
    <-gdb-set env SHLVL=3>
    ^done
    (gdb)
    <-gdb-set env SUDO_USER=sven>
    ^done
    (gdb)
    <-gdb-set env TERMINFO=/usr/share/terminfo>
    ^done
    (gdb)
    <-gdb-set env TERM=rxvt-unicode>
    ^done
    (gdb)
    <-gdb-set env USER=sven>
    ^done
    (gdb)
    <-gdb-set env WINDOWID=33554444>
    ^done
    (gdb)
    <-gdb-set env WLAN_INTF=wlan0>
    ^done
    (gdb)
    <-gdb-set env WMII_BACKGROUND=#333333>
    ^done
    (gdb)
    <-gdb-set env WMII_CONFPATH=/home/sven/.wmii:/etc/wmii>
    ^done
    (gdb)
    <-gdb-set env WMII_FOCUSCOLORS=#ffffff #285577 #4c7899>
    ^done
    (gdb)
    <-gdb-set env WMII_FONT=-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*>
    ^done
    (gdb)
    <-gdb-set env WMII_IMAGE=/home/sven/pictures/Atlantis1.jpg>
    ^done
    (gdb)
    <-gdb-set env WMII_NORMCOLORS=#888888 #222222 #333333>
    ^done
    (gdb)
    <-gdb-set env WMII_TERM=urxvt -fg grey -bg black -sr>
    ^done
    (gdb)
    <-gdb-set env XAUTHORITY=/home/sven/.Xauthority>
    ^done
    (gdb)
    <-gdb-set env XDG_CACHE_HOME=/home/sven/.cache>
    ^done
    (gdb)
    <-gdb-set env XDG_CONFIG_DIRS=/etc/xdg>
    ^done
    (gdb)
    <-gdb-set env XDG_CONFIG_HOME=/home/sven/.config>
    ^done
    (gdb)
    <-gdb-set env XDG_DATA_DIRS=/usr/share:/usr/local/share:/opt/kde/share>
    ^done
    (gdb)
    <-gdb-set env XDG_DATA_HOME=/home/sven/.local/share>
    ^done
    (gdb)
    <-file-exec-and-symbols "/home/sven/projects/tests/dbgtest/dbgtest">
    ^done
    (gdb)
    <-environment-cd .>
    ^done
    (gdb)
    <-environment-cd "/home/sven/projects/tests/dbgtest/">
    ^done
    (gdb)
    <-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC>
    ^error,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context."
    (gdb)
    <info functions FPC_CPUINIT>
    &"info functions FPC_CPUINIT\n"
    ~"All functions matching regular expression \"FPC_CPUINIT\":\n"
    ~"\n"
    ~"Non-debugging symbols:\n"
    ~"0x080493f0  SYSTEM_FPC_CPUINIT\n"
    ^done
    (gdb)
    <-exec-arguments >
    ^done
    (gdb)
    <set width 50000>
    &"set width 50000\n"
    ^done
    (gdb)
    <-gdb-set language pascal>
    ^done
    (gdb)
    <info address main>
    &"info address main\n"
    ~"Symbol \"main\" is a function at address 0x80480e0.\n"
    ^done
    (gdb)
    <-break-insert -t *134512864>
    ^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x080480e0",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="19",times="0",original-location="*134512864"}
    (gdb)
    <ptype TObject>
    &"ptype TObject\n"
    &"No symbol \"TObject\" in current context.\n"
    ^error,msg="No symbol \"TObject\" in current context."
    (gdb)
    <info address FPC_RAISEEXCEPTION>
    &"info address FPC_RAISEEXCEPTION\n"
    ~"Symbol \"FPC_RAISEEXCEPTION\" is at 0x8057020 in a file compiled without debugging.\n"
    ^done
    (gdb)
    <-break-insert *134574112>
    ^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x08057020",at="<fpc_raiseexception>",times="0",original-location="*134574112"}
    (gdb)
    <info address FPC_BREAK_ERROR>
    &"info address FPC_BREAK_ERROR\n"
    ~"Symbol \"FPC_BREAK_ERROR\" is at 0x805a120 in a file compiled without debugging.\n"
    ^done
    (gdb)
    <-break-insert *134586656>
    ^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0805a120",at="<SYSTEM_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER>",times="0",original-location="*134586656"}
    (gdb)
    <info address FPC_RUNERROR>
    &"info address FPC_RUNERROR\n"
    ~"Symbol \"FPC_RUNERROR\" is at 0x805a210 in a file compiled without debugging.\n"
    ^done
    (gdb)
    <-break-insert *134586896>
    ^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x0805a210",at="<SYSTEM_RUNERROR$WORD>",times="0",original-location="*134586896"}
    (gdb)
    <info file>
    &"info file\n"
    ~"Symbols from \"/home/sven/projects/tests/dbgtest/dbgtest\".\n"
    ~"Local exec file:\n"
    ~"\t`/home/sven/projects/tests/dbgtest/dbgtest', file type elf32-i386.\n"
    ~"\tEntry point: 0x809a7a0\n"
    ~"\t0x080480a0 - 0x0809a810 is .text\n"
    ~"\t0x0809b810 - 0x080ba028 is .data\n"
    ~"\t0x080ba028 - 0x080dbbe4 is fpc.resources\n"
    ~"\t0x080dbbf0 - 0x080df9a4 is .bss\n"
    ~"\t0x080df9a4 - 0x080df9c4 is fpc.reshandles\n"
    ^done
    (gdb)
    <-break-insert -f foo>
    &"Function \"foo\" not defined.\n"
    ^done,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="foo",times="0",original-location="foo"}
    (gdb)
    <-break-delete 5>
    ^done
    (gdb)
    <-exec-run>
    =thread-group-created,id="15591"
    =thread-created,id="1",group-id="15591"
    ^running
    *running,thread-id="all"
    (gdb)
    *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x080480e0",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="19"},thread-id="1",stopped-threads="all",core="0"
    (gdb)
    <info program>
    &"info program\n"
    ~"\tUsing the running image of child process 15591.\n"
    ~"Program stopped at 0x80480e0.\n"
    ~"It stopped at a breakpoint that has since been deleted.\n"
    ~"Type \"info stack\" or \"info registers\" for more information.\n"
    ^done
    (gdb)
    <-break-insert -f dbgtest.lpr:20>
    ^done,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="0x080480e8",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20",times="0",original-location="dbgtest.lpr:20"}
    (gdb)
    <-break-enable 6>
    ^done
    (gdb)
    <-break-insert -f dbgtest.lpr:22>
    ^done,bkpt={number="7",type="breakpoint",disp="keep",enabled="y",addr="0x080480f2",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="22",times="0",original-location="dbgtest.lpr:22"}
    (gdb)
    <-break-enable 7>
    ^done
    (gdb)
    <-exec-continue>
    ^running
    *running,thread-id="all"
    (gdb)
    *stopped,reason="breakpoint-hit",disp="keep",bkptno="6",frame={addr="0x080480e8",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20"},thread-id="1",stopped-threads="all",core="0"
    (gdb)
    <-symbol-list-lines /home/sven/projects/tests/dbgtest/dbgtest.lpr>
    ^done,lines=[{pc="0x080480a0",line="15"},{pc="0x080480a9",line="16"},{pc="0x080480d2",line="17"},{pc="0x080480e0",line="19"},{pc="0x080480e8",line="20"},{pc="0x080480ed",line="21"},{pc="0x080480f2",line="22"},{pc="0x080480f7",line="23"}]
    (gdb)
    <-stack-list-frames 0 0>
    ^done,stack=[frame={level="0",addr="0x080480e8",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20"}]
    (gdb)
    <-exec-next>
    ^running
    *running,thread-id="1"
    (gdb)
    *stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",frame={addr="0x080480e8",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20"},thread-id="1",stopped-threads="all",core="0"
    (gdb)
    <-exec-continue>
    ^running
    *running,thread-id="1"
    (gdb)
    *stopped,reason="breakpoint-hit",disp="keep",bkptno="7",frame={addr="0x080480f2",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="22"},thread-id="1",stopped-threads="all",core="0"
    (gdb)
    <-exec-continue>
    ^running
    *running,thread-id="1"
    (gdb)
    Hello World
    Hello World
    Hello World
    =thread-exited,id="1",group-id="15591"
    =thread-group-exited,id="15591"
    *stopped,reason="exited-normally"
    (gdb)
    <-break-delete 6>
    ^done
    (gdb)
    <-break-delete 7>
    ^done
    (gdb)
    <-break-delete 2>
    ^done
    (gdb)
    <-break-delete 3>
    ^done
    (gdb)
    <-break-delete 4>
    ^done
    (gdb)
    <-file-exec-and-symbols >
    ^done
    (gdb)
    
    
    dbg-failed-run.txt (9,982 bytes)
  • debugln-debugger.patch (689 bytes)
    Index: cmdlinedebugger.pp
    ===================================================================
    --- cmdlinedebugger.pp	(revision 28154)
    +++ cmdlinedebugger.pp	(working copy)
    @@ -371,6 +371,7 @@
       then FOutputBuf := '';
       FFlushAfterRead := False;
       //writeln('TCmdLineDebugger.ReadLine returns ', result);
    +debugln('<< TCmdLineDebugger.ReadLn "',Result,'"');
     end;
     
     procedure TCmdLineDebugger.SendCmdLn(const ACommand: String); overload;
    @@ -378,6 +379,7 @@
       LE: string[2];
     begin
       //writeln('TCmdLineDebugger.SendCmdLn "',ACommand,'"');
    +debugln('>> TCmdLineDebugger.SendCmdLn "',ACommand,'"');
       if DebugProcessRunning
       then begin
         DoDbgOutput('<' + ACommand + '>');
    

Relationships

related to 0011950 closedMarc Weustink SIGSEGV when debugging non-LCL applications 

Activities

Vincent Snijders

2010-08-02 23:48

manager   ~0039904

IIRC, it was resolved and closed, because the reporter fixed it by using a different gdb version.

Vincent Snijders

2010-08-03 00:03

manager   ~0039905

I added 0011950 as related issue, because of the symptoms, that is the already reported issue I had in mind.

Sven Barth

2010-08-03 09:09

manager   ~0039918

I found that bug report as well, but the symptoms are not exactly the same. I don't get an exception when running a console application in Lazarus with enabled debugger. It simply jumps to the first breakpoint (if any) and from there I can "climb" from breakpoint to breakpoint while it doesn't matter whether I issue a "run", "step over" or "step into".

Also it's not fixed by disabling some security software, but - as far as I've tested - only by using the "Interfaces" unit.

Also this problem is on Linux and not on Windows. On Windows everything works as expected (tested with 0.9.28.2 - which shows on Linux the same problem as the trunk version).

According to ArchLinux site my GDB version is 7.1 (I'm not at my Linux computer currently).

Regards,
Sven

Sven Barth

2010-08-04 22:13

manager   ~0039990

Ok... forget what I wrote about unit Interfaces. That was just a coincidence.

The situation is now like this: the described behavior only occurs on the first run of the debugger after the IDE's start or after a "reset debugger". If I run my application a second time (with or without recompiling/changes) I can debug without problems.
If I do one of the following actions I can only jump from breakpoint to breakpoint during the first run: of the application
* restart the IDE
* reset the debugger
* change/reopen project
* have "debugger output" window open when starting

So the problem seems to be in the debugger interface of the IDE or in GDB itself, but it's not "major" anymore, as I just need to rerun the app ^^

Regards,
Sven

Marc Weustink

2010-08-08 16:45

administrator   ~0040066

can you post the output of the debugger output window ?

Sven Barth

2010-08-29 14:31

manager   ~0040588

It took some time (I was a bit busy), but I'll attach the output after this comment.

I ran the test program with the two breakpoints mentioned in the report in a freshly started Lazarus. It hit the first breakpoint and I pressed F8 to step over. But instead of stopping at the second "Test" call it stopped on the second breakpoint on the third call. I then pressed F9 to continue the execution.

I can't give you the output of a working run, because I can't do a successful run with a open debug output window. Is all debug output also routed to the stdout of the IDE? If not what would I need to change in Lazarus' code to enable this, so I can send you a "successful run" as well?

Regards,
Sven

2010-08-29 14:32

 

dbg-failed-run.txt (9,982 bytes)
(gdb)
<-gdb-set confirm off>
^done
(gdb)
<-gdb-set new-console off>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<-gdb-version>
~"GNU gdb (GDB) 7.1\n"
~"Copyright (C) 2010 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\".\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
^done
(gdb)
<-gdb-version>
~"GNU gdb (GDB) 7.1\n"
~"Copyright (C) 2010 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\".\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
^done
(gdb)
<-gdb-set env ALSA_PLUGINS_DIR=/usr/lib/alsa-lib>
^done
(gdb)
<-gdb-set env COLORFGBG=default;0>
^done
(gdb)
<-gdb-set env COLORTERM=rxvt>
^done
(gdb)
<-gdb-set env DISPLAY=:0.0>
^done
(gdb)
<-gdb-set env EDITOR=nano>
^done
(gdb)
<-gdb-set env G_BROKEN_FILENAMES=1>
^done
(gdb)
<-gdb-set env HISTCONTROL=erasedups>
^done
(gdb)
<-gdb-set env HISTSIZE=1000>
^done
(gdb)
<-gdb-set env HOME=/home/sven>
^done
(gdb)
<-gdb-set env INPUTRC=/etc/inputrc>
^done
(gdb)
<-gdb-set env J2REDIR=/usr/lib/jvm/java-1.6.0-openjdk/jre>
^done
(gdb)
<-gdb-set env J2SDKDIR=/usr/lib/jvm/java-1.6.0-openjdk>
^done
(gdb)
<-gdb-set env JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk>
^done
(gdb)
<-gdb-set env LANG=de_DE.utf8>
^done
(gdb)
<-gdb-set env LESS=-R>
^done
(gdb)
<-gdb-set env LOGNAME=sven>
^done
(gdb)
<-gdb-set env MAIL=/var/mail/sven>
^done
(gdb)
<-gdb-set env _=/mnt/data/applications/lazarus/0.9.29/startlazarus>
^done
(gdb)
<-gdb-set env MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins>
^done
(gdb)
<-gdb-set env OOO_FORCE_DESKTOP=gnome>
^done
(gdb)
<-gdb-set env PATH=/usr/local/bin:/home/sven/.bin:/home/sven/.scripts:/usr/local/bin:/home/sven/.bin:/home/sven/.scripts:/bin:/usr/bin:/sbin:/usr/sbin:/opt/kde/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/opt/qt/bin>
^done
(gdb)
<-gdb-set env PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/qt/lib/pkgconfig>
^done
(gdb)
<-gdb-set env PROMPT_COMMAND=echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007">
^done
(gdb)
<-gdb-set env PS3=> >
^done
(gdb)
<-gdb-set env PS4=+ >
^done
(gdb)
<-gdb-set env PWD=/home/sven>
^done
(gdb)
<-gdb-set env QTDIR=/opt/qt>
^done
(gdb)
<-gdb-set env QT_XFT=true>
^done
(gdb)
<-gdb-set env SHELL=/bin/bash>
^done
(gdb)
<-gdb-set env SHLVL=3>
^done
(gdb)
<-gdb-set env SUDO_USER=sven>
^done
(gdb)
<-gdb-set env TERMINFO=/usr/share/terminfo>
^done
(gdb)
<-gdb-set env TERM=rxvt-unicode>
^done
(gdb)
<-gdb-set env USER=sven>
^done
(gdb)
<-gdb-set env WINDOWID=33554444>
^done
(gdb)
<-gdb-set env WLAN_INTF=wlan0>
^done
(gdb)
<-gdb-set env WMII_BACKGROUND=#333333>
^done
(gdb)
<-gdb-set env WMII_CONFPATH=/home/sven/.wmii:/etc/wmii>
^done
(gdb)
<-gdb-set env WMII_FOCUSCOLORS=#ffffff #285577 #4c7899>
^done
(gdb)
<-gdb-set env WMII_FONT=-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*>
^done
(gdb)
<-gdb-set env WMII_IMAGE=/home/sven/pictures/Atlantis1.jpg>
^done
(gdb)
<-gdb-set env WMII_NORMCOLORS=#888888 #222222 #333333>
^done
(gdb)
<-gdb-set env WMII_TERM=urxvt -fg grey -bg black -sr>
^done
(gdb)
<-gdb-set env XAUTHORITY=/home/sven/.Xauthority>
^done
(gdb)
<-gdb-set env XDG_CACHE_HOME=/home/sven/.cache>
^done
(gdb)
<-gdb-set env XDG_CONFIG_DIRS=/etc/xdg>
^done
(gdb)
<-gdb-set env XDG_CONFIG_HOME=/home/sven/.config>
^done
(gdb)
<-gdb-set env XDG_DATA_DIRS=/usr/share:/usr/local/share:/opt/kde/share>
^done
(gdb)
<-gdb-set env XDG_DATA_HOME=/home/sven/.local/share>
^done
(gdb)
<-file-exec-and-symbols "/home/sven/projects/tests/dbgtest/dbgtest">
^done
(gdb)
<-environment-cd .>
^done
(gdb)
<-environment-cd "/home/sven/projects/tests/dbgtest/">
^done
(gdb)
<-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC>
^error,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context."
(gdb)
<info functions FPC_CPUINIT>
&"info functions FPC_CPUINIT\n"
~"All functions matching regular expression \"FPC_CPUINIT\":\n"
~"\n"
~"Non-debugging symbols:\n"
~"0x080493f0  SYSTEM_FPC_CPUINIT\n"
^done
(gdb)
<-exec-arguments >
^done
(gdb)
<set width 50000>
&"set width 50000\n"
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<info address main>
&"info address main\n"
~"Symbol \"main\" is a function at address 0x80480e0.\n"
^done
(gdb)
<-break-insert -t *134512864>
^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x080480e0",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="19",times="0",original-location="*134512864"}
(gdb)
<ptype TObject>
&"ptype TObject\n"
&"No symbol \"TObject\" in current context.\n"
^error,msg="No symbol \"TObject\" in current context."
(gdb)
<info address FPC_RAISEEXCEPTION>
&"info address FPC_RAISEEXCEPTION\n"
~"Symbol \"FPC_RAISEEXCEPTION\" is at 0x8057020 in a file compiled without debugging.\n"
^done
(gdb)
<-break-insert *134574112>
^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x08057020",at="<fpc_raiseexception>",times="0",original-location="*134574112"}
(gdb)
<info address FPC_BREAK_ERROR>
&"info address FPC_BREAK_ERROR\n"
~"Symbol \"FPC_BREAK_ERROR\" is at 0x805a120 in a file compiled without debugging.\n"
^done
(gdb)
<-break-insert *134586656>
^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0805a120",at="<SYSTEM_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER>",times="0",original-location="*134586656"}
(gdb)
<info address FPC_RUNERROR>
&"info address FPC_RUNERROR\n"
~"Symbol \"FPC_RUNERROR\" is at 0x805a210 in a file compiled without debugging.\n"
^done
(gdb)
<-break-insert *134586896>
^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x0805a210",at="<SYSTEM_RUNERROR$WORD>",times="0",original-location="*134586896"}
(gdb)
<info file>
&"info file\n"
~"Symbols from \"/home/sven/projects/tests/dbgtest/dbgtest\".\n"
~"Local exec file:\n"
~"\t`/home/sven/projects/tests/dbgtest/dbgtest', file type elf32-i386.\n"
~"\tEntry point: 0x809a7a0\n"
~"\t0x080480a0 - 0x0809a810 is .text\n"
~"\t0x0809b810 - 0x080ba028 is .data\n"
~"\t0x080ba028 - 0x080dbbe4 is fpc.resources\n"
~"\t0x080dbbf0 - 0x080df9a4 is .bss\n"
~"\t0x080df9a4 - 0x080df9c4 is fpc.reshandles\n"
^done
(gdb)
<-break-insert -f foo>
&"Function \"foo\" not defined.\n"
^done,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="foo",times="0",original-location="foo"}
(gdb)
<-break-delete 5>
^done
(gdb)
<-exec-run>
=thread-group-created,id="15591"
=thread-created,id="1",group-id="15591"
^running
*running,thread-id="all"
(gdb)
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x080480e0",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="19"},thread-id="1",stopped-threads="all",core="0"
(gdb)
<info program>
&"info program\n"
~"\tUsing the running image of child process 15591.\n"
~"Program stopped at 0x80480e0.\n"
~"It stopped at a breakpoint that has since been deleted.\n"
~"Type \"info stack\" or \"info registers\" for more information.\n"
^done
(gdb)
<-break-insert -f dbgtest.lpr:20>
^done,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="0x080480e8",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20",times="0",original-location="dbgtest.lpr:20"}
(gdb)
<-break-enable 6>
^done
(gdb)
<-break-insert -f dbgtest.lpr:22>
^done,bkpt={number="7",type="breakpoint",disp="keep",enabled="y",addr="0x080480f2",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="22",times="0",original-location="dbgtest.lpr:22"}
(gdb)
<-break-enable 7>
^done
(gdb)
<-exec-continue>
^running
*running,thread-id="all"
(gdb)
*stopped,reason="breakpoint-hit",disp="keep",bkptno="6",frame={addr="0x080480e8",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20"},thread-id="1",stopped-threads="all",core="0"
(gdb)
<-symbol-list-lines /home/sven/projects/tests/dbgtest/dbgtest.lpr>
^done,lines=[{pc="0x080480a0",line="15"},{pc="0x080480a9",line="16"},{pc="0x080480d2",line="17"},{pc="0x080480e0",line="19"},{pc="0x080480e8",line="20"},{pc="0x080480ed",line="21"},{pc="0x080480f2",line="22"},{pc="0x080480f7",line="23"}]
(gdb)
<-stack-list-frames 0 0>
^done,stack=[frame={level="0",addr="0x080480e8",func="main",file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20"}]
(gdb)
<-exec-next>
^running
*running,thread-id="1"
(gdb)
*stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",frame={addr="0x080480e8",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="20"},thread-id="1",stopped-threads="all",core="0"
(gdb)
<-exec-continue>
^running
*running,thread-id="1"
(gdb)
*stopped,reason="breakpoint-hit",disp="keep",bkptno="7",frame={addr="0x080480f2",func="main",args=[],file="dbgtest.lpr",fullname="/home/sven/projects/tests/dbgtest/dbgtest.lpr",line="22"},thread-id="1",stopped-threads="all",core="0"
(gdb)
<-exec-continue>
^running
*running,thread-id="1"
(gdb)
Hello World
Hello World
Hello World
=thread-exited,id="1",group-id="15591"
=thread-group-exited,id="15591"
*stopped,reason="exited-normally"
(gdb)
<-break-delete 6>
^done
(gdb)
<-break-delete 7>
^done
(gdb)
<-break-delete 2>
^done
(gdb)
<-break-delete 3>
^done
(gdb)
<-break-delete 4>
^done
(gdb)
<-file-exec-and-symbols >
^done
(gdb)

dbg-failed-run.txt (9,982 bytes)

Marc Weustink

2010-09-17 00:13

administrator   ~0041150

Don't know when gdb introduced it but it may be related to the thread scheduler locking. THe sthrange thing is that all threads are stopped, but only one is continued. Which should be all, since we have only one thread, but I don't know the gdb internals about this.
Can you try a 7.2 version of gdb ?

Marc Weustink

2010-09-17 01:00

administrator   ~0041151

Last edited: 2010-09-17 01:13

OK, i checked 7.2 on windows and i get similar issues
For now I would suggest to use an older gdb if you don't need a 7.1

edit...
Found something when issuing the commands myself. When stepping, gdb presents a (gdb) prompt, then continues with all threads. I can imagine Lazarus doesn't like this. :(

 (gdb)
 -exec-next
 ^running
 *running,thread-id="1"
 (gdb)
 *running,thread-id="all"

this is all the result of issuing "-exec-next"

Sven Barth

2010-09-17 17:04

manager   ~0041168

But why does it work on a second run of the application? (if debugoutput window is closed etc.)

I need a 7.2 (or whatever version I have), cause it's the version installed by my distro and I don't want to fiddle around with that (I hope you understand that ^^). Also it's only a minor issue for me, cause it's work on the second run. :)

Regards,
Sven

Marc Weustink

2010-09-18 00:34

administrator   ~0041176

I think it just a coincidence it runs. As soon as Lazarus sees a (gdb) prompt it thinks gdb is paused. In this state, as soon as you need some debugger evaluation/breakpoint manipulation/whatever, Lazarus will issue that command, without pausing gdb first. As soon as you hit the next breakpoint, this state is correct.
I'll add an extra check to see if there is more output after the (gdb)

2010-11-09 11:22

 

debugln-debugger.patch (689 bytes)
Index: cmdlinedebugger.pp
===================================================================
--- cmdlinedebugger.pp	(revision 28154)
+++ cmdlinedebugger.pp	(working copy)
@@ -371,6 +371,7 @@
   then FOutputBuf := '';
   FFlushAfterRead := False;
   //writeln('TCmdLineDebugger.ReadLine returns ', result);
+debugln('<< TCmdLineDebugger.ReadLn "',Result,'"');
 end;
 
 procedure TCmdLineDebugger.SendCmdLn(const ACommand: String); overload;
@@ -378,6 +379,7 @@
   LE: string[2];
 begin
   //writeln('TCmdLineDebugger.SendCmdLn "',ACommand,'"');
+debugln('>> TCmdLineDebugger.SendCmdLn "',ACommand,'"');
   if DebugProcessRunning
   then begin
     DoDbgOutput('<' + ACommand + '>');

Martin Friebe

2010-11-09 11:24

manager   ~0042906

- please update to rev 28161 or later.
- Apply the patch, I uploaded (form more verbose outbug)
- compile with -dGDMI_QUEUE_DEBUG

Run with -debug-log

and attach the log of a faulty session

Sven Barth

2010-11-11 21:42

manager   ~0042971

I've tested with revision 28183 (without patch and without -dGDMI_QUEUE_DEBUG): I can no longer reproduce the problem as mentioned in my report. So the problem was either fixed or it just disappeared... I hope it's the first one ^^

Regards,
Sven

Martin Friebe

2010-11-11 21:50

manager   ~0042972

Fixed in rev 28162

The issue was that the IDE had to interrupt the execution, to get the executable-lines (blue dots in gutter).

Unfortunately this interruption was send to the app *after* the app already hit the breakpoint. The app then took the pause request, after being continued, and the IDE resumed it again (but with F9 instead of F8).

Sven Barth

2010-11-11 22:11

manager   ~0042973

That also explains why it worked when run a second time without recompiling :)

Thanks for fixing, now I can enjoy debugging console applications on Linux.

Regards,
Sven

Issue History

Date Modified Username Field Change
2010-08-02 21:25 Sven Barth New Issue
2010-08-02 21:25 Sven Barth Status new => assigned
2010-08-02 21:25 Sven Barth Assigned To => Marc Weustink
2010-08-02 21:25 Sven Barth Widgetset => GTK 2
2010-08-02 23:48 Vincent Snijders Note Added: 0039904
2010-08-03 00:02 Vincent Snijders Relationship added related to 0011950
2010-08-03 00:03 Vincent Snijders Note Added: 0039905
2010-08-03 09:09 Sven Barth Note Added: 0039918
2010-08-04 22:13 Sven Barth Note Added: 0039990
2010-08-08 16:45 Marc Weustink Note Added: 0040066
2010-08-08 16:45 Marc Weustink LazTarget => -
2010-08-08 16:45 Marc Weustink Status assigned => feedback
2010-08-29 14:31 Sven Barth Note Added: 0040588
2010-08-29 14:32 Sven Barth File Added: dbg-failed-run.txt
2010-09-17 00:13 Marc Weustink Note Added: 0041150
2010-09-17 01:00 Marc Weustink Note Added: 0041151
2010-09-17 01:10 Marc Weustink Note Edited: 0041151
2010-09-17 01:13 Marc Weustink Note Edited: 0041151
2010-09-17 17:04 Sven Barth Note Added: 0041168
2010-09-18 00:34 Marc Weustink Note Added: 0041176
2010-09-18 00:35 Marc Weustink LazTarget - => 0.9.30
2010-09-18 00:35 Marc Weustink Status feedback => assigned
2010-11-09 11:22 Martin Friebe File Added: debugln-debugger.patch
2010-11-09 11:24 Martin Friebe Note Added: 0042906
2010-11-09 11:24 Martin Friebe Status assigned => feedback
2010-11-09 13:54 Martin Friebe Status feedback => assigned
2010-11-09 13:54 Martin Friebe Assigned To Marc Weustink => Martin Friebe
2010-11-11 21:42 Sven Barth Note Added: 0042971
2010-11-11 21:50 Martin Friebe Fixed in Revision => 28162
2010-11-11 21:50 Martin Friebe Status assigned => resolved
2010-11-11 21:50 Martin Friebe Fixed in Version => 0.9.29 (SVN)
2010-11-11 21:50 Martin Friebe Resolution open => fixed
2010-11-11 21:50 Martin Friebe Note Added: 0042972
2010-11-11 21:51 Martin Friebe Target Version => 0.9.30
2010-11-11 22:11 Sven Barth Status resolved => closed
2010-11-11 22:11 Sven Barth Note Added: 0042973