FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

User projects written in or related to FreeBASIC.
ITomi
Posts: 130
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby ITomi » Apr 19, 2020 8:57

Thanks, SARG! I tried your suggestion with command line (I build it so: fbc -g -exx mygame.bas then I ran it in command line), and my program crashes immediately, but now command line shows me those lines which contain error. But interesting: when I ran the game across FB debugger, it could run without error. Or is it impossible to find the reason with a debugger when a program has stopped working and try to send message to Microsoft? Maybe the roots of this error are not from my program but something other, e.g. virus or driver problems?
SARG
Posts: 1145
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby SARG » Apr 20, 2020 22:04

ITomi wrote:Thanks, SARG! I tried your suggestion with command line (I build it so: fbc -g -exx mygame.bas then I ran it in command line), and my program crashes immediately, but now command line shows me those lines which contain error.
Fine.
In fact with -exx the program doesn't crash : the code added by -exx traps some errors, displays an error message then forces the end of execution.

ITomi wrote: But interesting: when I ran the game across FB debugger, it could run without error.
The problem can happen randomly depending what memory areas are wrongly used. The code added by -exx can changes these areas therefore crashes happen or not.

ITomi wrote: Or is it impossible to find the reason with a debugger when a program has stopped working and try to send message to Microsoft? Maybe the roots of this error are not from my program but something other, e.g. virus or driver problems?

Most of the time (always) errors in your code will be the reason of crash. :-)
A wise way is to use -exx at least when your work is in progress and later when a problem happens.
It's possible to debug using the JIT debugger option. It intercepts the crash, starts the debugger (showing information about place of the problem) and obviously prevents the sending of message to Microsoft.
ITomi
Posts: 130
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby ITomi » Apr 24, 2020 13:07

Okay and thanks, SARG!
One more question about JIT debugger: in "Set JIT debugger" option in FBdebugger, now the current is bordbg61.exe (I have an old Borland C++ Builder on my computer). What should I do? Restore the default JIT debugger ("Dr Watson" DRWTSN32... I don't know what is this) or replace by fbdebugger.exe? Is this the right debugger for this purpose?
SARG
Posts: 1145
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby SARG » Apr 24, 2020 14:23

ITomi wrote:One more question about JIT debugger: in "Set JIT debugger" option in FBdebugger, now the current is bordbg61.exe (I have an old Borland C++ Builder on my computer). What should I do? Restore the default JIT debugger ("Dr Watson" DRWTSN32... I don't know what is this)
As far I remeber DRWTSN32 was the default exe started when a crash arises. I did this many years ago only 32bit world :-)

or replace by fbdebugger.exe? Is this the right debugger for this purpose?
If you still use Borland's C++ let bordbg61. Honestly For a proper answer I would have to redo tests (dwwin seems the new exe...).
wallyg
Posts: 124
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby wallyg » May 05, 2020 0:00

I have a quick question. I am using the latest 32 bit debugger you put together recently with the most recent FB system on an up to date windows 10 system.

I have a program I am trying to debug. It works fine way past this point without using the debugger. However when it is run in the debugger (run fast mode - run takes 5 minutes to get to this point) it gets to the following dialog= statement and then upon executing it, the requested pop up window asking for a filename (which works perfectly standalone), the popup does not appear and the debugger loses control. I tried halting the execution and nothing happens.

[code]Function GetFile(s as string,ca as GtkFileChooserAction,pattern as gtkfilefilter ptr = NULL) as string
dim as gtkdialog ptr dialog
dim as GtkResponseType result
dim as gtkfilechooser ptr chooser
dim as gchar ptr filename
dim as string fn

dialog = cast(gtkdialog ptr,gtk_file_chooser_dialog_new (s, _
GTK_WINDOW(MainWindow), _
ca, _
"_Cancel", _
GTK_RESPONSE_CANCEL, _
"OK", _
GTK_RESPONSE_OK, _
NULL))
/code]

I was wondering if there is any known problems with GTK popup windows? Or if you could suggest someway to get past this so I could get to the point where the problem is?

Thanks

Wally
SARG
Posts: 1145
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby SARG » May 07, 2020 7:14

Hi wallyg,

Sorry for my late reply.
Quick question but hard answer.

The only difference between normal run and fast run is that fast run doesn't update variables etc it only keeps track for calls and returnings. Then when the program reachs the breakpoint all is updated. So it's a bit faster but not as fast as it could be. However 5 minutes is too much so something goes wrongly

About the "nothing happens" I remember when debugging programs with Windows's APIs sometimes the returnings are not done in a normal way so the debugger was lost. Maybe the same behaviour with some GTK functions.

What can be done : under the proc tab deactivate some procs (contextual menu) to not follow them in the debugger. So the problem could be avoided (I hope) and the program will reach the faulty proc.

Even if you have found the bug try it and tell me.

The last possibility is to send me your code but I would have to install GTK. And as I'm a bit busy with gas64 don't expect a quick reply :-)

