Gdb skills - part 2

Keep sharing some gdb skills, more advanced. x.gdb Writing the gdb commands inside the x.gdb file so that we don’t need to spedify the commands every time. set logging on Usually the gdb outcome would not be stored, we can use set loging on, then the output would be stored in gdb.txt, this is useful when we need to print a lot of things, we can print them all in the log, then review the output later, or we can compare log in different runs. ...

March 17, 2026 · 2 min

Gdb skills - part 1

Today I like to share some gdb skills that I’ve learned in the pass few years. Break I think the most widely use is the breakpoint. We can do break in some function (as b funcA), or break at some line (as b classA.cpp:99). Some times adding hte condition for breaking is also useful (as b funcA if cnt == 10). Also this can ne done by cond, say this breakpoint is the third, we can do cond 3 cnt ==10. ...

March 13, 2026 · 2 min