gdb查找行号的内存地址

假设我已经将gdb附加到一个进程,并且在其内存布局中有一个文件和行号,我想要的内存地址。 如何获得文件x中第n行的内存地址? 这是在Linux x86上。

(gdb) info line test.c:56 Line 56 of "test.c" starts at address 0x4005ae <main+37> and ends at 0x4005ba <main+49>. 

另外在python中,你可以使用Symbol-Tables-In-Python中的'last'属性,目前需要cvs的gdb的最新版本,但我想在7.5

 (gdb) py x = gdb.find_pc_line(gdb.decode_line("test.c:56")[1][0].pc); gdb.execute("p/x " + str(x.pc)); gdb.execute("p/x " + str(x.last)) $15 = 0x4005ae $16 = 0x4005b9