main.cpp:
Код: Выделить всё
#include "a.h"
int main(){
int x[3];
some_macro(x)
// comment
// comment
return x[2];
}
Код: Выделить всё
template
inline void some_macro_break_point()
{
}
#define some_macro(name) \
{ \
some_macro_break_point(); \
}
При достижении точки останова я делаю следующее:
Код: Выделить всё
frame = gdb.newest_frame()
frame = frame.older()
pc = frame.pc()
symtab_line = gdb.find_pc_line(pc)
print(">>>> ", symtab_line.symtab.fullname() + ":" + str(symtab_line.line), "
Подробнее здесь: [url]https://stackoverflow.com/questions/78663660/python-gdb-extension-im-trying-to-get-the-calling-line-and-file-info-for-a-mac[/url]