Author Topic: oBFusCATed - gdbmi plugin query  (Read 25318 times)

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #15 on: March 29, 2022, 04:17:11 am »
To implement the memory range code I need to take time to get more of an understanding of the exisitng code and as such I have started working on the edit breakpoints.
When I started to look at the edit breakpoint functionality I found that there is a bunch of work as the existing dialogs are missing and the existing GDBMI breakpoints are only code only.....with no support for data or function types. With these changes I would not do any testing with the existing as the main breakpoint and code have to change.

Does the existing GDB debugger support function breakpoints? I can see some support, but not enough in my 2 minute check.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #16 on: March 29, 2022, 10:05:25 am »
I have wired up missing dialogs below so they display like the existing GDB debugger, but they do nothing as there no functionality to use them yet:
  • debugger_options_dlg.xrc
  • debugger_project_options_dlg.xrc
  • edit_watches_dlg.xrc

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: oBFusCATed - gdbmi plugin query
« Reply #17 on: March 29, 2022, 11:38:23 am »
I have used data breakpoints in the past.
Never tried function break points, and i think there is no UI to add them, or am i wrong?

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #18 on: March 29, 2022, 12:11:22 pm »
That's what I seen with the code for the function breakpoints and was why I was asking as it seemed like it was partially coded and not completed in the existing GDB debugger.  It will end up being the same for the GDB/MI first version as I am porting the same code over with mods to get it working with the new way of doing things in the GDB/MI code.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #19 on: March 30, 2022, 08:22:47 am »
I know this is a loaded question (I am 99.99% sure the answer is no), but:
Is there a list of GDB features that are missing from the existing GDB debugger? This assumes right or wrong that that GDB is at least 9.1.0. The reason 9.1.0 as it was when version 3 of the GDB/MI version 3  was introduced
GDB/MI version "breaking" changes:


#   GDB     Change
1   5.1     None
2   6.0     The -environment-pwd, -environment-directory and -environment-path
                commands now returns values using the MI output syntax, rather
                than CLI output syntax.
            -var-list-children's children result field is now a list, rather
                than a tuple.
            -var-update's changelist result field is now a list, rather than
                a tuple.
3    9.1    The output of information about multi-location breakpoints has
                changed in the responses to the -break-insert and -break-info
                commands, as well as in the =breakpoint-created and
                =breakpoint-modified events. The multiple locations are now
                placed in a locations field, whose value is a list.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: oBFusCATed - gdbmi plugin query
« Reply #20 on: March 30, 2022, 11:02:27 am »
Are you talking specifically about the MI version, or our debugger plugin in general?

There are a lot missing features (in no particular order), i would like to have:
1) Checkpoints (only available on linux )
2) Display the return value of a function after "step out"
3) Skipping functions
4) record replay (only linux)
5) More (easy) integration of pretty printing

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #21 on: March 30, 2022, 11:28:38 am »
I was talking about the existing GDB debugger plugin, not the MI version.

The list is what I was after. Thanks for the list. I will add the list to the readme.md for future work so it is captured and when I have got the plugin so it has all of the existing functionality and tested I can look at them.
I also need to at some stage do a skim read of the GDB manual and have a look at what Codelite supports to see what could be added in the future, but this is weeks away.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5905
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: oBFusCATed - gdbmi plugin query
« Reply #22 on: March 30, 2022, 11:32:44 am »
Breakpoints persistence is another feature request.

If I remember correctly, we have discussed years ago, also there are a patch(unfinished) in the old patch system: Patches - Code::Blocks History
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #23 on: March 30, 2022, 01:32:46 pm »
Thanks.  I found the relevant entry and have added an entry and link in the readme.md so It does not get lost, but as it will save me time as I have to set breakpoints after each change/build/test loop I will get to this one sooner rather than latter.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #24 on: March 31, 2022, 07:50:18 am »
@ollydbg  I have got basic line breakpoints saving and loading. There was one major issue that took a while to resolve where the RegisterEventSink event cbEVT_PROJECT_OPEN did not work if you have multiple debuggers and the debugger in the project is not the GDB/MI, which it is in my case.  I changed the event to cbEVT_PROJECT_ACTIVATE and the load now works.


Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #25 on: April 02, 2022, 11:55:42 am »
I have simple line breakpoints and simple watches now being persistent. By simple I mean non edited, but I save all of the data.
I also fixed a bug that is in the existing GDB debugger where watches are not removed if you close a project. You can see this by open a simple hello world, set a breakpoint, set a watch exit the project and then open the watch window.
Is there any reason why you can add a line break point before starting the debugger, but you need to run the debugger to set a watch?

One major change I have done is to use the tinyxml2 library for the XML file saving and loading, so if you want to build it yourself you will need to build the tinyxml2 library. Attached (in the zip) is my C::B windows main project file with the tinyxml2 library.


Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: oBFusCATed - gdbmi plugin query
« Reply #26 on: April 03, 2022, 03:15:51 am »
Hmmm, I believe there's already a tinyxml lib built when you build CodeBlocks itself. It's used to read/write all the confs.
And even has a simple but usable api in configmanage.h (I seem to remember).

You could use it to save any debugger info in the extension area of the cbp file.

« Last Edit: April 03, 2022, 03:23:00 am by Pecan »

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #27 on: April 07, 2022, 12:37:48 pm »
The code that I used from @ollydbg for save/load used it's own file and the discussion way way back was that it was okay and as such I used the code and updated it to tinyxml2 as tinyxml is depreciated by the developer about 10 years ago.

I will hopefully get to a stage next week where I would like to get some other devs to help test the plugin to see if there is any missing functionality with the exception of the following as I do not expect this to be working next week and some I will leave these for another devs to do:
  • Remote debugging.
  • No function break point support.
  • No display the return value of a function after "step out".
  • Testing on Linux or MacOS,  unless you build the plugin yourself and mod the build process. I will leave this for after I complete a LLDB debugger, unless another dev does it first.
  • No checkpoints (only available on linux ).
  • No Skipping functions - see https://sourceware.org/gdb/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html.
  • No Record replay (only linux).
I need to still need complete the following before I unleash it for testing:
  • Check the persistent breakpoint and watches work for the different types and if there is anything missing fix it.
  • Expand function argument and local variables in the watch window.
  • Ability to delete a GDB data watch point (data break point in the C::B GUI)
  • Build using the SVN trunk source and modify plugin files to build. My current build project already builds a debugger_gdbmi.cbplugin and the DLL
  • Test plugin against last nightly C::B release

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: oBFusCATed - gdbmi plugin query
« Reply #28 on: April 07, 2022, 04:59:38 pm »
Saving the settings in an external file is a good idea, so they can be added to git ignore files in a multi user environment
We should probably establish an internal standard for names or save them in a .codeblocks folder in the project directory or so...

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: oBFusCATed - gdbmi plugin query
« Reply #29 on: April 08, 2022, 12:04:14 am »
I will let you run with the file directory/name changes etc as I have enough to work on and the code can be changed at any stage as it does not affect the ability to use GDB/MI for debugging.