Edit : don't deactivate the main procedure....
wallyg
Posts: 124
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby wallyg » May 07, 2020 18:06

Thanks for the advice. I do not know about the deactivating. I will give it a try.

I have worked around this problem for now, by commenting out the call to the GTK function and setting the filename via the freebasic statement,


Code: Select all

' ... = gtk...
filename="project.prj"
The debugger works fine with the rest of the program by including this two line change.

Do not worry about this now. GAS64 is way more important. If I find any additional information in the future, I will let you know.

Thanks for all your considerations.

Wally
wallyg
Posts: 124
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby wallyg » May 07, 2020 18:07

Thanks for the advice. I do not know about the deactivating. I will give it a try.

I have worked around this problem for now, by commenting out the call to the GTK function and setting the filename via the freebasic statement,


Code: Select all

' ... = gtk...
filename="project.prj"
The debugger works fine with the rest of the program by including this two line change.

Do not worry about this now. GAS64 is way more important. If I find any additional information in the future, I will let you know.

Thanks for all your considerations.

Wally
StillLearning
Posts: 33
Joined: Aug 27, 2019 22:22

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby StillLearning » Jul 21, 2020 20:47

I have a question that other people I am sure have already asked but did not find it in the forum.
How do I view the contents of a dynamic array while stepping thru my code? I tried to use the "update" when selecting the array to view in the show/expand window but it does not change. What am I doing wrong?
SARG
Posts: 1145
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby SARG » Jul 22, 2020 10:24

Hi StillLearning,

In Show/expand you should be exactly on the array.
You could try using selection index. For simple arrays you'll see a 'slice' of values. And there is an option for automatic update.

Post an example of yours arrays I'll give you a better answer.
StillLearning
Posts: 33
Joined: Aug 27, 2019 22:22

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby StillLearning » Jul 22, 2020 19:56

Here is part of the program:

Code: Select all

#Define StartingTokenIndex  99
Dim as UShort ListIndex,FormsIndex,StartIndex
Dim TokenIndex as UShort

type FormLayout
  Flags as ubyte
  CPUSupported as Ulong
  OPCode as Ushort
end type

ReDim FormsToUse(1 to 500) as FormLayout
ReDim InstrFormsIndex(1 to 200) as UShort

ListIndex = 0
StartIndex = 0
TokenIndex = StartingTokenIndex
do
  StartIndex = StartIndex + 1
  If TokenIndex < StartingTokenIndex then
    Print "Internal Error: Missing "+chr$(34)+_
          "Data 0,0,0,0"+chr$(34)+_
          " at end of forms list"
  end if
  read TokenIndex
  read FormsToUse(StartIndex).Flags
  read FormsToUse(StartIndex).CPUSupported 
  read FormsToUse(StartIndex).OPCode
  If TokenIndex <> FormsIndex then
    FormsIndex = TokenIndex
    ListIndex = ListIndex + 1
    InstrFormsIndex(ListIndex) = StartIndex   
  end if
loop while TokenIndex <> 0
Redim preserve FormsToUse(1 to StartIndex)
Redim preserve InstrFormsIndex(1 to ListIndex)
end

Data 100,0,&H0001,&H37
Data 101,0,&H0001,&H0AD5
Data 101,0,&H0001,&H0AD4
Data 0,0,0,0


I was using your debugger to try to examine the contents of the array FormsToUse but when I use Show/expand on that array the contents do not change when I use update. What am I doing wrong?
SARG
Posts: 1145
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby SARG » Jul 22, 2020 21:06

No problem on my side.

Some information how to proceed :
When you select show/expand on the structure it's the current element (visible in proc/var) that is selected and displayed.
You can change the index using delta +/- to select the wanted element, 'step' then click on update.

You can also 'step' and just use delta+/- that automatically updates the display.

Hope it helps.
StillLearning
Posts: 33
Joined: Aug 27, 2019 22:22

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby StillLearning » Jul 22, 2020 23:20

Thanks that helped a lot.
I notice that when I dim my array from 1 to limit that delta does not start at 1 but always starts at 0 and goes past the limit value.
SARG
Posts: 1145
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby SARG » Jul 23, 2020 0:06

StillLearning wrote:Thanks that helped a lot.
You are welcome.

I notice that when I dim my array from 1 to limit that delta does not start at 1 but always starts at 0 and goes past the limit value.
Delta is not the low bound, it's the delta relative to the index value initialy selected. I agree that's not obvious.

Example
- take an array 3 to 9
- select the element 5 in show/var (by index selection) then sent it to show/expand.
- click 'delta+' twice --> now index value is 7 (but this information is not displayed) and value of delta is 2.
StillLearning
Posts: 33
Joined: Aug 27, 2019 22:22

Re: FB debugger : 2.96 32/64 BIT ..... (2020/02/17)

Postby StillLearning » Jul 23, 2020 4:48

Since you already know where the array selected starts and ends why do you not have the delta correspond to the starting and ending of the array?

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest