Implementing a Hook between CDT and Gdb [message #1080765] |
Tue, 06 August 2013 06:56  |
Eclipse User |
|
|
|
Hello,
I'm in a situation, where the debugee protects some of it's custom data sections against writes, dynamically. This is intentional.
The problem that arises, is that, let's say when the data section called DATA17 is currently in read-only mode and you try to change a variable from this section from the debugger, it won't work. This is also expected and normal.
What I would like to do, in the above case, if the debugger tries (because of user interaction) to set a variable (from a known section, whos characteristics are toggled dynamically during program execution), I would allow it, by temporaryly making it writable, perform the change, then set back the original characteristics.
From what I can piece together, it is necessary to change part(s) of CDT for this to work. I was thinking MISessions, where the commands are sent to GDB. Whenever a "set"/"set variable" is sent I would make the necessary adjustments on the section characteristics, then perform the set, etc.
I realize that CDT uses a different commandset to control GDB, it won't be "set variable", it will be something else.
I need somehow a piece of code that stands between CDT and GDB, so that I can dynamically influence/inject GDB commands.
Writing a wrapper for GDB is most likely even more complicated.
Is there anybody who could give a feedback, whether such a modification is plausible. Or even better if some of you know a better way then please be welcome to share.
Thanks,
feci
|
|
|
Re: Implementing a Hook between CDT and Gdb [message #1080997 is a reply to message #1080765] |
Tue, 06 August 2013 13:05   |
Eclipse User |
|
|
|
First note that MISession is part of the old GDB integration of CDT called CDI. You can use it, but it is not evolving anymore. CDT has switched to the DSF integration of GDB. It provides many features that are not available with CDI (e.g., Non-stop, Reverse, Tracepoints, and many more).
If you want to modify DSF-GDB to achieve what you want, you could override the relevant service. For example, in your case you could override the MIMemory service to perform the extra steps you need. If you need to modify all services (Memory, Expressions, Stack, etc), you can also consider overriding the ICommandControl service which actually sends the commands to GDB. That last one is more of a hack, as you would be intercepting commands, while overriding the proper service is about doing things where they belong. But in the end it is up to you.
I hope this helps.
Marc
|
|
|
|
Powered by
FUDForum. Page generated in 0.04347 seconds