Pelles C forum

Pelles C => Add-ins => Topic started by: John Z on July 07, 2021, 04:31:58 PM

Title: Capture Tab data
Post by: John Z on July 07, 2021, 04:31:58 PM
Canceled-

Here is a new add-in.  Hopefully a useful one.
The purpose is to be able to easily and quickly save the data from a selected IDE TAB such as 'Project', 'Find in files', 'Output', or 'Debug' in a text file under the current project directory. Text filename will always be output_yyyymmdd_hhmmss. 

Example: output_20210707_085753.txt
 
How to use:
Load and activate the Capture.dll utility

SHA256: FE1137C6A9E995AAB1D486194029E91BC0C4A055BA5E313DDBD78692AD0CAB03
SHA256: B9EAB5D5F77F69CFD40AE90FCB3ECDF3C525FABC9C612898C4325C0B60A27848
SHA256: D9D43BE786AE65A8B38A5169E2A74438A684E62D4AD487BDE5A1051236502A3F


Generate output from any tab mentioned above, or any tab under a Debug run (except the 'Memory' map).

To save the tab data:
CLICK once anywhere in the projects tab window that is to be saved
then invoke the add-in; click File, Save Tab data - that's it

The file will be in the project directory.

John Z

Completion message is provided in the 'output' window.

Updated 7/12/2021 version 1.2.0 (works with listviews also)
Updated 03/06/2023 version 1.2.1 (compiled under Pelles v11)
Updated 03/09/2023 version 1.2.2 (improved output directory detection)
Updated 03/12/2023 removed
Title: Re: Capture Tab data
Post by: Grincheux on July 07, 2021, 06:06:34 PM
I have downloaded it and using it immediately because a bug that I can catch. I will use the addin for the "Debug Tab". Tha ;D nk You John.
Title: Re: Capture Tab data
Post by: Grincheux on July 07, 2021, 06:40:25 PM
Debug is not accessible, when debugging the Source menu does not exit. You have to put the add-in in the "Project" menu.
Title: Re: Capture Tab data
Post by: John Z on July 07, 2021, 09:44:07 PM
Thanks, I didn’t have anything that output to the debug tab.

After thinking a bit I decided it belongs on the FILE Menu.

New version is available on the initial post above.
 
Appreciate your help!

John Z

Updated 7/8/2021
Title: Re: Capture Tab data
Post by: John Z on July 08, 2021, 10:42:22 AM
Updated initial post with revised dll.

John z
Title: Re: Capture Tab data
Post by: Grincheux on July 08, 2021, 01:07:12 PM
For me it is much easy. I test and give you my answer. Thank You JohnZ
Title: Re: Capture Tab data
Post by: Grincheux on July 08, 2021, 01:11:07 PM
Fine!


Code: [Select]
Building Display.res.
Building Display.exe.
POLINK: warning: Realigned section '.idata$5' in object 'SQLite3.lib(sqlite3.dll)' (from 4 to 8 byte(s)).
POLINK: warning: Realigned section '.idata$4' in object 'SQLite3.lib(sqlite3.dll)' (from 4 to 8 byte(s)).
POLINK: warning: Realigned section '.idata$2' in object 'libgfl.lib(libgfl340.dll)' (from 4 to 1 byte(s)).
POLINK: warning: Realigned section '.idata$2' in object 'libgfle.lib(libgfle340.dll)' (from 4 to 1 byte(s)).
Writing debug information
POLINK: warning: Unrecognized version (589844) of debug symbols in object 'libgfl.lib(libgfl340.dll)'; ignored.
POLINK: warning: Unrecognized version (589844) of debug symbols in object 'libgfl.lib(libgfl340.dll)'; ignored.
POLINK: warning: Unrecognized version (589845) of debug symbols in object 'libgfle.lib(libgfle340.dll)'; ignored.
POLINK: warning: Unrecognized version (589845) of debug symbols in object 'libgfle.lib(libgfle340.dll)'; ignored.
Compacting debug information
Done.



Title: Re: Capture Tab data
Post by: Grincheux on July 08, 2021, 01:14:36 PM
Does not work with debug tabs.
Sorry!
Title: Re: Capture Tab data
Post by: John Z on July 08, 2021, 01:26:39 PM
I see what you are showing - but what you are showing is not the Debug Tab I'm referring to.  See attached.

I'll need to set up something to debug to see if something can be done.  I've never actually used the debug feature to solve anything ….

The most I've gotten into the Debug Tab is the word "Done" and the add-in saved it to a file …  :) so I'll look more at actual debugging.

