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

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

Re: FB debugger : 2.80 BETA 9 (april 14th, 2014)

Post by SARG »

Hi all,
gtripathi wrote:I'm trying to install this on Ubuntu. Is there a linux binary for FB Debugger, or instructions to compile in on linux?
As MOD said it's only for Windows. I was writing a version entirely with fbc instructions but it's in standby to take in account the important modification below.

After a bit of work.... I can release a new version allowing to handle dyn arrays in udt. Only with -gas option.
Although I have tested on a dyn array variable with dyn arrays on 2 levels. :-) you might still find bugs.
Mandatory use the last 0.91 build provided by St_W.

http://users.freebasic-portal.de/sarg/FBdebugger.bas (beta 11)

Just for testing :

Code: Select all

Type ttest2
	vvv(1) As Short
	xxx As Integer
	zzz(Any) As Integer
End Type

Type ttest
	aaa As UByte
	bbb(Any) As ttest2
	ccc(1 To 2) As ulongint
End Type

Dim As ttest vtest2(2)
vtest2(1).aaa=19
ReDim (vtest2(1).bbb) (1)
vtest2(1).bbb(0).xxx=12




ReDim vtest() As ttest

ReDim vtest(1 To 2)

vtest(1).aaa=111
vtest(1).ccc(1)=10
vtest(1).ccc(2)=11
vtest(2).aaa=222
vtest(2).ccc(1)=20
vtest(2).ccc(2)=21

ReDim (vtest(1).bbb)(0)
vtest(1).bbb(0).xxx=190:Print @vtest(1).bbb(0).xxx

ReDim (vtest(1).bbb)(1)
vtest(1).bbb(1).xxx=191
vtest(1).bbb(1).vvv(0)=120
vtest(1).bbb(1).vvv(1)=121

ReDim (vtest(1).bbb(1).zzz)(1)
vtest(1).bbb(1).zzz(0)=1100
vtest(1).bbb(1).zzz(1)=1101

ReDim (vtest(2).bbb)(0)
vtest(2).bbb(0).xxx=290

ReDim (vtest(2).bbb)(1)
vtest(2).bbb(1).xxx=291:Print @vtest(2).bbb(1).xxx
vtest(2).bbb(1).vvv(0)=220:Print @vtest(2).bbb(1).vvv(0),vtest(2).bbb(1).vvv(0)
vtest(2).bbb(1).vvv(1)=221

ReDim (vtest(2).bbb(1).zzz)(2 To 3)
vtest(2).bbb(1).zzz(2)=2002
vtest(2).bbb(1).zzz(3)=2003


Print vtest(2).bbb(1).zzz(3)

ReDim (vtest(1).bbb)(3)
vtest(1).bbb(3).xxx=33390
Print vtest(1).bbb(3).xxx
Sleep
Cls
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.80 BETA 9 (april 14th, 2014)

Post by SARG »

Hi all,

A new version (beta 12) : http://users.freebasic-portal.de/sarg/FBdebugger.bas

- When leaving FBdebugger no more message if there are no notes.
- Dyn array fields usable with option -gcc.
- All the exceptions (like divide by zero) are handled as access violation, showing the line where the error arises.
- Issue (immediate execution) when the debuggee contains only one line . Don't ask me what is the need of debugging a such prog :-)
- More information (address of data) for dyn array fields displayed in proc/var tab.
- Size of stabs increased up to 50000 bytes.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FB debugger : 2.80 BETA 12 (may 30th, 2014)

Post by AGS »

Alas, Insight can no longer be used as debugger on win32. It breaks when loading a file compiled with the latest version of the fbc.

Meaning that I will be using your debugger from now on, SARG. I cannot get the buttonbar to show up correctly (no pictures) yet.
Must be doing something wrong when compiling the debugger. Still, fbdebugger comes with plenty of tooltips so I don't even need those pictures.

Good thing you have kept fbdebugger going for all those years, SARG. Using a programming language without
having access to a decent debugger to find/fix bugs is not that much fun.

Merci, SARG. Merci beaucoup.
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.80 BETA 12 (may 30th, 2014)

Post by SARG »

Hi AGS,
AGS wrote:Meaning that I will be using your debugger from now on, SARG.
Why not before ?
All suggestions to improve welcome.
AGS wrote: I cannot get the buttonbar to show up correctly (no pictures) yet.
Must be doing something wrong when compiling the debugger. Still, fbdebugger comes with plenty of tooltips so I don't even need those pictures.
To get the images : put the folder containing all these images in the directory of fbdebugger.bas.
Then compile fbdebugger using fbdebugger.rc.
I know you are enough skilled to do that ;-)
AGS wrote:Good thing you have kept fbdebugger going for all those years, SARG.
I hope continuing to update fbdebugger still a long time. In fact each time I wanted to let down, someone asked for a new feature or signaled a bug :-)

Now the job is going to be hard : W32, W64, gas/gcc, stabs/dwarf.
And I would like to port on linux.The system calls don't seem hard to handle (I studied the use of ptrace). For now, I have trouble to run FBC on a linux box.... Honestly not a lot of time spent to search how to do. I have to read the fbc wiki and maybe I'll ask some help to begin with linux.
AGS wrote:Merci, SARG. Merci beaucoup.
That's too much, anyway dank je wel.
St_W
Posts: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: FB debugger : 2.80 BETA 12 (may 30th, 2014)

Post by St_W »

Today I used your debugger for debugging fbc itself. It didn't work out of the box because of the following error:
ERROR not enough space to load stabs string

The message explains the problem quite well and I was able to fix it by increasing the memory for the stabs data. However it would be nice if you had used a constant / #define instead of hard coding a value. For example like this:

