¿Cómo ver símbolos en archivos objeto?
¿ Cómo puedo ver símbolos en a .o archivo? nm no funciona para mí. Uso g++ / linux.
5 answers
En lugar de nm
, puedes usar el poderoso objdump
. Vea la página de manual para más detalles. Intenta objdump -t myfile
o objdump -T myfile
. Con la bandera -C
también puede cambiar nombres de C++, como lo hace nm
.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-10-07 11:05:25
¿Has estado usando un compilador cruzado para otra plataforma? Si es así, necesita usar el comando nm
o objdump
respectivo.
Por ejemplo, si ha utilizado XXX-YYY-gcc
para compilar el .o archivo, necesita usar XXX-YYY-nm
o XXX-YYY-objdump
para procesar los archivos.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-10-07 11:35:06
Hay un comando para echar un vistazo a qué funciones se incluyen en un archivo objeto o biblioteca o ejecutable:
nm
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-10-07 10:58:06
Simplemente ejecuta: nm you_obj_file.o | c++filt
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-30 02:20:06
Puede utilizar nm -C .o/lib/exe
, por ejemplo:
xiongyu@ubuntu:~/tmp/build$ nm -C libfile1.a
file1.cpp.o:
0000000000000000 T f()
0000000000000000 W int fun<int>(int)
Usando nm -C
será más legible , si solo usas nm
:
xiongyu@ubuntu:~/tmp/build$ nm libfile1.a
file1.cpp.o:
0000000000000000 T _Z1fv
0000000000000000 W _Z3funIiET_S0_
Como vemos no es tan legible.
A continuación se muestra lo que mi file1.cpp
como:
xiongyu@ubuntu:~/tmp/build$ vi ../file1.cpp
#include "head.h"
void f() {
int i = fun<int>(42);
}
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-29 01:59:29