1

I use gdb-mi in order to have access to gdb-many-windows functionality.

I would like to access gdb's ability to attach a list of commands to execute once a breakpoint gets hit. Documentation suggests that the gdb/mi protocol supports this via the -break-commands verb. That said, there is a cryptic suggestion of a rough edge earlier in that same documentation.

So am I just out of luck or is there some magic emacs or gud incantation that will grant me access to -break-commands functionality?

2 Answers 2

1

Given the "rough edge" I referenced in my original question I decided to investigate prompt handling in gud.el. Based on nothing more than a hunch I tried changing the two lines (~783 in function gud-gdb) from:

  (setq comint-prompt-regexp "^(.*gdb[+]?) *")
  (setq paragraph-start comint-prompt-regexp)

to

  (setq comint-prompt-regexp "^>|((.*gdb[+]?) *)")
  (setq paragraph-start "^(.*gdb[+]?) *")

This has the effect of preserving paragraph separation according to the original regex prompt pattern while allowing stripping of the single leading '>' prompt that gdb uses when collecting a commands list.

Amazingly it seems to work! Though info br shows breakpoint associated commands lists the gdb-many-windows Breakpoints window gives no indication of their existence. But that is a small nit. For now I am happy.

1

I also like to use commands attached to a breakpoint. If I enter the gdb command: comm 3, it starts collecting the commands for the breakpoint, but when I enter end it does not recognize the command list has been completed and continues to prompt for more commands. However, if I enter the full gdb command name, commands 3, then it does recognize that end command and the command attachments work.

1
  • Lovely! I wish I could upvote more than once, this has been bugging me of and on for years.
    – thoni56
    Commented Mar 29, 2020 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.