FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

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

FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby SARG » Jun 02, 2009 19:56

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

Version 2.91 (2016/08/20)

- 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)

- 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)

- 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)


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

- 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)

- 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

- 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


Version 2.81 (2015/05/03)

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

- 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)

- 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)

- 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)


Version 2.80 (2014/09/21)

- 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.

- 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)

- 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.


Version 2.71 (2013/10/27)

- 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)


Version 2.70 (2013/09/29)

- "(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)

- 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)

- 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)

- 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.

- 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.

- 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

Version 2.62 (2013/02/16)

- Tutorial demo (work in progress), option "Tutorial" in tools
To test see this post : viewtopic.php?f=8&p=184394#p184319

- Issue when using mutexes (current thread not changed)
- Some internal debugging traces removed

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

Version 2.61 (2013/02/10)

- show the first executable line of main (proc/var or thread context menus)
- procs are now sorted by thread in proc/var windows
- proc tree in threadview
- few options added in thread context menu (eg select item to show proc in proc/var treeview)
- new keywords (virtual and abstract) added
- better management of dll
- debugged Dlls list (tools)
- watched var for dll : only basic types and pointers are kept between two debuggings
- list all proc/var in log (proc/var context menu)

- no calling line for a thread
- issue when modifying execution on last line of proc
- infinite loop when 2 dlls or more are loaded
- other minor issues
- loading one time each source (never unload) (St_W)
- closing handle of unloaded dll so they are no more locked by fbdebugger (St_W)
- shared var provided by dll are now managed (St_W)

- User manual not updated still 2.58 but not really a problem ;-)


Version 2.60 (2012/11/19)

- wrapping/no wrapping for the "Show String" window (proc/var context menu)
- choice of font including size, saved in the ini file (settings)
- highlighted keywords (settings)
- choice of the color for background and lines (current/breakpoint), saved in the ini file (settings)
- strings (except wstring) can now be used with break on var, 25 chars max
- new option "focus line" (shortkey L) in the source window opens a window to follow the executed line or an other part of any source module. This window hasn't the horizontal scrolling style.(proc/var context menu)
- set watch var with/without trace (proc/var context menu)
- exchange between Byte And ZString type to fix the fact that with gcc the zstring are stored as byte array (proc/var context menu)
- locate the line where a proc has been called (proc/var context menu)
For an easy use, collapse the treeview to see only the procs like a sort of call stack
- option "show executable lines" has been replaced by "mark no executable lines", the lines are displayed in green (proc/var context menu)
- Improvement in threads management (simultaneously 10 threads) :
To kill threads
To show next executed line for each thread
To locate the proc at the start of the thread
- naked proc could be debugged (gas)
- address in memory of a line (sources window context menu)
- parents tree for inheritance is displayed in proc/var Window, variables added by compiler are shown (proc/var window)

- issue when comments are used in asm lines
- better support of -gen gcc option : the management of variables except some should be correct.
In fact Fbdebugger translates the gcc data stabs in the old form (-gen gas) before use.
Sometimes there are issues with line numbers, Not sure that it could be easily fixed.
- issue with ThreadCreate crashing fbdebugger when exiting, missing argument "p as Any ptr" added in the called procs (Thx to Vanya)
- issue when the register EBP is modified in asm lines (reported by VANYA some months ago)
- issues With threads (few threads with same proc, deleting proc when ending thread)
- issue when using screen command : killing proc --> freeze

- if the version of gcc is > 3, add this parameter -Wc -gstabs+ in the FBC command-line in addition of -g otherwise the stab datas are not added
- User manual not updated


Version 2.59 (2012/05/04)
- Shortcut key 'R' in source context menu (jmg)
- local watched kept between calls of proc (jmg)
- watched kept when rerunning immediatly the debuggee (jmg)
- watched kept except arrays and memories after closing fbdebugger (jmg)
- Use of shell to compile, no more need of batch file (Vanya)

Version 2.58 (2012/02/11)
- TOC and minor changes in the help file (version 1.01)

Version 2.58 (2011/11/27)
- New help file : fbdebugger_help.chm (version 1.00)
- The line breakpoints are kept when restarting the debuggee. You can eventually delete one or more breakpoints.
- Two new hot keys (F3 and SHIFT+F3) to put/cancel breakpoints.

Version 2.57 (2011/09/12)
- variables or memory tracing when their values change (enform)
- remove in case of already set watched element
- different formats (hex, binary,..) for watched vars
- jit debugger
this option allows to define fbdebugger to be automatically launched when a debugbreak instruction is met or an access violation is occuring.
obviously your program has to be compiled with the -g option.
Remember that there is a possibilty (by button or key M) to change the program flow within a procedure. So you can either skip lines
or rerun some lines with possible changes of values.
- executable lines colored in green (only current source tab)
- options in watched var menu not working correctly

Last edited by SARG on Aug 20, 2016 19:54, edited 67 times in total.
Posts: 72
Joined: Sep 13, 2006 19:01
Location: Argentina

Postby KaraK » Jun 03, 2009 4:29

holy moly.

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

Postby BasicScience » Jun 03, 2009 7:14

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

Postby AGS » Jun 03, 2009 16:49

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.
Posts: 1283
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Postby AGS » Jun 04, 2009 23:49

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

Postby Amundo » Jun 05, 2009 6:22

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

Postby SARG » Jun 05, 2009 8:39

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".
Posts: 1283
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Postby AGS » Jun 06, 2009 21:56

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.
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines

Postby Galeon » Jun 08, 2009 13:19

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

Postby SARG » Jun 08, 2009 19:35

@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
Posts: 126
Joined: Dec 27, 2005 5:22

Postby segin » Jun 22, 2009 19:59

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.)?
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines

Postby Galeon » Jun 23, 2009 3:45

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

Postby TheMG » Jun 23, 2009 13:01

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

Postby SARG » Jun 23, 2009 22:58

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
Posts: 796
Joined: May 27, 2005 7:15
Location: FRANCE

Postby SARG » Jun 25, 2009 19:33

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.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest