Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-04

debugger crashing on OS X

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John Stoneham

The debugger crashing might be related to the "unknown stabs type" error when linking, which I've learned is an XCode 3.x linker problem and has to be worked around by adding "-gw2 -godwarfsets" when compiling Lazarus and laz projects. Using those options allows linking to proceed without any errors. I also make sure my laz projects are compiled with those options.

However, now the debugger doesn't work in Lazarus. Sometimes it doesn't load, and when it does, trying to stop the debugger or end the running program crashes Lazarus itself (not the project app) with an "Access violation" message.

Activity monitor shows gdb running in 64-bit mode. This is the new gdb installed with XCode 3.2.2. There doesn't seem to be a way to force it to run in 32-bit mode. Thinking this may be a 64-vs-32bit issue (but not sure), I tried to compile Lazarus as a 64-bit application. I could not do this, since the carbon widgetset requires 32-bit mode (lots of compilation errors about pointers), and I can't seem to get the cocoa widgetset to compile either, though for different reasons.

So, my questions. Do any of the Mac devs have Snow Leopard 10.6.3 and XCode 3.2.2? Is gdb running in 64-bit mode the source of the debugging problems? If so, is it possible to compile Lazarus as a 64-bit application on OS X?

John -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100430/d4f0afe3/attachment.html>

Reply by email

dmitry boyarintsev
to John Stoneham

Hello John,

The problem with OSX debugger is that Apple has its own gdb-fork (a bit different to GNU gdb). To makes things worse, gdb slightly changes from one Xcode minor release to another. So, if you want to have your debugger working with Xcode 3.2.2. please send the content of Debug Output window, if possible.

Do any of the Mac devs have Snow Leopard 10.6.3 and XCode 3.2.2?

I guess, we don't have such information, though there have been some issues in the past with 10.6 and Xcode 3.2 debugger.

Is gdb running in 64-bit mode the source of the debugging problems?

Yes. That's what Xcode does.

If so, is it possible to compile Lazarus as a 64-bit application on OS X?

No. Lazarus is Carbon (32-bit only) based, and Cocoa widgetset (that supports 64-bit) is not ready yet. However even 32-bit Lazarus is able to debug 64-bit applications, because it uses gdb as stand-alone process.

thanks,
Dmitry

Reply by email

John Stoneham
to dmitry boyarintsev

Well this is interesting. Running gdb from the command-line and loading the compiled project runs fine. Here's the output:

