Debugging a program that uses SIGINT with gdb

前端 未结 3 1733
挽巷
挽巷 2021-02-07 09:41

I frequently work with PostgreSQL for debugging, and it uses SIGINT internally for some of its inter-backend signalling.

As a result when running certain ba

3条回答
  •  情深已故
    2021-02-07 10:21

    This part of gdb is a bit tricky, both due to its history and also due to the various modes of operation it supports.

    One might think that running gdb in a separate terminal and only using attach would help it do the right thing, but I don't think it is that easy.

    One way forward might be to only use async execution when debugging, and then use a command to interrupt the inferior. Something like:

    (gdb) attach 5555
    ... attaches
    (gdb) continue &
    ... lots of stuff happens
    (gdb) interrupt -a
    

    Depending on your version of gdb you might need to set target-async for this to work.

提交回复
热议问题