2011-02-10 107 views

回答

0

是的。至少在最新版本上,32位gdb在Solaris上很好地调试了64位二进制文​​件。

$ cat /etc/release 
         Oracle Solaris 11 Express snv_151a X86 
    Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 
          Assembled 04 November 2010 
$ file /usr/bin/gdb 
/usr/bin/gdb: ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped, no debugging information available 
$ file a 
a:    ELF 64-bit LSB executable AMD64 Version 1, dynamically linked, not stripped 
$ gdb a         
GNU gdb 6.8 
Copyright (C) 2008 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 "i386-pc-solaris2.11"... 
(gdb) b main 
Breakpoint 1 at 0x400e9c: file a.c, line 3. 
(gdb) run 
Starting program: /tmp/a 

Breakpoint 1, main() at a.c:3 
3    printf("hello world !"); 
(gdb) quit 
The program is running. Exit anyway? (y or n) y 
$ 

但是,如果你仔细看,这32 GDB的引擎盖下推出了64位GDB:

$ truss -f -t execve /usr/bin/gdb a 
1793: execve("/usr/bin/gdb", 0x0804755C, 0x08047568) argc = 2 
1793: execve("/usr/bin/amd64/gdb", 0x0804755C, 0x08047568) argc = 2 
GNU gdb 6.8 
Copyright (C) 2008 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 "i386-pc-solaris2.11"... 
(gdb) 

它做它无论调试的二进制是32位还是64位。

我仍然认为调试器与Solaris下的进程交互的方式与尺寸无关,因此从技术上讲,只有32位二进制调试器应该能够调试64位程序。

64位gdb能够调试32位和64位二进制文​​件,但32位gdb无法调试64位二进制文​​件。这就是你正在经历的。

+0

非常感谢。在我的环境中:/ usr/local/bin/gdb:ELF 32位LSB可执行文件80386版本1,动态链接,没有被剥离,我得到这个错误:附加到程序`/ ****/sd',进程5139 /proc/5139:定义的数据类型的值太大。 do_attach:无法保存跟踪的故障 – 2011-02-14 03:43:46

+0

您应该在问题中提供额外的信息,而不是评论。如果您提供了有关Solaris和gdb发行版的更多信息,就像我一样,这将有所帮助。 – jlliagre 2011-02-14 07:07:10

2

以上答案不正确。您需要一个64位调试器来调试64位进程。这正是gdb为什么在后台分配64位副本的原因。

相关问题