Code: Select all

#Define MAX_STAB_SZ 500000
line 7462:
	    	Dim recup As ZString *MAX_STAB_SZ '03/05/2014

line 7533:
	    	If sizestabs-recupstab.stabs>=MAX_STAB_SZ Then
	    		fb_message("Loading stabs","ERROR not enough space to load stabs string (" + Str(MAX_STAB_SZ) + ")"):Exit sub 
	    	Else
Maybe there are other occurences, but I got it to work by just changing these two. As the data is stored on the stack (local variable) I had to increase the stacksize when compiling (using parameter "-t")
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.80 BETA 12 (may 30th, 2014)

Post by SARG »

St_W wrote:Today I used your debugger for debugging fbc itself.
Fearless man ;-)
St_W wrote:It didn't work out of the box because of the following error:
ERROR not enough space to load stabs string
In may the space has been increased up to 50 000 and it was enough. I guess that 60 000 or 70 000 should be ok. In this case no need to change the stacksize.
Fyi the 'recup' var stores the string associated to only one data not all the stabs so 500 000 is really too big.
St_W wrote: However it would be nice if you had used a constant / #define instead of hard coding a value.
No problem I'll do that using your code.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FB debugger : 2.80 BETA 12 (may 30th, 2014)

Post by AGS »

SARG wrote:
AGS wrote: I cannot get the buttonbar to show up correctly (no pictures) yet.
Must be doing something wrong when compiling the debugger. Still, fbdebugger comes with plenty of tooltips so I don't even need those pictures.
To get the images : put the folder containing all these images in the directory of fbdebugger.bas.
Then compile fbdebugger using fbdebugger.rc.
I know you are enough skilled to do that ;-)
:) I managed to build fbdebugger using fbdebugger.rc and the images. I would not have been able to pull this one if it were not for you telling me how to do it.
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.80 (september 21th, 2014)

Post by SARG »

Hi all,

A new version that must be close of fbc 1.00. For example : dynamic arrays inside udt are managed.
see first post.

Happy coding and debugging.

SARG.

PS I forgot to report the modification about the stabs size given by St_W . ;-)
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: FB debugger : 2.80 (september 21th, 2014)

Post by Roland Chastain »

Hello SARG!

You suggested me in another discussion to use FBDebugger. I would like but I don't know what I should do exactly. I never really used a debugger. Could you give some indications please ?
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.80 (september 21th, 2014)

Post by SARG »

Roland Chastain wrote:Hello SARG!

You suggested me in another discussion to use FBDebugger. I would like but I don't know what I should do exactly. I never really used a debugger. Could you give some indications please ?
You could use the help file ;-)

anyway, always compil with the -g option. This parameter adds data for debugging.

launch fdbebugger then drag and drop your exe on the window or you can also select the exe after clicking on the classic open file button.
then use the key "s" or the more left button to execute line by line until the crash.

there are other ways, for example : define fbdebugger as the "just in time debugger" (see the option in the tools button).
Then just execute (outside fbdebugger) your program. When the crash occurs fbdebugger is automatically launched and if everything is working well you should see the faulty line.

N'hesite pas à demander de l'aide supplémentaire/ Do not hesitate to request more help.
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: FB debugger : 2.80 (september 21th, 2014)

Post by Roland Chastain »

Excellent! Thank you SARG.

I made what you said first, and FBDebugger indicates this line as a possible error:

Code: Select all

  select case myIni.ReadString("interface", "language", "")
Very strong! I still haven't understood the error but I am glad to see how FBDebugger works.

After I drag-and-dropped my exe, I had this message: "Error: objdump.exe must be in the directory of fbdebugger"
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Re: FB debugger : 2.80 (september 21th, 2014)

Post by anonymous1337 »

Is this project OSS? I hope you at least have the code backed up automatically and regularly, if not...

I think it's a great project. I'll definitely have to go through the tutorial though to get a hang of it.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FB debugger : 2.80 (september 21th, 2014)

Post by MrSwiss »

Hi SARG,
I've a question regarding the two Versions of FBC 1.00.0, in connection with
FBDebugger: is it possible to compile FBD in 64bit Ver. and using it for both
afterwards, or do I have to "make" two distinct "builds" of FBDebugger?
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.80 (september 21th, 2014)

Post by SARG »

Hi all,

@anonymous1337
Thank you.

I understand OSS (open source software) but precisely what is your question ?
No problem for backup : all (source, images,..), except tests and documentation , is in the zip file on internet.
And I always save every important mod on an usb key.

The tutorial is not usuable, first attempt. So I recommand not to use it. For now the best way is to look to the help file, try and then ask for help ;-)

@MrSwiss

What I think :
1/ there must be 2 versions of fbdebugger, one for W32 and one for W64. But only one source code should be possible with conditionnal directives (compile-time).
2/ the W64 version needs a "bit" of work to be operational ( uinteger and integer are used for addresses but must be checked, the first parameters are stored in registers, 8bytes for integer,...). Don't forget Win API needed......

If you get a running W64 version (not obligatory working) I'll be interested :-).

Currently I'm working on namespaces associated with classes, demangling the proc names is very painfull. Bug found when resolving ths Roland Chastain issue. And at the same time I advance slowly on a linux release.

A question for the Nulix (just a joke for TJF) gurus : where to find the system headers for linux translated for freebasic (.bi) ?
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Re: FB debugger : 2.80 (september 21th, 2014)

Post by anonymous1337 »

Thank you SARG for answering my questions.

I was wondering if FB Debugger's source code was publicly available.
Post Reply