NO

Author Topic: Listview under Debug Tabs  (Read 1078 times)

Offline John Z

  • Member
  • *
  • Posts: 790
Listview under Debug Tabs
« on: February 21, 2023, 02:09:58 PM »
It would be helpful to have an Add-in Message Macro that could set the draw style for the debug Listview pages.  Specifically it would be helpful to be able to request the draw to expand all branches, and request the draw to collapse all branches.
Currently one must click every + to expand each expandable branch or - to collapse each branch. This is useful but if one just wishes to capture the entire page to a file it is burdensome to have to click every branch before capturing...


John Z

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Listview under Debug Tabs
« Reply #1 on: March 05, 2023, 05:11:26 PM »
Capturing how? If just a screenshot, then anything not visible is not captured (unless scrolled to)?
Correct? If so, some other approach sounds like a better idea... (like "Save to file..." choice somewhere... or something...)

( In theory I guess AddIn_EnumDebugGlobals() and AddIn_EnumDebuglocals() could be used, together with some code that writes to file, but then you would have to process and format the symbol values yourself, which is probably too much work... )
/Pelle

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Listview under Debug Tabs
« Reply #2 on: March 05, 2023, 05:24:36 PM »
Great to see you back!

I already have an add-in that captures any tab into a text file, it is not a screen shot capture it actually reads the data.
 https://forum.pellesc.de/index.php?topic=10160.0
this includes the Debug tabs (expect for Memory, where I couldn't figure out the control being used)

It loads under "Files - Save Tab Data"

I've tried everything I can think of and some I never thought of to programmatically expand the collapsed listviews
and I failed every time.  So if a user wants to save the debug data from a debug listview they must first click the + to
expand each collapsed entry.  I've queried the forum too.  I can't figure out if it is actually possible without deeper
access.  I even tried sending keystrokes ;(  If collapsed it captures as collapsed, if expanded it is captures as expanded.

John Z

 

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Listview under Debug Tabs
« Reply #3 on: March 05, 2023, 09:08:42 PM »
I will think about it and get back...
/Pelle

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Listview under Debug Tabs
« Reply #4 on: March 06, 2023, 12:22:51 AM »
Thanks, no rush anyway.

I was going to post some examples but this is the first time I've run it under Pelles version 11 and seems I've
got an issue to resolve.  Getting "Bad Index" on the Debug tabs so I'll need to fix that anyway, still working
on the other tabs.

When I've got it working again for the the Debug tabs I'll post examples.  No sense in thinking about it until I fix
whatever has gone awry.   

John Z

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Listview under Debug Tabs
« Reply #5 on: March 06, 2023, 12:54:15 PM »
Fixed!  Seems I just needed to recompile the dll.  I added a few outputs messages anyway. I also
updated the Add-in post with the new project zip.

As promised here are some sample outputs.   
unexpanded shows capture of listview in original state
Few_expanded shows capture of listview with a few items manually expanded using the +

Third file is just another debug tab to show I capture as text whatever is there ....

To me it seemed very helpful to be able to capture the debug output(s) of interest as text so that after
a program change the debug data could be compared to the prior debug data to observe changes. 

Maybe this is not true for others....anyway it was an interesting project too.

John Z

An improvement would be to obtain the tab Name for the output filename  :)
Updated 03/12/2023 removed attachments to save space
« Last Edit: March 12, 2023, 08:22:25 PM by John Z »

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Listview under Debug Tabs
« Reply #6 on: March 12, 2023, 04:43:54 PM »
I have looked at this now...

Exactly what kind of controls are used by the IDE is really an implementation detail. The debugger symbols are displayed in ListView controls today, but perhaps not tomorrow. The memory dump window is not a standard control at all, and so on.

The proper way is to use the debugger part of the add-in API. Today there are AddIn_EnumDebugGlobals() and AddIn_EnumDebugLocals() for enumerating all global and local symbols. They are pretty low level. What I will do is to add new AddIn_EnumDebugGlobalsText() and AddIn_EnumDebugLocalsText() that will enumerate global and local symbols at a higher level: the callback function will receive a text representation of the symbol Name, Value, Type (plus Address and nesting level) exactly like how the symbols are displayed on the debugger tabs.

Memory dumps can already be handled through AddIn_ReadDebugMemory(), but I will enhance the existing dbginfo.c add-in sample to demonstrate how.


/Pelle

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Listview under Debug Tabs
« Reply #7 on: March 12, 2023, 05:01:36 PM »
Thanks for looking at this.  I hope I've not overstepped my bounds....

My only goal was to be able to provide an easy method to save the tab data generated by the existing Debug
procedures and other tabs below the main window.  I did not intend to change any debugging procedures.

I achieved my goal (except for the Memory tab) but was thinking of an improvement.  It is not necessary and
please don't add or change anything because of this (perhaps) misguided request.

I will look at the Addins you mention and study the Addin_ReadDebugMemory to learn more about it.

I appreciate your time looking into this, my apologies for the non-standard way I used, which I thought was better
than re-inventing the outputs.


John Z

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Listview under Debug Tabs
« Reply #8 on: March 12, 2023, 06:33:27 PM »
No problem - just trying to save you the trouble of looking for stuff that isn't easily available (like data from the memory dump window).

Using the debugger add-in API will give you all the available data, at the expense of having to format it yourself. This is extra work, but it also means that you can format it any way you like (and write it to a file, send it in an email to Bill Gates... ;) whatever...)

I always try to look at things in a broader perspective, so I think the new AddIn_EnumDebugGlobalsText() and AddIn_EnumDebugLocalsText() could be useful not only to you but (a few) other people as well (it's a reasonable enhancement) ...
/Pelle