obijohn:~/projects/fpc/testprojects/project1$ gdb project1.app GNU gdb 6.3.50-20050815 (Apple version gdb-1461.2) (Fri Mar 5 04:43:10 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ............ done

(gdb) run
Starting program:
/Users/obijohn/projects/fpc/testprojects/project1/project1.app/Contents/MacOS/project1

Reading symbols for shared libraries
.+++++++++++......................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

[ here I just quit the program ]

Program exited normally.
(gdb) quit
obijohn:~/projects/fpc/testprojects/project1$

And below is the Debug Output window contents after trying to debug it in Lazarus. The project did not successfully display and I had to use Activity Monitor to fore-quit gdb.

(gdb)
<-gdb-set confirm off>
^done,time={wallclock="0.00006",user="0.00002",system="0.00003",start="1272660731.894504",end="1272660731.894561"} (gdb)
<-gdb-set new-console off>
^error,msg="No symbol table is loaded. Use the \"file\" command." (gdb)
<-gdb-version>
~"GNU gdb 6.3.50-20050815 (Apple version gdb-1461.2) (Fri Mar 5 04:43:10 UTC 2010)\n"
~"Copyright 2004 Free Software Foundation, Inc.\n" ~"GDB is free software, covered by the GNU General Public License, and you are\nwelcome to change it and/or distribute copies of it under certain conditions.\nType \"show copying\" to see the conditions.\nThere is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-apple-darwin\"." ^done,version="6.3.50-20050815 (Apple version
gdb-1461.2)",rc_version="1461.2",target="x86_64-apple-darwin",build-date="Fri Mar 5 04:43:10 UTC
2010",time={wallclock="0.00083",user="0.00031",system="0.00002",start="1272660731.905626",end="1272660731.906459"} (gdb)
<-gdb-set env Apple_PubSub_Socket_Render=/tmp/launch-EHgJpp/Render> ^done,time={wallclock="0.00010",user="0.00006",system="0.00004",start="1272660731.913567",end="1272660731.913668"} (gdb)
<-gdb-set env COMMAND_MODE=unix2003>
^done,time={wallclock="0.00003",user="0.00003",system="0.00000",start="1272660731.917756",end="1272660731.917784"} (gdb)
<-gdb-set env DISPLAY=/tmp/launch-3gZz9f/org.x:0>
^done,time={wallclock="0.00002",user="0.00002",system="0.00000",start="1272660731.921206",end="1272660731.921229"} (gdb)
<-gdb-set env HOME=/Users/obijohn>
^done,time={wallclock="0.00003",user="0.00003",system="0.00000",start="1272660731.924519",end="1272660731.924549"} (gdb)
<-gdb-set env LOGNAME=obijohn>
^done,time={wallclock="0.00003",user="0.00002",system="0.00000",start="1272660731.927624",end="1272660731.927650"} (gdb)
<-gdb-set env PATH=/usr/bin:/bin:/usr/sbin:/sbin>
^done,time={wallclock="0.00006",user="0.00006",system="0.00001",start="1272660731.935884",end="1272660731.935943"} (gdb)
<-gdb-set env SHELL=/bin/bash>
^done,time={wallclock="0.00003",user="0.00002",system="0.00000",start="1272660731.939431",end="1272660731.939456"} (gdb)
<-gdb-set env SSH_AUTH_SOCK=/tmp/launch-jggwxM/Listeners> ^done,time={wallclock="0.00002",user="0.00002",system="0.00000",start="1272660731.942555",end="1272660731.942572"} (gdb)
<-gdb-set env TMPDIR=/var/folders/wq/wq3ehK6WFCWBnVQhT-CZqE+++TI/-Tmp-/> ^done,time={wallclock="0.00002",user="0.00002",system="0.00000",start="1272660731.946128",end="1272660731.946147"} (gdb)
<-gdb-set env USER=obijohn>
^done,time={wallclock="0.00002",user="0.00001",system="0.00000",start="1272660731.949434",end="1272660731.949451"} (gdb)
<-gdb-set env __CF_USER_TEXT_ENCODING=0x1F5:0:0>
^done,time={wallclock="0.00002",user="0.00002",system="0.00000",start="1272660731.952694",end="1272660731.952711"} (gdb)
<-file-exec-and-symbols
"/Users/obijohn/projects/fpc/testprojects/project1/project1.app"> ^done,time={wallclock="0.34025",user="0.25639",system="0.07742",start="1272660731.956120",end="1272660732.296369"} (gdb)
<-environment-cd .>
^done,time={wallclock="0.00008",user="0.00006",system="0.00002",start="1272660732.302764",end="1272660732.302846"} (gdb)
<-environment-cd "/Users/obijohn/projects/fpc/testprojects/project1/"> ^done,time={wallclock="0.00004",user="0.00003",system="0.00001",start="1272660732.306046",end="1272660732.306085"} (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" ~"\nNon-debugging symbols:\n"
~"0x00011c00 SYSTEM_FPC_CPUINIT\n"
^done
(gdb)
<-exec-arguments >
^done,time={wallclock="0.00003",user="0.00003",system="0.00001",start="1272660732.346016",end="1272660732.346051"} (gdb)
<set width 50000>
&"set width 50000\n"
^done
(gdb)
<-gdb-set language pascal>
^done,time={wallclock="0.00003",user="0.00002",system="0.00000",start="1272660732.352609",end="1272660732.352635"} (gdb)
<info address main>
&"info address main\n"
~"Symbol \"main\" is at 0x1140c in a file compiled without debugging.\n" ^done
(gdb)
<-break-insert -t *70668>
^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0001140c",file="project1.lpr",line="19",shlib="/Users/obijohn/projects/fpc/testprojects/project1/project1.app/Contents/MacOS/project1",times="0"},time={wallclock="0.00049",user="0.00019",system="0.00031",start="1272660732.361100",end="1272660732.361595"} (gdb)
<ptype TObject>
&"ptype TObject\n"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100430/4af03ff5/attachment.html>

Reply by email

Marc Weustink
to John Stoneham
John Stoneham wrote
And below is the Debug Output window contents after trying to debug it in Lazarus. The project did not successfully display and I had to use Activity Monitor to fore-quit gdb.

...

Show quoted text 6 lines
(gdb) <-break-insert -t *70668> ^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0001140c",file="project1.lpr",line="19",shlib="/Users/obijohn/projects/fpc/testprojects/project1/project1.app/Contents/MacOS/project1",times="0"},time={wallclock="0.00049",user="0.00019",system="0.00031",start="1272660732.361100",end="1272660732.361595"} (gdb) <ptype TObject> &"ptype TObject\n"

is this really the last line ? Till here all communications with gdb are OK. There should be 3 more breakpoints and a exec-run or somthing following.

Marc

Reply by email

John Stoneham
to Marc Weustink

(gdb)

Show quoted text 15 lines
> <-break-insert -t *70668> > > ^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0001140c",file="project1.lpr",line="19",shlib="/Users/obijohn/projects/fpc/testprojects/project1/project1.app/Contents/MacOS/project1",times="0"},time={wallclock="0.00049",user="0.00019",system="0.00031",start="1272660732.361100",end="1272660732.361595"} > (gdb) > <ptype TObject> > &"ptype TObject\n" > is this really the last line ? Till here all communications with gdb are OK. There should be 3 more breakpoints and a exec-run or somthing following. Marc

Yes, that is really the last line. There is no further output in the window. However, if I run "startlazarus" from the command-line, there is a tiny bit more, plus showing when i tried to stop the debugger (the first line here corresponds with the last line in the debug output window):

[Debugger] Log output: &"ptype TObject\n"
[WARNING] Debugger: Execution of external command
"-data-evaluate-expression %s" while queue exists

TDebugger.ReqCmd failed: Evaluate
TDebugger.ReqCmd Command not supported: Stop ClassName=TGDBMIDebugger TDebugger.Stop Class=TGDBMIDebugger failed.

And that's all.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100430/5a1912fb/attachment.html>

Reply by email

John Stoneham
to John Stoneham
John Stoneham wrote 35 lines
(gdb) > >> <-break-insert -t *70668> >> >> ^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0001140c",file="project1.lpr",line="19",shlib="/Users/obijohn/projects/fpc/testprojects/project1/project1.app/Contents/MacOS/project1",times="0"},time={wallclock="0.00049",user="0.00019",system="0.00031",start="1272660732.361100",end="1272660732.361595"} >> (gdb) >> <ptype TObject> >> &"ptype TObject\n" >> > > is this really the last line ? Till here all communications with gdb are > OK. There should be 3 more breakpoints and a exec-run or somthing following. > > Marc > > Yes, that is really the last line. There is no further output in the window. However, if I run "startlazarus" from the command-line, there is a tiny bit more, plus showing when i tried to stop the debugger (the first line here corresponds with the last line in the debug output window): [Debugger] Log output: &"ptype TObject\n" [WARNING] Debugger: Execution of external command "-data-evaluate-expression %s" while queue exists TDebugger.ReqCmd failed: Evaluate TDebugger.ReqCmd Command not supported: Stop ClassName=TGDBMIDebugger TDebugger.Stop Class=TGDBMIDebugger failed. And that's all.

A bit more testing and it seems this definitely has something to do with the interface to gdb used by Lazarus. Running gdb on the command line, I can load the project, set breakpoints and watches, step... everything basic seems to work. Which is fine, but this really just turns Lazarus into an editor. Without the ability to debug, it's not an IDE anymore.

I'll be happy to help however I can to get this fixed, but someone needs to tell me what to do from here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100501/535d2699/attachment-0001.html>

Reply by email

Marc Weustink
to John Stoneham: (gdb) Yes, that is really the last line. There is no further output in the window.…
John Stoneham wrote 8 lines
Yes, that is really the last line. There is no further output in the window. However, if I run "startlazarus" from the command-line, there is a tiny bit more, plus showing when i tried to stop the debugger (the first line here corresponds with the last line in the debug output window): [Debugger] Log output: &"ptype TObject\n" [WARNING] Debugger: Execution of external command "-data-evaluate-expression %s" while queue exists

:( this is indeed a reason for the debugger to stop.

When I initially made the interface to gdb, I designed it such that multiple commands could be send to the debugger. While gdb was processing one command others could be added to some command queue.

While implementing the various parts it became clear that the result of such command was needed in context of such part. For instance evaluating a variable requires more than one call to gdb.
Having a queue with different callbacks for this would make the code unneeded complicated. On second thought the queue wasn't really needed. So I limited it to allow only one command.

What happens here is that somehow a external (==user triggered) evanuate expression is run while while <ptype TObject> is still being processed. This should not happen. Do you have other debug windows opend like watches, locals or breakpoints. Do you have a mouse hovering over some variable ?

Marc

Reply by email

John Stoneham
to Marc Weustink
Show quoted text 7 lines
What happens here is that somehow a external (==user triggered) evanuate expression is run while while <ptype TObject> is still being processed. This should not happen. Do you have other debug windows opend like watches, locals or breakpoints. Do you have a mouse hovering over some variable ?

Ok, I ran "startlazarus" from the command line, loaded the "bare-bones" project, selected "build all", then "run". No debug windows were open, and I made sure the cursor never went away from the Run menu, and no breakpoints were set. The project app did not run. I then tried another "run" command from the menu -- nothing. So I did the "stop" command from the menu. Below is the console output from the first "run" command which was followed by another "run" and then a "stop":

TMainIDE.DoInitProjectRun
ProgramFilename=/Users/obijohn/projects/fpc/testprojects/project1/project1 [TCmdLineDebugger] Debug PID: 47911
TGDBMIDebugger.ProcessResult Error: ,msg="No symbol table is loaded. Use the \"file\" command."
[Debugger] Running GDB version: 6.3.50-20050815 (Apple version gdb-1461.2) [TDebugger.SetFileName]
"/Users/obijohn/projects/fpc/testprojects/project1/project1.app" [TMainIDE.DoRunProject] B TGDBMIDebugger
[TMainIDE.DoRunProject] END
TGDBMIDebugger.StartDebugging
WorkingDir="/Users/obijohn/projects/fpc/testprojects/project1/" TGDBMIDebugger.ProcessResult Error: ,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context." [Debugger] Log output: &"info functions FPC_CPUINIT\n" [Debugger] Log output: &"set width 50000\n"
[Debugger] Log output: &"info address main\n"
[Debugger] Log output: &"ptype TObject\n"
[TMainIDE.DoRunProject] A
[TMainIDE.DoRunProject] B TGDBMIDebugger
[TMainIDE.DoRunProject] END
TDebugger.ReqCmd Command not supported: Stop ClassName=TGDBMIDebugger TDebugger.Stop Class=TGDBMIDebugger failed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100501/5a654bf9/attachment.html>

Reply by email