objdump

Can I combine all the sections “Objdump -S -d elf-file” generate into a re-assemble capable file?

烂漫一生 提交于 2019-12-06 10:59:35
问题 THe elf file is static linked and currently the objdump's output is something like: Disassembly of section: .init: xxxxxx Disassembly of section: .plt: xxxxxx Disassembly of section: .text: xxxxxx basically what I want to achieve is "elf-file -(disassemble by objdump)-> assemble file --(re-compile)--> same functionality " I don't need the re-compiled binary has the binary content same as the original one, only same functionality is enough. After a quick search, basically the answer is no ,

Trying to assemble the output of an disassembler (such as objdump) [duplicate]

北战南征 提交于 2019-12-06 09:23:48
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Disassembling, modifying and then reassembling a Linux executable I've been told that assembly and dissassembly are not inverses. Apparently, you can't dissassemble a program, put that output directly into an assembler, and expect it to run correctly because information is lost. My question is, why is information lost? Also, what information is lost? 回答1: One important thing that disassemblers (or their users)

Extract detailed symbol information (struct members) from elf file compiled with ARM-GCC

筅森魡賤 提交于 2019-12-06 05:54:19
问题 I’m using ARM-GCC 4.7.4 to compile Code for a Cortex-M4. For our Debug tool I need knowledge about names, types and addresses of all variables in human readable format (e.g. .txt). The map file provides most of the information, unfortunately not for structure contents like below: typedef struct { float32_t Ref; // Input: Reference Value float32_t Fdb; // Variable: Feedback Value float32_t Err; // Input: Control Error float32_t Kp; // Parameter: Gain of the Proportional Part float32_t Up; //

How to extract function prototypes from an elf file?

女生的网名这么多〃 提交于 2019-12-06 03:31:00
问题 I have not been successful in finding an answer on this question. Using GDB, I can use the command "call" to get the prototype of a function. Example: (gdb) call fn $1 = {void (int, int)} 0x8048414 <fn> So, GDB is able to figure out, only from the elf-file, that fn() returns void and takes two integers as arguments. However, I need to use some other tool to extract the function prototypes from an elf file. Preferably, I want to use objdump / readelf. Does anyone know if this is possible? If

objdump and ARM vs Thumb

三世轮回 提交于 2019-12-05 22:30:21
问题 I'm trying to disassemble an object built for ARM with gcc. Unfortunately, objdump is trying to guess whether the code is ARM and Thumb, and is getting it wrong: it thinks my code is Thumb when it's actually ARM. I see that objdump has an option to force it to interpret all instructions as Thumb ( -Mforce-thumb ), but it doesn't have one to force ARM mode! This seems like a really weird omission to me, and it's seriously hampering my ability to get work done (I'm on an embedded device and my

arm-linux-gnueabi compiler options

拥有回忆 提交于 2019-12-05 21:40:36
I am using, arm-linux-gnueabi-gcc to compile C programs for ARM processor in Linux. However, I am not sure what is the default ARM mode for which it compiles. For example, for the C code: test.c unsigned int main() { return 0x1ffff; } arm-linux-gnueabi-gcc -o test test.c now, when I look at the disassembly of main() function with objdump, I can see: arm-linux-gnueabi-objdump -d test <main>: push {r7} add r7, sp, #0 movw r3, #65535 ; 0xffff movt r3, #1 mov r0, r3 mov sp, r7 pop {r7} bx lr it appears that this is disassembly for Thumb mode of ARM (because of the push instruction). How can I

objdump with nodejs script that throws segmentation error

情到浓时终转凉″ 提交于 2019-12-05 13:38:55
I have nodejs script that throws Error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) After I included var SegfaultHandler = require('segfault-handler'); SegfaultHandler.registerHandler("crash.log"); // With no argument, SegfaultHandler will generate a generic log file name I got this stack trace: PID 2645 received SIGSEGV for address: 0x0 0 segfault-handler.node 0x00000001034ae1c8 _ZL16segfault_handleriP9__siginfoPv + 280 1 libsystem_platform.dylib 0x00007fff9364b52a _sigtramp + 26 2 ??? 0x0000000000000010 0x0 + 16 3 node 0x000000010067bbdc _ZN2v88internal23Runtime

How do I disassemble raw MIPS code?

无人久伴 提交于 2019-12-05 13:06:21
Similarly to How do I disassemble raw x86 code? , but then for the MIPS architecture: how do I disassemble raw MIPS code with objdump ? I want to check the instructions in a vmlinux image, but to do so I now have to: : > x.c mipsel-linux-gnu-gcc -c -o x.o x.c mipsel-linux-gnu-objcopy --add-section raw=vmlinux x.o mipsel-linux-gnu-objcopy --remove-section .comment x.o mipsel-linux-gnu-objdump -D x.o | less Is there an easier way to do it? I've tried the below to no avail: mipsel-linux-gnu-objdump -b elf32-tradlittlemips -mmips -Mgpr-names=O32,cp0-names=mips1,cp0-names=mips1,hwr-names=mips1,reg

Can objdump un-mangle names of C++ template functions?

点点圈 提交于 2019-12-04 23:03:48
I have a C++ object file that contains instantiations of some C++ template functions. The object file in question instantiates the same function for a few different combinations of template parameters. I'm trying to debug a problem and would like to look at the disassembly of a specific instantiation of the template function (that is, I know the template parameters for the function that I want to examine). I would typically do this using objdump to disassemble the object file, but it (at least by default) isn't able to de-mangle the C++ function names. Is there any way to do this? The object

Can I combine all the sections “Objdump -S -d elf-file” generate into a re-assemble capable file?

[亡魂溺海] 提交于 2019-12-04 15:32:33
THe elf file is static linked and currently the objdump's output is something like: Disassembly of section: .init: xxxxxx Disassembly of section: .plt: xxxxxx Disassembly of section: .text: xxxxxx basically what I want to achieve is "elf-file -(disassemble by objdump)-> assemble file --(re-compile)--> same functionality " I don't need the re-compiled binary has the binary content same as the original one, only same functionality is enough. After a quick search, basically the answer is no , and they argued that disassemble file lost some stuff like symbolic information or others, but I think by