Re: Globals variable problem
Re: Globals variable problem
- Subject: Re: Globals variable problem
- From: Greg Guerin <email@hidden>
- Date: Sat, 26 Jul 2008 12:41:07 -0700
Michael wrote:
I cannot get the debugger to show the array "lineptrs".
Have done this.
Opened the globals browser and selected "Sort_strings" ( the name
of the project) but nothing to check in the right hand field.
I just ran a test case using Xcode 3.0.
Created a project from Standard Tool template under the Command Line
Utility heading.
Pasted your code into main.c. Edited to get a clean compile:
- commented out #include "krExercises.h"
- defined do-nothing readlines()
- defined do-nothing stuff()
- defined do-nothing morestuff()
Set breakpoints on all functions. Activated all breakpoints.
Chose "Build and Debug". It stops at first breakpoint. Clicked the
disclosure triangle adjacent to Globals in GDB's debugger window.
Globals Browser window appeared.
Clicked on my code in left-hand list. Observed in Globals Browser:
there are no global names listed for my code (nor for any libraries,
in fact).
Stopped the debugger.
Double-clicked the Target to open its Target window.
Chose the Build tab.
Changed "Debug Information Format" under Build Options heading from:
DWARF with dSYM file
to:
DWARF
Rebuild, re-debug, reopen the Globals Browser window, and now it
shows global symbols for my code. Still no globals for any other
libs, though.
To confirm the cause, stopped GDB again. Went back to Target window,
rechose "DWARF with dSYM file", rebuilt, re-debugged, reopened
Globals Browser window. Back to the same problem: no globals are
listed for my code in Globals Browser.
The dSYM file is next to the executable, so I see no reason why
anything should be unable to find it. Besides, GDB presumably IS
finding it, since the breakpoints work, and local variables work,
it's just global variables that are borked in Globals Browser.
The same thing happens in either Release or Debug build config. And
"Load symbols lazily" is always unchecked under Preferences >
Debugging > Symbol Loading Options.
Since you didn't say which version of Xcode you're using, the above
may or may not apply to you. For example, it might be fixed in Xcode
3.1. Or it might not, since I'm not running it and can't check it.
Also, the Xcode user guide doesn't mention any special actions for
using "DWARF with dSYM file" as the symbol format. If there is
something special that needs to be done to tell GDB or Globals
Browser where to look for dSYM files, I don't know what it is yet.
Personally, this doesn't matter much to me, since I'll just use a
plain DWARF to crush bugs, or occasionally electrician's pliers.
Finally, it's possible for variables to be optimized away:
http://developer.apple.com/releasenotes/DeveloperTools/RN-GDB/
index.html
I'm not sure if this applies to globals (i.e. variables with the
static storage class), but I see no logical reason it couldn't be
done. Since we don't know what's in your readlines() or
krExercises.h, it's possible something else is going on that no one
would be able to figure out without seeing all your code, or a more
self-contained fail-case.
-- GG
_______________________________________________
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