Re: GDB doesn't interrupt target
Pedro Alves <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On 12/18/19 2:20 PM, Tudor Popescu wrote: > Hello, > > I am using an eclipse-based IDE and a gdb/gdbserver combination for aarch64 > targets. GDB version we use is 8.2.1 on a Linux host. > > Main problem is GDB doesn't interrupt the target when Ctrl-C is sent to > eclipse's Debugger Console. Same thing happens when using kill -2 on > pidof(gdb), or when pressing suspend button in eclipse. > > As far as I can tell, GDB 8.2.1 is launched with 2 interpreters: console > and mi2. The actual arguments are: > --interpreter mi2 -q --interpreter console -ex "new-ui mi /dev/pts/5" -ex > "set pagination off" -ex "show version" > > The old GDB 7.11.1 we used, received only "–interpreter mi2 --nx" as > arguments and everything related to target interrupt was working as > expected. > > From my investigation, the behavior described above is somehow related to > the terminal management (and also target_terminal::is_ours()). Looks like > when eclipse is involved, target_pass_ctrlc() is never called. My > understanding is that we need target_terminal::is_ours() to return false in > order to interrupt the target. But this never happens on my setup. > > What I need, is a way to interrupt the target while target is running. > Also, I would like to understand what is causing the above mentioned > behavior. I know that GDB 7.12+ introduced some changes to support a > prettier Debugger Console in eclipse and this seems to impact somehow the > interrupt functionality in my case. > > So the main question is how do I make GDB 8.2.1 behave like GDB 7.11.1 when > it comes to target interrupting (e.g. Ctrl+C)? Are there any special > arguments that need to be passed to GDB? So what _do_ you see when you "kill -2" gdb? Do you see a "Quit" being printed? I.e., the GDB console is accepting commands while the target is running? I assume Eclipse sends "set mi-async on" or "set target-async on" nowadays. The right way to interrupt the target is to send -exec-interrupt via the MI channel. Thanks, Pedro Alves