[MacPorts] #48284: gdb @7.9.1_0: cannot determine type of primitive global variables
MacPorts
noreply at macports.org
Sun Jul 12 17:22:07 PDT 2015
#48284: gdb @7.9.1_0: cannot determine type of primitive global variables
---------------------+-------------------------------
Reporter: rbd@… | Owner: stuartwesterman@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.3.3
Resolution: | Keywords:
Port: gdb |
---------------------+-------------------------------
Comment (by stuartwesterman@…):
When you compile in the way that you have above, the debug symbols are not
created.
I think you say it the best here:
I have read that dsymutil is *not* run when the source files are
separately compiled into .o files and the latter are then linked with a
separate command (as in my multi-file cc command sequence shown
above). Perhaps this has some bearing on the problem?
Simply run '''dsymutil''' on your output elf, after linking.
The following works for me:
{{{
wei at r [gdbtest]$ cc -g -c m0.c -o m0.o; cc -g -c m1.c -o m1.o; cc -g m*.o
-o m
wei at r [gdbtest]$ la
total 56
drwxr-xr-x 7 wei staff 238B Jul 12 17:21 ./
drwxr-xr-x 8 wei staff 272B Jul 12 16:13 ../
-rwxr-xr-x 1 wei staff 8.7K Jul 12 17:21 m*
-rw-r--r-- 1 wei staff 118B Jul 12 16:17 m0.c
-rw-r--r-- 1 wei staff 2.4K Jul 12 17:21 m0.o
-rw-r--r-- 1 wei staff 106B Jul 12 16:13 m1.c
-rw-r--r-- 1 wei staff 2.3K Jul 12 17:21 m1.o
wei at r [gdbtest]$ dsymutil m
wei at r [gdbtest]$ la
total 56
drwxr-xr-x 8 wei staff 272B Jul 12 17:21 ./
drwxr-xr-x 8 wei staff 272B Jul 12 16:13 ../
-rwxr-xr-x 1 wei staff 8.7K Jul 12 17:21 m*
drwxr-xr-x 3 wei staff 102B Jul 12 17:21 m.dSYM/
-rw-r--r-- 1 wei staff 118B Jul 12 16:17 m0.c
-rw-r--r-- 1 wei staff 2.4K Jul 12 17:21 m0.o
-rw-r--r-- 1 wei staff 106B Jul 12 16:13 m1.c
-rw-r--r-- 1 wei staff 2.3K Jul 12 17:21 m1.o
wei at r [gdbtest]$ ggdb m
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.3.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from m...Reading symbols from
/Users/wei/code/gdbtest/m.dSYM/Contents/Resources/DWARF/m...done.
done.
(gdb) break main
Breakpoint 1 at 0x100000eee: file m0.c, line 5.
(gdb) break func
Breakpoint 2 at 0x100000f27: file m1.c, line 5.
(gdb) run
Starting program: /Users/wei/code/gdbtest/m
warning: Could not open OSO archive file
"/BinaryCache/corecrypto/corecrypto-233.1.2~26/Symbols/BuiltProducts/libcorecrypto_static.a"
warning:
`/BinaryCache/coreTLS/coreTLS-35.20.2~10/Objects/coretls.build/coretls.build
/Objects-normal/x86_64/system_coretls_vers.o': can't open to read symbols:
No such file or directory.
warning: Could not open OSO archive file
"/BinaryCache/coreTLS/coreTLS-35.20.2~10/Symbols/BuiltProducts/libcoretls_ciphersuites.a"
warning: Could not open OSO archive file
"/BinaryCache/coreTLS/coreTLS-35.20.2~10/Symbols/BuiltProducts/libcoretls_handshake.a"
warning: Could not open OSO archive file
"/BinaryCache/coreTLS/coreTLS-35.20.2~10/Symbols/BuiltProducts/libcoretls_record.a"
warning: Could not open OSO archive file
"/BinaryCache/coreTLS/coreTLS-35.20.2~10/Symbols/BuiltProducts/libcoretls_stream_parser.a"
Breakpoint 1, main () at m0.c:5
5 gf = 1.23;
(gdb) ptype gf
type = float
(gdb) continue
Continuing.
gf: 1.23
Breakpoint 2, func () at m1.c:5
5 lf = 4.56;
(gdb) ptype gf
type = float
(gdb) q
A debugging session is active.
Inferior 1 [process 388] will be killed.
Quit anyway? (y or n) y
wei at r [gdbtest]$
}}}
Given the size and complexity of your project this may not help you, but
compiling in the following way automatically runs '''dsymutil''':
{{{
wei at r [gdbtest]$ la
total 16
drwxr-xr-x 4 wei staff 136B Jul 12 16:29 ./
drwxr-xr-x 8 wei staff 272B Jul 12 16:13 ../
-rw-r--r-- 1 wei staff 118B Jul 12 16:17 m0.c
-rw-r--r-- 1 wei staff 106B Jul 12 16:13 m1.c
wei at r [gdbtest]$ cc -g m0.c m1.c -o m
wei at r [gdbtest]$ la
total 40
drwxr-xr-x 6 wei staff 204B Jul 12 16:29 ./
drwxr-xr-x 8 wei staff 272B Jul 12 16:13 ../
-rwxr-xr-x 1 wei staff 8.8K Jul 12 16:29 m*
drwxr-xr-x 3 wei staff 102B Jul 12 16:29 m.dSYM/
-rw-r--r-- 1 wei staff 118B Jul 12 16:17 m0.c
-rw-r--r-- 1 wei staff 106B Jul 12 16:13 m1.c
wei at r [gdbtest]$
}}}
--
Ticket URL: <https://trac.macports.org/ticket/48284#comment:2>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list