2011-02-10 108 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位副本的原因。

相關問題