In GDB, how do I execute a command automatically when program stops? (like display)

前端 未结 2 1204
余生分开走
余生分开走 2021-02-14 03:38

I want some commands to be automatically executed each time the program stops, just like what display does with x. How do I do that?

2条回答
  •  Happy的楠姐
    2021-02-14 04:12

    Here's the easy way I found out:

    define hook-stop
      ...commands to be executed when execution stops
    end
    

    Refer to this page for details: http://sourceware.org/gdb/current/onlinedocs/gdb/Hooks.html#Hooks

提交回复
热议问题