mentby.com
Blog | Jobs | Help | Signup | Login

Hello everyone,

This is probably a "Doh!"-moment-in-waiting, but here goes anyway.

I am working on a c++ command-line project with Xcode 3.2.2.  Everything builds fine with no issues.  However, when I debug the executable using GDB, I find that GDB prints a message each time I step over/into/out a line of code, as the transcript below indicates:

I would greatly appreciate an indication of what is going on.  It would appear to be a null pointer somewhere, but I'm not sure under what circumstances GDB would have an issue, since the executable runs to completion with no crashing.

Thank you very much,

Jason

This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys002
Loading program into debugger…
sharedlibrary apply-load-rules all
Program loaded.
run
[Switching to process 79760]
Running…
Current language:  auto; currently c++
Page 1    /Users/jake/Development/Projects/wksp/FormatTool/test_source/ex_repeat.psf    Tue May 11 19:43:26 2010

Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
Cannot access memory at address 0x0
(gdb) continue

Debugger stopped.
Program exited with status value:0.


Jason Breckenridge Thu, 13 May 2010 10:49:32 -0700

Do you have any breakpoint actions? This looks like "po nil" to me.

(Nothing wrong with nil pointers, you can message them, just don't dereference them!)

David Dunham
Mobile: +1 206 769 2227              http://www.pensee.com/dunham/
Imagination is more important than knowledge. -- Albert Einstein


David Dunham Thu, 13 May 2010 11:03:40 -0700

No breakpoint actions are set that I am able to find.  I admit that I'mnot particularly knowledgeable at the GDB command line, but there arenone showing in the Xcode breakpoints window.

Also, this is pure c  , so no messaging of null pointers is aloud.

Jason


Jason Breckenridge Thu, 13 May 2010 12:11:52 -0700

Are you meaning that you are able to debug normally, but for some reason
you get a message every time you step?  Or do you mean that you cannot
debug and when you try to step you get this message?  Are you using Xcode
to build your project or are you building it on the command line using
autotools, make, or something similar?

Are you sure you're debugging the 'Debug' build configuration and you
aren't stripping your program?  Xcode will let you "debug" a Release build
of a project, but the result for me is that I can't really debug anything
because the release is stripped.   Have you messed with the "Load Symbols
Lazily" setting in the Debugging section of Xcode preferences?  In my
project I need to have that checked to be able to debug successfully, but
the usual symptom is that the program won't stop on breakpoints.

You can see all breakpoints by clicking "Show Breakpoints" in the debugger
window that opens with Command+Shift+Y.  You might have to make the window
larger to see the "Show Breakpoints" button to the right of the "Step Out"
button on the top toolbar.


Xochitl Lunde Thu, 13 May 2010 15:02:21 -0700

Are you stepping in Xcode?  If so, do you have any global pointervariables?  And are they set to NULL?  My guess is that what you'reseeing is an artefact cause by Xcode's debugger window trying to displayvalues for a variable.

If you debug from the command line instead, and it goes away, it'scertainly nothing to worry about.

Kind regards,

Alastair.

-- http://alastairs-place.net


Alastair Houghton Thu, 13 May 2010 15:27:05 -0700

Yes, I am able to debug normally.  It stops at breakpoints as desired,I can view the values of variables, step into and out of functions, etc., but at each step GDB prints the message

Cannot access memory at address 0x0

as I previously mentioned.  This message is printed whether I step in Xcode, or from the GDB console.

This is not a show-stopper, but I'm really puzzled as to the cause.

Thanks for your help,

Jason


Jason Breckenridge Fri, 14 May 2010 10:18:43 -0700



Related Topics

Post a Comment