FB debugger : 3.02 32/64 BIT WDS/LNX..... (2023/07/05)

User projects written in or related to FreeBASIC.
Post Reply
SARG
Posts: 1821
Joined: May 27, 2005 7:15
Location: FRANCE

FB debugger : 3.02 32/64 BIT WDS/LNX..... (2023/07/05)

Post by SARG »

Feel free to send me (debug AT aliceadsl DOT fr) bugs, remarks and especially suggestions, improvements


Version 3.02 2023/07/05

Only version for 32/64bit Windows https://users.freebasic-portal.de/sarg/fbdebug_WDS.zip

2 fixed bugs :
- issue with procedures added by compiler (constructor, etc) only in 32bit version
- issue if there is only one line of code. Who needs to debug a such program ;-)



3.01 (2023/06/19)

https://users.freebasic-portal.de/sarg/fbdebug_WDS.zip ONLY WINDOWS

- define by percentage width of left/right windows in settings
- fixed bug, when restarting immediatly debuggee no data for main procedure was displayed....
- multi threaded applications handled (mainly on Windows) but not perfectly. New info in status bar about number of thereads (running/stopped/blocked/inactive)

To build fbdebugger (surely incomplete so report any problem) :
- put with fbdebugger_new.bas ( source code https://github.com/SARG-FB/fbdebugger-New )
* dbg_xxxx.bas/.bi (9 files)
* fbdebugger_new.rc (Windows)
* fbdebugger.ico (windows)
* buttons folder
* scintilla.bi
* scilexer.bi

* window9.bi ( Window9 library by VANYA https://sourceforge.net/projects/guiwindow9/files/ )
* libwindow9.a
* libz.a

- Windows : fbc -s gui fbdebugger_new.bas fbdebuger_new.rc

- Linux : fbc -s gui fbdebugger_new.bas

for execution scintilla library (libscintilla .dll or .so 32/64Bit) is necessary can be found with executables : https://users.freebasic-portal.de/sarg/ ... DS_LNX.zip


3.00 (2022/09/26)
Windows and Linux / 32bit and 64bit and many changes....
Look at the help file (pdf).
Don't forget : the exes must be compiled with option gas or gas64.

https://users.freebasic-portal.de/sarg/ ... DS_LNX.zip

2.98.1 (2021/01/30)
Added
- a new button on main window to toogle update on / update off for proc/var tab and dump memory when executing step by step.
The purpose is to avoid a long update when there are a lot of variables/fields (thanks Xusinboy)
However when a new proc is started an update is done but the variables are labelled "Not filled".
And if it's OFF setting ON triggers an update.

Changed
- Up to 20 Shw/exp windows (previously 10) so you can see more variables when update is off.
- The shw/exp windows are closed when the procedure owner of the variables is closed, except for statics.
- Now when a dynamic array is redimmed a related shw/exp can be updated (using the button 'Update'.) A message box is displayed for warning
(full update or only indexes), address is changed, min/max indexes are updated and the current index is set in the new range.(old request by David Y.)
Not done if the array is a field in a structure, in this case close and redo shw/exp.
- Explicit messages when some internal limits (unfortunately not all) are reached forcing an exit of fbdebugger.

https://users.freebasic-portal.de/sarg/ ... r298_1.zip

2.98 (2021/01/25)
Added
- Using gas64 allows a debugging similar than with gas32, better than with gcc.
- In fbc 1.08 there is a new field in array descriptor structure --> 2 versions of fbdebugger.
Only one source code taking in account the different cases (32-64bit / 1.07-1.08) when compiling fbdebugger.

Changed
- show/expand window improved for browsing arrays.
- tutorial option removed (discontinued feature).

Fixed
- bug when an array contains structures that fields are also structures.

https://users.freebasic-portal.de/sarg/ ... ger298.zip

Version 2.96 (2020/02/17)
changed
- No more blinking windows when loading debugging data at start of debuggee
Data from objdump is retrieved using internal functions no pipe/line input to allow the parameter CREATE_NO_WINDOW for createprocess.

http://users.freebasic-portal.de/sarg/FBdebugger296.zip


Version 2.95 (2020/02/05)

Not a lot of changes :
- To avoid the issue faced by Wally, hardly understandable, a control has been added displaying a message when 64bit version of Fbdebugger is used to debug 32bit exes and vice versa.

- The new datatype 'va_list' taken in account.

http://users.freebasic-portal.de/sarg/FBdebugger295.zip

Version 2.93 (2018/09/05)

fixed
- debugging under 64bit not working (reported by jmg)
- some minors bugs

added
- procedures named {Modlevel}, created when using modules, are ignored if empty (less than 7 bytes)
- variables named lt_xxx are ignored

changed
- each line is directly associated with its source file instead of by its procedure (for lines inside include files but outside procedures...).

http://users.freebasic-portal.de/sarg/FBdebugger293.zip


Version 2.92 (2018/06/06)

fixed
- sometimes bad window size on start

added
- longint and ulongint also usable for break on var
- a message box when a break on var is met to better visibility and allowing to keep or remove it.
- hovering on a variable (proc/var tab) few seconds automatically opens a shwexp window (by default off, changeable in settings)

changed
- text in the break on var box to avoid confusion
- default test for break on var is now equal (previously not equal)
- left marging for source code is now 10 pixels
- when the mouse goes back to the source code panel the focus is set on this window.

http://users.freebasic-portal.de/sarg/fbdebugger292.zip


Version 2.91 (2016/08/20)

fixed
- proc overloaded --> crash fbdebugger
- fixed bad behaviour on proc_end
- step out not possible if procs are executed before main (constructor for shared)
- "exit for" not at the right place in test rtfrun when an exception arises
- erasing of updown variable for multiple index windows
- flagtrace for line not working (since using unicode)


added
- break on var also displayed in the menu
- allowing multiple index selects for showing different arrays (or the same one with different indexes)
- autoupdate in 'index select'
- autoupdate checkbox in index windows (default = no update)
- check added to avoid issue when saved window coordinates are wrong (thanks to St_W)
- tracking array, usefull to easily follow the values of an array with the help of variables used in loops (request by sancho2)
- workaround when the end of data debugging (stabs) seems wrong (report by luis Babboni)

changed
- removed test {MODLEVEL} to see code outside procs in libs / inconvenient all these procs are visible now
- in case of iterators (for loops) with datatype declaration and same name only one is kept as they all have the same adress, to avoid multiple unuseful lines in proc/var tree (only GAS version)

http://users.freebasic-portal.de/sarg/fbdebugger291.zip


Version 2.90 (2015/10/03)

Fbdebugger is now Win64 compliant, only one source code. And Boolean the new standard type is handled.

For Win64 the objdump.exe tool is absolutly necessary in the fbdebugger's folder.
I provide them (32/64) in the zip file but you can also grab them from the net
e.g tdm-gcc.tdragon.net/download and select binutils

To compile just add '-g'

======== DEBUG WARNINGS =================
- The array defined (A to B) are internally changed by the compiler to zero based arrays eg 4 TO 7 becomes 0 TO 3.
In case of shared fixed-lenght there is no information in debugging data for retrieving the initial definition. So problems should happen.

- Lines from include files and not in a proc are not correctly associated with their file : they are tagged with the main file.
- Due to the way naked procs are defined they are not included in data debugging
=========================================

fixed
- impossible to kill current debuggee when launching a new one or restarting the current (just a stupid test...)
- warning on null in some sendmessage API, value changed by zero
- bug found by sancho2 : dyn array field in an udt used as byref param was uncorrectly handled
- bug found by sancho2 : bad return handle when double returns (in case of recursivity) without possibility to restore the breakcpu before execution
- wrong size of data in index selection in case of pointer variable
- some bugs with gcc version
- restart was not possible (only gcc)
- when a proc hasnt param/loc var the display for the next defined one is erroneus
- compil info in unicode (reported by solbianca)
- fastrun working in 64bit (stack size issue)

added
- improved show char at position
- extended to wstring
- select first/last char
- move forward/backward 40 chars
- unicode support (there might be still some issues)
- 64bit version (one source code)
- string '64bit' or '32bit' displayed in the window title
- all registers are logged (show_context function)
- boolean handling
- message if objdump is not found (64bit only)
- position/size main window saved and restored when launching fbdebugger (requested by solbianca)
- in About option to launch explorer with the dedicated page on the freebasics forum
- new asm option : show values of processor registers 32/64bit
- new type of breakpoint using a counter decremented each time the line is executed and stopping when only zero is reached eg if counter=10 brkp the 11th execution. Initial value saved for reseting or between session
- a new option in proc/var tree for searching any text in the tree warning : the search is sensitive


changed
- display of values for 2 dims or more arrays. if more than 2 dims only the 2 most right are shown (see select index)
- possibility of moving by row, column, page, block and of changing size of column
- select indexes by clicking on any cell
- exepath added if a short filename is used as param in command line to avoid error case gcc (eg fbdebugger mypgm.exe --> c:\freebasic_code\mypgm.exe)
- console window resized and aligned on left
- new icon, button for forcing the next executed line
- only an array of ubytes could be exchanged with zstring (previously only byte)
- in settings, time for autostepping is set to min (50) or to max (10000) values if out of bounds
- an entire proc is now dissassembled, before last intructions were missing
- increasing width of global window (900) to display correctly memory dump of bytes

http://users.freebasic-portal.de/sarg/f ... 202.90.zip



Version 2.81 (2015/05/03)

Requests,bugs found or remarks by St_w, AGS And Marpon

Changed
- userfriendly display when an exception arises and especially for access violation (displaying all exceptions in same way)
- monospaced font used for dump memory. Size of window should be resized for byte and UByte (St_w)
- to change the value of any cell in dump memory : left click on it
- more explicit error message when trying to display single or double in hex format
- all Sub and Function are private for a smaller exe (marpon)
- simplification when calling objdump (marpon)

Fixed
- improved demangling to display correctly complete names when using namespaces and letter 'K' is handled
- overflow in shortcut table (AGS)
- searched variable in source code window not found if namespaced (AGS)

Added
- to show return value of a proc : use show/exp directly on the proc name (proc/var tab) (St_w)
- to copy variable value in clipboard (all or only one with its childs) : select the new option, copy to clipboard, in contextual menu (St_w)
- to show the dump of deferenced data : select new option, pointed data dump, in contextual menu (St_w)
- to copy dump into clipboard : shift+left click on one cell / on header for whole page / address area or ascii area for one line or multilines (St_w)
the dialog box to valid selection is automatically opened if currently closed
- to change the beginning address of dump : ctrl + left click on one cell (data or address area), datatype must be integer/uinteger
- to use the value in a cell as a pointer or directly as beginning of udt data in shw/exp : alt+left click on a cell then select no pointer or pointer and the datatype. The dialog box to valid selection is automatically opened if currently closed.
- display of the character at a given position in a (z)String with possibility to move forward and backward (proc/var tab)


http://users.freebasic-portal.de/sarg/f ... _05_03.zip



Version 2.80 (2014/09/21)

Changed
- when exiting, display message about notes only if necessary.
- Every exception handled as access violation (display of line, etc)
- stabs size up to 50000 bytes.

Fixed
- issue when only one line code was executed
- weird bug if a loaded dll was an exe (found when using open pipe under W7)
- names of compiler and editor searched now with case insensitive (be_design)

Added
- table to display elements of arrays (see select index option), moving by line/page and select an index by clicking on
- dynamic arrays handled when using -gcc
- dynamic arrays in UDT
- elapsed time is displayed in status area when using run or fast run
- (AS)"," (CS)"," (CD)" displayed according the used debugging data : S=stabs or D=dwarf
- message if it's not possible to modify registry (JIT debugger, see tools)
- parameters debuggee are now saved
- automatic constructor/destructor added by the compiler are only visible in the procs tab.

http://users.freebasic-portal.de/sarg/f ... _09_21.zip


Version 2.71 (2013/10/27)

Fixed
- Partial wrong display when dissassembling a proc
- Global variables become unaccessible at the end of the first executed proc if it is not the main one, eg constructor for global vars. (ChesterDennis)

http://users.freebasic-portal.de/sarg/f ... _10_27.zip


Version 2.70 (2013/09/29)

Added
- "(A)"=gas Or "(C)"=gcc is added near every file name to indicate the compilation option
- proc backtracking to follow in both direction the proc calls. Closed if running, added in proc/var tab and thread tab (dinosaur)
- proc call chaining to follow in one page the call chain (procs/vars and thread tab) (St_W)
Click on a line to jump (in source code and in proc/var tab)
- locate calling line in thread menu
- dissassembly of one line or one proc with insert of each basic Line (source code tab, proc/var tab and proc tab)

Fixed
- length of udt when multiple of 4 Or 8 (will be also fixed in next version of fbc 0.91)
- fbdebugger should be fully working with the gcc option
- wrong number for first line of proc, gcc only (will be also fixed in next version of fbc)
Although there are still some issues :
- dynamic arrays missing (will be fixed in next version of fbc)
- ztring And fstring are handled As ubyte arrays (a feature in fbdebugger allows to display ubyte array as string)
- bitfields are also differently managed
- parameters with a size less than 4 bytes are handled as Integer
- typos in comments by AGS (thanks)

Changed
- delete Log file doesn't change any more the kind of the log (screen, file,..)
- the string "local", not really usefull, is removed for each local var name in proc/Var tab.
- the strings "constructor/operator/destructor/func/sub" are now put after the proc name to get a right sort in proc tab.
- all the names of Operator, etc are demangled
- some option names have been modified (show <-> locate)

http://users.freebasic-portal.de/sarg/f ... _09_29.zip


Version 2.64 (2013/07/27)

Added
- an option in tools menu to remove the log file in source codes tab.
- the type of log (screen, file, ...) is saved in the ini file (request by Enform)
- in procs tab, the proc could be sorted by their name or by their file name, option in the contextual menu and saved in the file ini (requested by MOD)
- in procs tab, select proc to jump in the source is also possible by pressing SHIFT key
- Operator, Property, Constructor, Destructor, Public and Private are displayed in red like Sub And function
- In settings, customization of shortcut keys for every menu option
- An option in tools menu to show all the shortcut keys.
- some menu options corresponding to buttons (halt, kill, modify execution and fast run)
- An option in tools menu to show the elapsed time when fast run is used. Usefull to get the duration of a block of instructions.

Changed
- new open file icon (more standard image) for better understanding (requested by MOD)
- end message (quit fbdebugger) modified for better understanding (requested by MOD)
- fbdebugger's help file is associated with fbdebugger and closed when quiting it (use of htlmphelp function)
In the future, easier use of the help file.
- optimization of restart in order to avoid useless reloading of bas files (idea by MOD)
- help file v1.11.

Fixed
- at debuggee loading remove the variable fb_compil_info to avoid its display
- double display of shared arrays used with erase (FBC bug, fixed par dkl in a next release)
- Issue with file names due to a change in FBC version 0.90 (reported by MOD)

http://users.freebasic-portal.de/sarg/f ... _07_27.zip


Version 2.63 (2013/04/22)

Added :
- Breakpoints saved in ini file.
when starting a new execution of FBdebugger, breakpoints from dll are displayed only if the corresponding dll is loaded.
in some cases hidden dll breakpoints could be removed, overwritten by others visible brkp
- Breakpoints could now be disabled/enabled (colored in grey). In breakpoints management new buttons ENB/DSB.
- If the selected line is without breakpoint when using disabled --> create directly a disabled permanent breakpoint
- New icons replacing S,V,M and restart buttons
- New option "Step return" (button and short cut key "B"ottom) : execution till the end (exit sub, end sub, etc) of the current proc.The purpose is to be able to look at the variables before leaving the proc.
- New option "Step top" (button and short cut key "T"op) : execution till the first Line of next called proc.
- In case of automatic change of thread (mutex or threadcreate) a message is displayed giving the choice of which thread will be the current.
- Addresses (start, End And stack) about running proc (option in threads menu).
- Multi threads step auto : step auto alernates between selected threads (checkboxed in threads tree)
- Beginning of proc are marked by Keywords sub and function colored in red for better visibility.

Fixed :
- Italic police no more used for highlighted keywords
- Minor bugs
- Optimization when restoring previous instruction (replacing &hCC)

- The help file has been completely revised, v1.10 .
All the files to create help file : http://users.freebasic-portal.de/sarg/f ... lp_110.zip


http://users.freebasic-portal.de/sarg/f ... _04_22.zip


Image
Last edited by SARG on Jul 05, 2023 22:08, edited 81 times in total.
KaraK
Posts: 72
Joined: Sep 13, 2006 19:01
Location: Argentina

Post by KaraK »

holy moly.

its awesome , i didnt take a look at your previous releases , but this is just awesome. congratulations.
BasicScience
Posts: 489
Joined: Apr 18, 2008 4:09
Location: Los Angeles, CA
Contact:

Post by BasicScience »

Ditto. This is an awesome development too. Many Thanks.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

I've tried the debugger right away. And all I can say is: well done, SARG, well done. I'll be using this debugger for sure.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

Content of message removed by AGS
Last edited by AGS on Jun 06, 2009 21:17, edited 1 time in total.
Amundo
Posts: 57
Joined: Feb 26, 2007 0:25

Post by Amundo »

Very nice, SARG, thank you!
SARG
Posts: 1821
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

First of all thanks for yours congratulations it's encouraging :-)
AGS wrote:Feature request.
Display data in an easier to view way.
Memory dump gives a matrix filled with values. This no doubt shows the content of the variable but a string is something like this "this is a string" and if it gets long scrolling would be nice. And I only get to see the first character of the string (unless I do a memory dump).
I don't really understand, in the variables windows you can see about 30 characters for more use indeed memory dump. I can easily add an option to show the entire string in an edit window (read only or not).
It's done (max 32000 characters) and will be in the next release.
Also coming :
- attachment to a running program
- warning if filedates (exe and source) are incoherent
AGS wrote: Same thing for arrays. Now I only get to see the first value in the array while I would like to see the entire array (without having to dump memory). If it doesn't fit then scroll.
An array could be shown as a matrix (memory dump) with multiple rows if it's an array of some userdefined type. If it's a simple type (string, integer, ushort, etc..) it could be just one scrollable row.
With the option Index you can move inside the array, the value of the element (simple or udt) is changed directly in the variables window.
I'm not sure that in case of arrays with thousand and thousand of elements it will be usable but I'll think about it.
AGS wrote: Most nice would be an interface like DDD uses. It utilizes a canvas at the top of the interface (just below the buttonbar). It looks something like this:
First I'll try to understand the principles ;-) and after see what I can do.
AGS wrote: It isn't fair to compare DDD to fbdebugger (DDD has been under development for many years) but it does show some of the data displaying possibilities.
I prefer not to count the spent hours but I began three years ago obviously not coding continuously
AGS wrote: And it would be very good if QB users could use the debugger as well. I know the problem with QB debugging is missing debugging information (a situation you cannot solve) yet the assembler code tells tales (using GDB I can actually display the values of strings like a$ etc....).
I think that it's impossible and I don't want to share my time.
AGS wrote: And last but not least: please release the source code. C, C++, assembler, it's all good to me. I'd like to read/change the source code of fbdebugger.
All the code , about 6000 lines, is written with freebasic with use of lots of windows API. Some parts are a bit tricky (management of redim variables, stabs,..) . I'll think about it but in case of release this would be out of the forum (for the moment I prefer to keep the total control). Send me an email, my email address is in the txt file and in the "about".
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

I removed the content of my previous message (the one with the link to DDD and comment on the latest version of the debugger).

I had been a little bit too hasty with my comments. I should've worked with your debugger a lot more before writing a message about it's functionality.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Post by Galeon »

I can't understand the instructions (I know, that's awfull).
I can't see the window of the program I'm debugging.
SARG
Posts: 1821
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

@AGS really no problem about yours comments :-) but you're right you must try it before. I suppose that there are still a lot of bugs or improvements and that you can help me.

@Galeon Instructions :
- create a folder and copy inside fbdebuggernew.exe, fbdebugger.ini and fbdebug_user.txt
- start fbdebugger
- click on file button (the button with two floppies) and select an .exe COMPILED with the -g option
this option adds debug informations to your exe
- debuggging is starting on the first executable line ....
- fbdebugger accepts also filename in commandline so you can start it in a .bat or from an other program, an ide by example.

Do that and tell me
segin
Posts: 126
Joined: Dec 27, 2005 5:22
Contact:

Post by segin »

Can FBDebugger debug more than just FreeBASIC-compiled binaries with debugging symbols? How complete is it's STABS support?

Can I debug files using other debuggers formats (e.g. MS-PDB, DWARF2, etc.)?
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Post by Galeon »

How about changing from one line to another
TheMG
Posts: 376
Joined: Feb 08, 2006 16:58

Post by TheMG »

This looks interesting, but all of my variables are just displayed as "L", which doesn't tell me a lot.
SARG
Posts: 1821
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

Can FBDebugger debug more than just FreeBASIC-compiled binaries with debugging symbols?
FBdebugger uses STABS data and it's very close with Freebasic data structures (string by example) so I suppose that with other compilers you'll get some troubles. But try and tell me.
How complete is it's STABS support?
I'm using all the informations put in the binary except the scope limitations (inside loop, scope/end scope) so you can see variables values outside of their normal scope...
Some tricks could be also a problem.
And as Freebasic doesn't use registers so do I.
Can I debug files using other debuggers formats (e.g. MS-PDB, DWARF2, etc.)?
If the format is different from Stabs (as I guess) you can't.
How about changing from one line to another
You can use the leftmost button or the key "s" to step to the next line.
You also can move the cursor to a line and then execute till this line with the "run to cursor" button

A tooltip indicating its function and the keyboard shortcut is associated with every button.
There is also an help file displayed with the correponding option in the tools button menu.
This looks interesting, but all of my variables are just displayed as "L", which doesn't tell me a lot.
"L" is the default value when a new proc is beginning, in a second step the names/values are loaded from memory. Try with a simple code.
Post an example and I'll to fix the problem in the next version.



I take this post to signal that a new version (2.1) will be available in some hours.

- FBDebugger has a very nice icon ;-)
- more interesting, you can now easily switch between threads, only one could be in execution while the other ones are waiting
- an option allows to display a string, up to 32000 characters (for more use dump).
- and the best of the best you can attach the debugger to a running program, usefull in case of infinite loop.
- warning if a source file is newer than the executable file
SARG
Posts: 1821
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

As promised a new version :

- FBDebugger has a very nice icon ;-)
- more interesting, you can now easily switch between threads, only one could be in execution while the other ones are waiting
- an option in variables window menu allows to display a string, up to 32000 characters (for more use dump).
- and the best of the best you can attach the debugger to a running program, usefull in case of infinite loop (be carefull sometimes unstable).
- warning if a source file is newer than the executable file


Use the link at first post.
Post Reply