John Z
removed attachment to free space
Title: Re: Capture Tab data
Post by: TimoVJL on July 08, 2021, 02:11:16 PM
I'll look more at actual debugging.

John Z
not for assembler code, but for symbols.
Add-Ins for debugger (https://forum.pellesc.de/index.php?topic=7367.msg27982#msg27982)
Title: Re: Capture Tab data
Post by: John Z on July 08, 2021, 02:11:55 PM
So what you are looking for is a way to save the tabular data under the tabs generated when actually running the Debugger.  I understand.  Capture.dll is not capable of that, it will need a different approach.  Since it is tabular data CSV should be usable. I think something can be worked out for some of those tab Tables except for the Memory one.  Might be fairly difficult though, I also see some entries are using a treeview too. I'm not sure how to handle that right now.


John Z
removed attachment to free upload space.
Title: Re: Capture Tab data
Post by: John Z on July 08, 2021, 02:14:21 PM
not for assembler code, but for symbols.
Add-Ins for debugger (https://forum.pellesc.de/index.php?topic=7367.msg27982#msg27982)

 :) :) :)
Title: Re: Capture Tab data
Post by: TimoVJL on July 08, 2021, 02:24:07 PM
As those tabs are Listview, here is an old ListViewUtils code.
Title: Re: Capture Tab data
Post by: John Z on July 08, 2021, 03:54:10 PM
As those tabs are Listview, here is an old ListViewUtils code.

Thanks Timo, I downloaded and will look at it.
In my vcardz_i utility on SourceForge I used a multicolumn listview too, and wrote code to export the table to CSV as well as ODF spreadsheet.  HOWEVER that listview did not contain trees  :( so it is simpler I'm sure.

Thanks,
John Z
Title: Re: Capture Tab data
Post by: John Z on July 09, 2021, 03:38:48 PM
Does not work with debug tabs.
Sorry!

Sir Grincheux, Since you are the current 'customer' for this  :) which column separator is preferred TAB or COMMA ?  In a plain text editor/viewer the columns are not always going to align because the data stored in the columns are variable lengths (see attached).  So I'm guessing the output text file will be best opened in something like Excel or LibreOffice Calc. 

I could scan each column for the longest datum and adjust others but I'm not sure that is worth the resources. I'll think about it though.

John Z
removed attachment to free upload space
Title: Re: Capture Tab data
Post by: John Z on July 09, 2021, 05:13:01 PM
Well you snooze you lose  :) :) :)

No - just decide I'll pad it out and use a tab too.

Here is an example output from debug of Display.prj
I'll post a new dll for testing after a bit of clean-up.

John Z

Timo - I did use the base code from procedure CopyList2File, although modified to meet my needs.  I will mention you as the original author.   Thank you for the assist!!

removed attachment to free upload space
Title: Re: Capture Tab data
Post by: Grincheux on July 09, 2021, 05:16:18 PM
You can use tab '\t' or ';' or '|' it is not a problem. They are classic separators for CSV files too.
For me the most important tabs when debugging are "Memory", "Registers", "GLOBAL" and "LOCAL"
If you need to use a dialogbox to select the tab we want, it is not a problem because when debugging me have time.
If this solutions is easy for you do not hesitate.
A problem I have found is with the dialog box that say to click on a tab. When I click on the tab the dialog box disappear and if the sound is off that is a problem. Your dialog box always [size=78%]must be VISIBLE and at the FOREGROUND.[/size]

If you had nothing to do for the week end, I have found some work... ;D ;D
Title: Re: Capture Tab data
Post by: Grincheux on July 09, 2021, 05:19:10 PM
Quote
Well you snooze you lose
I dont understand, even using Google Translate.

Your capture is perfect for the result.
That's the kind of result that is exepcted.

GOOD WORK
Title: Re: Capture Tab data
Post by: Grincheux on July 09, 2021, 05:46:53 PM
Quote
which column separator is preferred TAB or COMMA ?


Don't use COMMA
Title: Re: Capture Tab data
Post by: John Z on July 09, 2021, 05:48:19 PM
 :) First things first

"If you snooze you lose."  Loose translation of idiom - if you are sleeping (or busy with something else), events still happen, but you have no input to them,  or if not responding fast enough then decisions made before you have chance to make input. Si vous dormez, vous perdez.

No plan to use a dialog box you just click within the Tab window you want to save, then use File - Save Tab data.



John Z

OK - no comma addition.
Title: Re: Capture Tab data
Post by: John Z on July 09, 2021, 06:09:22 PM
For me the most important tabs when debugging are "Memory", "Registers", "GLOBAL" and "LOCAL"

The only tab it won't support in the next test release is "Memory"  This is a custom class "PC_Memory" and I'm not sure how or if even possible to access yet.


John Z
Title: Re: Capture Tab data
Post by: Grincheux on July 09, 2021, 06:11:15 PM
Rather than text you could build a bmp file it is easier for you. That's right for all tabs.
Title: Re: Capture Tab data
Post by: John Z on July 12, 2021, 05:08:26 PM
Capture.dll

Purpose: Save text from the selected IDE tab 'Project', 'Find in files', 'Output',
 or 'Debug' in a text file under the current project directory. Text filename
 will always be output_yyyymmdd_hhmmss.  Example: output_20210707_085753.txt
 
How to use:
Load and activate the Capture.dll utility
SHA256: FE1137C6A9E995AAB1D486194029E91BC0C4A055BA5E313DDBD78692AD0CAB03

Generate output from any tab mentioned above.

to save the tab data
CLICK once in the tab window to save
then click File, Save Tab data - that's it

The file will be in the project directory.

Note: Sadly after much work listview groups are still not automatically expanded.  To get the list group data in the output file they must be expanded manually before clicking 'Save Tab data'.  Maybe someone  else can get that but I found commctrl.h seems incomplete for listview capabilities e.g. no ListView_GetGroupInfo and others.  In addition on my system, or my lack of knowledge, I could only get _WIN32_WINNT items <  0x501 so higher version items weren't available. For example none of these became available
Code: [Select]
#if (_WIN32_WINNT >= 0x501)
    int iGroupId;
    UINT cColumns;
    PUINT puColumns;
#endif /* _WIN32_WINNT >= 0x501 */
#if (_WIN32_WINNT >= 0x0600)
    int *piColFmt;
    int iGroup;
#endif /* _WIN32_WINNT >= 0x0600 */
-------------- 
   
It does work as a useful add-in for saving tab data, but could be better. 
I've included the project source code too.

John Z

Update - removed old sources new one attached around here https://forum.pellesc.de/index.php?topic=10160.15#lastPost
 update to work under Pelles V11, needed recompile.
Title: Re: Capture Tab data
Post by: Grincheux on July 13, 2021, 07:43:41 PM
Quote
Name     Value                               Comments                                                                                 
RAX      00007FF6758DE98C                                                                                                             
RBX      0000000000000001                                                                                                             
RCX      E586ACAEA40F0000                                                                                                             
RDX      0000000080006010                                                                                                             
RSP      000000E91DB6EB00                                                                                                             
RBP      0000000000000000                                                                                                             
RSI      0000000000000000                                                                                                             
RDI      0000000080006010                                                                                                             
R8       000000E91DB6F0A8                                                                                                             
R9       000000E91DB6EB20                                                                                                             
R10      0000000000000000                                                                                                             
R11      0000000000000000                                                                                                             
R12      0000000000000000                                                                                                             
R13      0000000000000111                                                                                                             
R14      0000000000000000                                                                                                             
R15      0000000000000000                                                                                                             
RIP      00007FF6758C23F7                                                                                                             
EFLAGS   00010300                            CF=0, PF=0, AF=0, ZF=0, SF=0, OF=0, DF=0, IF=1                                           
XMM0     0000000000000000:0000000000000000                                                                                            
XMM1     0000000000000000:0000000000000000                                                                                            
XMM2     0000000000000000:0000000000000000                                                                                            
XMM3     0000000000000000:0000000000000000                                                                                            
XMM4     0000000000000000:0000000000000000                                                                                            
XMM5     0000000000000000:0000000000000000                                                                                            
XMM6     0000000000000000:0000000000000000                                                                                            
XMM7     0000000000000000:0000000000000000                                                                                            
XMM8     0000000000000000:0000000000000000                                                                                            
XMM9     0000000000000000:0000000000000000                                                                                            
XMM10    0000000000000000:0000000000000000                                                                                            
XMM11    0000000000000000:0000000000000000                                                                                            
XMM12    0000000000000000:0000000000000000                                                                                            
XMM13    0000000000000000:0000000000000000                                                                                            
XMM14    0000000000000000:0000000000000000                                                                                            
XMM15    0000000000000000:0000000000000000                                                                                            
MXCSR    00001F80                            IE=0, DE=0, ZE=0, OE=0, UE=0, PE=0, IM=1, DM=1, ZM=1, OM=1, UM=1, PM=1, RC=0, DAZ=0, FTZ=0


GOOD ok for me


Title: Re: Capture Tab data
Post by: John Z on July 14, 2021, 01:05:55 PM
 :) Turned out fairly useful.  Eventually I'll be able to expand those groups.  For now it may even be better to NOT auto-expand.  Looking at Debug of your Display.prj there are 155 groups under one of the debug tabs! 


