NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
50.67k stars 5.78k forks source link

GDB: Add support for multi line prompts #4027

Open aldelaro5 opened 2 years ago

aldelaro5 commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I am trying to use the breakpoint commands feature of GDB to for example log some interesting stuff and resuming immediately when the breakpoint triggers but this is currently not possible to do because it requires to type multiple commands in multiple lines. Currently, if you enter commands in the interpreter, you get this: Ghidra GDB Agent: Multi-line / follow-up input is not currently supported. I just typed 'end' for you.

Describe the solution you'd like Add support for multi line prompts in the interpreter.

Describe alternatives you've considered Not really, it would be hard to implement this in the GUI without the use of the interpreter and it is a rather advanced feature. That being said, it might be possible to have some sort of checkbox to have a breakpoint log an expression. Maybe add a way to have it resume immediately? It seems p specific at this point though.

d-millar commented 2 years ago

@aldelaro5 I think we already have a ticket in for this. Unfortunately, not a trivial fix. Have you tried moving your code to a script and exec'ing the script?

aldelaro5 commented 2 years ago

@aldelaro5 I think we already have a ticket in for this. Unfortunately, not a trivial fix. Have you tried moving your code to a script and exec'ing the script?

I thought about it, but at that point, I concluded it was way simpler to just use a pure GDB connexion (because it would require me to change the file for everytime I want a different set of commands).

d-millar commented 2 years ago

Understood, and that's really a fail on our part. The MI2/pty stuff has added a layer of complexity that makes some simpler things more complicated than we would like. But, it is in the queue. Will add a vote for upping its priority.