Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Duncan_Brown
Beginner
112 Views

Mac Xcode debugger - globals no longer show values?

I've recently upgraded to Mac OS X 10.6 (from whatever the last 10.5.x version was), with Xcode 3.2 (from 3.0), and therefore to intel C++ compiler version 11.1.067 (from 11.0.059) to work with it.

Now when debugging, my global vars don't show any values. It's just blank to the right on any I select to show. If I right click on one of the global var names in the Debugger window, and select "View in Memory Browser" the browser has a message "Unable to read memory."

I've seen the release not about using the -save-temps compiler option, and that sounds like about the problem I'm having... except that there is no equivalent to that command line option within XCode, and it appears to be because it is in fact generating the .o files anyway.

I used to be able to watch the values of globals... is it something I'm doing wrong/differently, or something that broke with Snow Leopard, or...?

Thanks,
Duncan
0 Kudos
8 Replies
Duncan_Brown
Beginner
112 Views


OK, I realized I hadn't yet upgraded my laptop to Snow Leopard, so I set up to run this test there. OS X 10.5.8, Xcode 3.1.2, and the 11.1.067 intel compiler. Under that setup, I can see my globals just fine when in the debugger in Xcode.

If I go under Snow Leopard and Xcode 3.2, and create a new helloworld project from scratch (which is therefore using the gcc compiler) and add a global var and go into the debugger, I can see the global var value.

So it's apparently some interaction between the intel compiler and the latest versions of OS X and/or Xcode.

Duncan
Hubert_H_Intel
Employee
112 Views


OK, I realized I hadn't yet upgraded my laptop to Snow Leopard, so I set up to run this test there. OS X 10.5.8, Xcode 3.1.2, and the 11.1.067 intel compiler. Under that setup, I can see my globals just fine when in the debugger in Xcode.

If I go under Snow Leopard and Xcode 3.2, and create a new helloworld project from scratch (which is therefore using the gcc compiler) and add a global var and go into the debugger, I can see the global var value.

So it's apparently some interaction between the intel compiler and the latest versions of OS X and/or Xcode.

Duncan

Duncan,
I'm investigating this and will come back to you once I have a result.
Regards,
Hubert.
Duncan_Brown
Beginner
112 Views

A hole in my logic just occurred to me: I was comparing my convoluted program compiled with the intel compiler to a blank project compiled with gcc. More than just the compiler could be different there!!

So I took my blank project and added the target rule to make it compile with the intel compiler. Now my global var value was not viewable. I removed that rule to make it compile with gcc again. Now the global bar value was viewable.

OK, I feel better now: that definitively proves it's some interaction with the intel compiler; nothing at all to do with my code.

Duncan
Quoc-An_L_Intel
Employee
112 Views


I can definitely reproduce the problem on OSX 10.6.1 / Xcode 3.2 and Intel compiler 11.1.067. There seems to be some compatibility issue with gdb and icc 11.1.067.I can reproduce it on the command line. Works with idb though.



This iproblem is on OSX 10.6.1 with Xcode 3.2. I don't see this problem with gdb on OSX 10.5.8 with Xcode 3.1.3.

If the file is built with gcc, gdb is able to view the value of the global variable.


intels-mac-pro:helloword_icc ale$ cat main.c
#include

int g =1000;

int main (int argc, const char * argv[]) {
// insert code here...
printf("Hello, World!n");
return 0;
}
intels-mac-pro:helloword_icc ale$
intels-mac-pro:helloword_icc ale$
intels-mac-pro:helloword_icc ale$ icc -c -g -O0 -o main.o main.c
intels-mac-pro:helloword_icc ale$ icc -g -o exe main.o
intels-mac-pro:helloword_icc ale$ icc -V
Intel C Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090827 Package ID: m_cproc_p_11.1.067
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

intels-mac-pro:helloword_icc ale$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5646~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5646)


intels-mac-pro:helloword_icc ale$ gdb exe
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
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) break main
Breakpoint 1 at 0x100000f1b: file main.c, line 7.
(gdb) print g
Cannot access memory at address 0x0
(gdb) q



intels-mac-pro:helloword_icc ale$ idb exe
Intel Debugger for applications running on Intel 64, Version 11.1, Build [1.2097.2.263]
------------------
object file name: exe
Reading symbols from /Users/ale/quad/helloword_icc/exe...done.
(idb) break main
Breakpoint 1 at 0x100000f1b: file /Users/ale/quad/helloword_icc/main.c, line 7.
(idb) print g
$1 = 1000
(idb)
Quoc-An_L_Intel
Employee
112 Views


Try running dsymutil on the binary, and you will be able to view the global value.


Intels-mac-pro:helloword_icc ale$ cat main.c
#include

int g =1000;

int main (int argc, const char * argv[]) {
// insert code here...
printf("Hello, World!n");
return 0;
}
Intels-mac-pro:helloword_icc ale$ icc -g -c -o main.o main.c
Intels-mac-pro:helloword_icc ale$ icc main.o -o exe
Intels-mac-pro:helloword_icc ale$ gdb exe
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
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) break main
Breakpoint 1 at 0x100000f1b: file main.c, line 7.
(gdb) p g
Cannot access memory at address 0x0
(gdb) q


Intels-mac-pro:helloword_icc ale$ dsymutil exe
Intels-mac-pro:helloword_icc ale$
Intels-mac-pro:helloword_icc ale$ gdb exe
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
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) break main
Breakpoint 1 at 0x100000f1b: file main.c, line 7.
(gdb) p g
$1 = 1000
(gdb) q
Intels-mac-pro:helloword_icc ale$
Quoc-An_L_Intel
Employee
112 Views

In Xcode 3.2, it seems that dsymutil is automatically invoke when building in Release configuration, but not debug configuration.Using release configuration, you should be able to see the value of the global in the debugger.
Duncan_Brown
Beginner
112 Views

Quoting - Qale (Intel)
In Xcode 3.2, it seems that dsymutil is automatically invoke when building in Release configuration, but not debug configuration.Using release configuration, you should be able to see the value of the global in the debugger.

Well, whaddayaknow! That works!

Any way to invoke dsymutil when building in Debug configuration in Xcode? I see it works from the command line to just invoke it, but if I'm in the Xcode environment...

Is this something I should be complaining to Apple about?

Thanks,
Duncan
Quoc-An_L_Intel
Employee
112 Views


>>> Any way to invoke dsymutil when building in Debug configuration in Xcode? I see it works from the command line to just invoke it, but if I'm in the Xcode environment...


As far as I can tell, no exposed option to do it with Xcode. The easiest thing to do might just be creating new build phase and run a script to dsymutil the binary.

Select target -> Project -> New Build Phase -> New Run Script Build Phase -> enter script "dsymutil "

>>> Is this something I should be complaining to Apple about?

Please do, and post the Apple Radar# result here.
Reply