John

P.S.
Artificial constraints are 20 columns of data, each data field < 260 characters. 

Title: Re: Capture Tab data
Post by: John Z on July 17, 2022, 01:15:56 PM
A while back I wrote this Add-In to capture and save the debugger tabs data and put them into text files.
It works just as well on the normal IDE tabs as well but they also already have 'Select All'.
To me this is very useful to track change from code changes from debug session to debug session.

It works for every Debugger Tab except for the Memory.  However I have been struggling
unsuccessfully to improve the output from the Grouped listview tabs, for example 'Globals'.

As is the Add-In works well to capture and save the Grouped ListView tab(s) in whatever state
is being displayed.  So if Groups are un-expanded that is how the save output appears
and if the user expands the group(s) the saved output then shows the expanded data.
Examples attached.

I would like to be able to Expand all Groups programmatically. Everything I've tried has
failed to change the Group display, except I can hide it or show it :( not too useful in this case.
I've scoured the WEB and MS sites and tried unsuccessfully everything I could find or think of.
Even tried sending keystrokes :).  So I'm doing it wrong, or it just can't be done in this
situation.  Maybe it is 'Owner Draw' and it can't be done, I don't know. 

Has anyone tried something similar?  Recognize that all I have access to is the Listview Handle.

John Z

Had examples attached but get some sort of upload folder full error.
Title: Re: Capture Tab data
Post by: MrBcx on July 17, 2022, 07:36:00 PM

Had examples attached but get some sort of upload folder full error.

John .. You might want to send Christian a private msg.

 
Title: Re: Capture Tab data
Post by: John Z on August 14, 2022, 05:17:04 PM
So here is my road block.  My Capture add-in lets you save the data from any tab below the IDE edit window, first image, into a text file. Just click in a tab then select menu File - Save Tab Data.  It works for every tab except the 'Memory' display.
BUT -
When the tab is using Grouped Listview the saved text file is the same, so if the listview is grouped the output it grouped, if the list view has been expanded then the saved text file is expanded.  My thought is it would be nice and perhaps more informative to programmatically expand the grouped listview before saving it, second image.  I have not been able to do it :(

Has anyone tried this as an add-in?

John Z
Title: Re: Capture Tab data
Post by: John Z on March 06, 2023, 12:35:27 PM
Version updated to version 1.2.1 for Pelles C version 11

Just needed re-compile, but added some processing information to the output tab too.

John Z

Update attachment on 3/09/2023 to version 1.2.2 (directory determination improvement)
Update 03/12+2023 removed
Title: Re: Capture Tab data
Post by: TimoVJL on March 07, 2023, 08:55:43 AM
Too often "Access denied" for opening file.
Perhaps better to find project path for file.
Title: Re: Capture Tab data
Post by: John Z on March 07, 2023, 11:03:02 AM
Thanks Timo, very interesting - I've never seen that error ( don't we all say that  :) )
but really I have not. 

Currently it defaults output to the actual project directory of the source code being run under Debug,
by using docinfo.szFilename.   I thought this would always be writable since the project .exe usually
ends up there.  But perhaps a system .h file is the current doc tab then I think it would fail ( ah ha!)
this would make it fail then as the 'current' doc is in a un-writable directory.  Hadn't thought of that before!!

I'll see if there is another method to get the project directory. Perhaps GetModuleFileName....or some other api.
OR
I could obtain the users TEMP dir and output there?

Thanks very much for the help!

John Z

Update: OK I think int AddIn_GetProjectTarget(HWND hwnd, WCHAR *pch, int cchMax); 
can be used easily to get the 'true' project directory....no matter which source code or .h tab is currently selected.
A much better choice because it will always be where the program .exe will be created.

Update#2:  Here is the new dll version 1.2.2 using AddIn_GetProjectTarget  for the path.  if OK I'll post source zip. This should fix the access issue no matter which document tab is active.... I tested with windows.h selected - worked.  Also writes output filename to the output tab.
  SHA256: D9D43BE786AE65A8B38A5169E2A74438A684E62D4AD487BDE5A1051236502A3F

Updated#3 03/09/2023 with current 1.2.2 dll and readme.txt and also added full project zip for version 1.2.2
Updated 03/12/2023 removed as inappropriate for long term solution
Title: Re: Capture Tab data
Post by: TimoVJL on March 07, 2023, 04:07:40 PM
Thanks John !
now it works and i can test it.
Title: Re: Capture Tab data
Post by: John Z on March 09, 2023, 02:57:13 PM
Good to hear!

 :)  Posted full Pelles Project ZIP above.

John Z