Re: GDB frustration
Re: GDB frustration
- Subject: Re: GDB frustration
- From: Jim Ingham <email@hidden>
- Date: Thu, 19 Jan 2006 16:31:23 -0800
On Jan 19, 2006, at 3:28 PM, David Litwin wrote:
I’m trying to debug a problem in my app, and am getting the run
around from GDB.
When debugging C++ code the XCode stepping functions rarely seem to
let me trace the full code path and, as many have pointed out
before, seems to skip over quite a bit (often multiple lines).
Because my bug seems to happen deep between where “Step Into”
button skips, I’ve come to rely on the debugger console and ‘stepi’
in GDB.
If you can come up with cases of this that you can send to us, please
file bugs. Though the symptom is common, the causes are many for
this sort of bad behavior. So even if we fix somebody else's bug
with exactly this behavior, we may not fix yours...
But lately even that has been failing me. For much of the code,
Xcode can’t seem to track where it is at all, and I’ve come to rely
on watching $pc in the Expressions window and looking at the
disassembly pane to keep up. There is no red arrow following along
to help me, although I can’t see why not given I can look at $pc
and that address is often showing in the disassembly pane.
Again, please file a bug about this. Even if you can't get a project
to us, a copy of the Xcode-gdb trace might be illuminating. To get
this, do:
1) Quit Xcode.
2) In Terminal, say:
$ defaults write com.apple.Xcode PBXGDBDebuggerLogToFile YES
$ defaults write com.apple.Xcode PBXGDBDebuggerLogFileName /tmp/
IncludeInBug.log
3) Restart Xcode, and do whatever you need to to make it fail.
4) Attach /tmp/IncludeInBug.log to the Radar.
Now even that is failing me. I’ve stepped into a cast operator and
can’t get Xcode to show me any disassembly. The GDB console puts
up the message:
Unable to disassemble Foo::operator Bar.
When I type “disassem $pc” I get:
No function contains specified address
It would be wonderful if the debugger could help me walk through my
code, but failing that could it at least show me what instruction I
am about to perform by typing “stepi”? I would think the disassem
command would disassemble the memory passed to it, but it seems to
just look within the loaded code for it…
(gdb) help disassemble
Disassemble a specified section of memory.
Default is the function surrounding the pc of the selected frame.
With a single argument, the function surrounding that address is dumped.
Two arguments are taken as a range of memory to dump.
So "disassemble" with one argument disassembles the function
surrounding the pc. For some reason we can't figure out what
function is at the current pc, so that's not going to work. You can
use "x" as Eric suggests. Of you can do:
disassemble $pc $pc+32
which disassembles the given range around the pc.
Note, the "x" command (and the display command as well) also takes a
count, so you can do:
x/10i $pc
to see the next 10 instructions after the pc.
Jim
Dave
P.S. Some details: This is code running in a .dylib I’ve loaded
with dlopen(). All my executables have no optimizations and full
symbols.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden