Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb disassemble by line number

Tags:

c

gdb

Say I want to disassemble lines m-n of file x, where file x is not in the current context. Is this operation possible, and if so, how? Note: I am working on x86 Linux.

like image 874
Bhubhu Hbuhdbus Avatar asked Dec 27 '22 22:12

Bhubhu Hbuhdbus


1 Answers

You can use the disassemble command with the /m key to display original C lines in front of their assembly counterparts:

disassemble /m 'my_file.c'::my_function

This does not require any preliminary steps, although it doesn't seem to accept source line ranges as you asked.

like image 104
undercat Avatar answered Jan 30 '23 23:01

undercat