nm

GDB CallStack Address virtual or physical?

。_饼干妹妹 提交于 2019-12-12 01:38:13
问题 My gdb bt callstack gives function name with function address. Then I did nm binary and generated the function name and address mapping. When I tried to match gdb address with nm output it did not match. The function address in (gdb) bt where too high (looks like physical address). gdb function address (e.g 0x00007fffe6fc150f ): #9 0x00007fffe6fc150f in read_alias_file (fname=<value optimized out>, fname_len=<value optimized out>) at localealias.c:224 #10 0x00007fffe6fc1a4e in _nl_expand

How can I get the symbol name in struct “Elf64_Rela”

為{幸葍}努か 提交于 2019-12-06 12:11:55
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/mman.h> #include <errno.h> #include <fcntl.h> #include <elf.h> Elf64_Rela *retab; Elf64_Rela *retab_end; Elf64_Ehdr *ehdr; Elf64_Shdr *shdr; char *strtab; void elf_open(char *filename) { int fd = open(filename, O_RDONLY); struct stat sbuf; fstat(fd, &sbuf); void *maddr = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); close(fd); ehdr = maddr; shdr = (Elf64_Shdr *)(maddr + ehdr->e_shoff); for (int i = 0; i < ehdr->e_shnum; i++) { if (shdr[i].sh_type =

what does the $ld$add$os10.4$ prefix mean when I use nm to look at a symbol list on a Mac?

蓝咒 提交于 2019-12-06 07:28:57
I'm having some problems with my iPhone app not linking for the iPhone Simulator. It tells me there are undefined symbols: Undefined symbols for architecture i386: ".objc_class_name_NSRunLoop", referenced from: pointer-to-literal-objc-class-name in SampleBrowser.cpp.o ".objc_class_name_NSDate", referenced from: pointer-to-literal-objc-class-name in SampleBrowser.cpp.o ".objc_class_name_NSAutoreleasePool", referenced from: pointer-to-literal-objc-class-name in SampleBrowser.cpp.o pointer-to-literal-objc-class-name in libRenderSystem_GLES2Static.a(OgreEAGL2Window.mm.o) ".objc_class_name

why /lib32/libc.so.6 has two “fopen” symbol in it?

浪子不回头ぞ 提交于 2019-12-05 13:12:58
nm -D /lib32/libc.so.6 | grep '\<fopen\>' 0005d0c0 T fopen 00109750 T fopen readelf -s /lib32/libc.so.6 | egrep '0005d0c0|00109750' 181: 0005d0c0 50 FUNC GLOBAL DEFAULT 12 fopen@@GLIBC_2.1 182: 00109750 136 FUNC GLOBAL DEFAULT 12 fopen@GLIBC_2.0 679: 0005d0c0 50 FUNC GLOBAL DEFAULT 12 _IO_fopen@@GLIBC_2.1 680: 00109750 136 FUNC GLOBAL DEFAULT 12 _IO_fopen@GLIBC_2.0 here is my question: why /lib32/libc.so.6 has two fopen symbol in it ? identical symbol in same target file should be forbidden ,right? why readelf -s dump out fopen@@GLIBC_2.1 and fopen@GLIBC_2.0 instead of fopen? Thanks gby

Determine load address and entry point of stripped Linux Kernel image

…衆ロ難τιáo~ 提交于 2019-12-05 06:35:10
问题 I have a crosscompiling toolchain for an embedded system (mipsel) on my x86 Linux. I know how to build a custom kernel (let's call the image "vmlinux") for it and how to strip that image via objcopy -S -O binary vmlinux vmlinux.bin For further processing I also need the load address and entry point of the image. Before stripping it is no problem to determine them via scripts/mksysmap or, more explicitly, via nm -n vmlinux | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > System.map Then I

What is your favorite disassembler tool in Mac OS X? [closed]

牧云@^-^@ 提交于 2019-12-04 07:23:26
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am using the otool , nm and Fraise text editor to disassemble the Mach-o binaries. My workflow at this point is pretty straightforward: 1. List the existed symbols. nm -g 2. Get the disasm code. otool -vt 3. Copy and paste this output to a text file. 4. Read and comment the codes in the text editor :) I am

Difference between nm and objdump

邮差的信 提交于 2019-12-03 06:04:44
问题 Looking at the manuals, objdump and nm have overlapping features. When would you use each one? What was the original purpose of each command? 回答1: They have no similar parameters. nm lists file symbols, while objdump can show a lot of different information about files. objdump can shows symbols too, and it is explicitly noted in the manpage that "This is similar to the information provided by the nm program, although the display format is different." 回答2: It seems like nm is posix, so

Is every undefined symbol associated with the library name it comes from?

微笑、不失礼 提交于 2019-12-02 15:40:55
问题 Let's say that libA.so depends on libB.so, libC.so, libD.so. Is there a mapping between the undefined symbols and the required library names: undefined_symbol_1 comes from libB.so undefined_symbol_2 comes from libC.so undefined_symbol_3 comes from libC.so undefined_symbol_4 comes from libC.so undefined_symbol_5 comes from libD.so or are they just kept separately: Undefined symbols: undefined_symbol_1, undefined_symbol_2, undefined_symbol_3, undefined_symbol_4, undefined_symbol_5; Required

What is your favorite disassembler tool in Mac OS X? [closed]

谁说我不能喝 提交于 2019-12-02 13:55:48
I am using the otool , nm and Fraise text editor to disassemble the Mach-o binaries. My workflow at this point is pretty straightforward: 1. List the existed symbols. nm -g 2. Get the disasm code. otool -vt 3. Copy and paste this output to a text file. 4. Read and comment the codes in the text editor :) I am looking for the tools that simplify the working with disasm code on Mac OS X . Peter Murphy You might want to try Hopper Disassemble r, osxdbg , Machoview , otx (otool GUI) and Affinic Debugger GUI . I als know of http://www.hopperapp.com/ , but never used it. (cannot be compared to Ida

How to determine inter-library dependencies?

被刻印的时光 ゝ 提交于 2019-12-01 06:10:25
My project consists of a couple of static libraries, which are linked together in a final step. Now I have the problem, that the link order of the library is important (otherwise I get an undefined symbol linker error). Sometimes I run into the problem, that I have to re-sort the linked libraries (-lcommon -lsetup -lcontrol etc). At the moment it's a stupid trial and error: re-sort, compile, check error, re-sort, compile and so on. So I wrote a small program to show me the inter-library-dependencies and generates me the order of libraries to link. It reads in the defined ('T', 'B', etc) and