Files
2016-11-12 09:14:40 -05:00

27 lines
1.1 KiB
HTML

<html><head><link rel="stylesheet" href="style.css"></head><body><div class="page">
<h1>20140921 - Using GDB Without Source and With Runtime Changing of Code</h1>
<br>
Getting disassembly of code generated at runtime to verify dynamic code generation can be a slow process.
On Linux, I just use gdb.
Using gdb requires setting the breakpoint for run-time generated code
after that code is generated by the application
(if there is an easier way, I don't know it).
Here is a quick example,<br>
<br>
<tt>
Find the entry point of the ELF: readelf -a filename<br>
Look for "Entry point address:" and write down address<br>
Start gdb: gdb filename<br>
Insert breakpoint, this example using 0x2c3 as entry point: break *0x2c3<br>
Start program which will break at above entry point: run<br>
Show disassembly with raw bytes example: disassemble /r 0x2c3,0x300<br>
The "=>" shows the instruction pointer<br>
Set another breakpoint to something after run-time generated code<br>
Use the "continue" command to continue to that breakpoint<br>
Show disassembly of the run-time generated code</tt><br>
</div></body></html>