On 08/07/2009 10:20 AM, Neil Tiffin wrote:
Duncan,
I am not sure that even if you answer these questions that I can help,
but I'll try.
How did you start gdb? What commands? Exactly what process did you
attach to? What is in xcode and what is not?
I started R in an xterm, and ran system("ps") to find its process ID. I
also ran library(rgl) to get it loaded.
I started Xcode on a project that imports a bunch of files from R and rgl.
I started gdb by menu in Xcode: Run | Attach to process | Process ID...
This immediately breaks showing a bunch of assembler, because Xcode
doesn't know the connection between the R source and the binary. (I
have had more success doing this on a build of R I made myself, but in
this case I'm using Simon's, and I get lots of warnings in the gdb
console that it can't find the source in directories on his system named
things like /Builds/Rdev-web/QA/Simon/... . I don't want to debug R
this time, so I have ignored those. I want to debug rgl.
All of the rgl source code has been added to the Xcode project, using
Project | Add to project.
How exactly are you trying to set the break point? And what does gdb
respond with when you set it from the command line?
I try to set the breakpoint by clicking in the left margin of one of the
source files. I haven't tried doing it from the command line until now,
but it doesn't like the syntax I was trying. (How do you specify a
source file line number? Alternatively, how do you specify a C++
method? I can set breakpoints at C functions by name, and then Xcode
does find the right source line, but rgl is mostly C++.
Was anything compiled from xcode?
No.
Was rgl.so compiled with debug symbols turned on?
I don't know: it was compiled by R CMD INSTALL rgl. I was told a
couple of years ago that symbols were included by default, but I don't
know if that's still true. I think so (based on my success with C
functions).
Was X11gui compiled with debug symbols turned on?
It's just part of rgl, so the same answer.
Xcode integration with gdb is a complicated situation. Just because
xcode can see something does not really mean that gdb can see it,
although it usually works with Apple magic. Are you indicating that
gdb can see the source file or that xcode can see the source file?
I'm not sure who can see what. Here's the summary:
- In the gdb console, I can set a breakpoint at a C function, and
Xcode will jump to the right source line for rgl.
- I can't seem to set a breakpoint from the source display.
Duncan Murdoch
Running x11, R, and rgl all in debug mode would seem a real
challenge. Not being an x11 expert, I would also raise the question
with people familiar with X11 debugging in Mac OS X. I would start
with breakpoints only in rgl.so (which is probably what you are trying
to do) and not x11gui.cpp:300.
You might want to run gdb without xcode and see what's going on.
You'll have to wade through a bunch of command line stuff, but you do
get direct feedback without it being absorbed by xcode.
Neil
On Jul 8, 2009, at 8:53 AM, Duncan Murdoch wrote:
Neil Tiffin wrote:
You might research gdb fb command (future-break.) It allows you
to set a breakpoint in code that is not loaded when the debugger
is started. I believe you would have to use the debugger console
not the GUI with a syntax like "fb rgl.so:function_name".
But it is loaded when I want to set the breakpoint. I can see the
source file, set a breakpoint in it, but it doesn't work. I opened
the gdb console (thanks for the suggestion), and I see warnings like
Warning - No location found for "x11gui.cpp:300"
when I try to set a breakpoint in rgl. How do I tell it where to
find the location corresponding to that file?
Duncan Murdoch
On Jul 8, 2009, at 5:57 AM, Duncan Murdoch wrote:
I'd like to use Xcode to debug the rgl package, which is crashing
sometimes in X11 on OSX. In the past, I've done this for
debugging R itself, and have a project set up for that. I can
attach to the process ID, and then I see rgl.so is loaded, but I
can't see how to set a breakpoint in the rgl.so code.
Has anyone else done this before? Can you point me to step-by-
step instructions?
Duncan Murdoch
_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac