how can I put a breakpoint on “something is printed to the terminal” in gdb?

Use a conditional breakpoint that checks the first parameter. On 64-bit x86 systems the condition would be:

(gdb) b write if 1==$rdi

On 32-bit systems, it is more complex because the parameter is on the stack, meaning that you need to cast $esp to an int * and index the fd parameter. The stack at that point has the return address, the length, buffer and finally fd.

This varies greatly between hardware platforms.

Leave a Comment

techhipbettruvabetnorabahisbahis forumueduseduedusedusedusedusedusedusedusedu