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

User projects written in or related to FreeBASIC.
Post Reply
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

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

Post by Luis Babboni »

May be my mistake is in other place.

This is the code that works in 64 bits but not in 32 bits:

Code: Select all

Dim NPA As Double
Dim ttIndex As ULongInt

NPA=2277960380
ttIndex=NPA Mod(16777216)

Print ttIndex

Sleep
Shows me
0 in 32 bits
13036220 as must be in 64 bits
srvaldez
Posts: 3373
Joined: Sep 25, 2005 21:54

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

Post by srvaldez »

this works

Code: Select all

Dim NPA As Double
Common Shared ttIndex As ULongInt

NPA=2277960380
ttIndex=NPA Mod 16777216LL 'uppercase L is easier to recognize

Print ttIndex

sleep
Luis Babboni
Posts: 375
Joined: Mar 15, 2015 12:41

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

Post by Luis Babboni »

srvaldez wrote:this works

Code: Select all

Dim NPA As Double
Common Shared ttIndex As ULongInt

NPA=2277960380
ttIndex=NPA Mod 16777216LL 'uppercase L is easier to recognize

Print ttIndex

sleep
??!!
:-O

Thanks!
srvaldez
Posts: 3373
Joined: Sep 25, 2005 21:54

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

Post by srvaldez »

this works also

Code: Select all

Dim NPA As Double
Common Shared ttIndex As ULongInt

NPA=2277960380
ttIndex=NPA Mod 16777216UL

Print ttIndex

sleep
sancho2
Posts: 547
Joined: May 17, 2015 6:41

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

Post by sancho2 »

Hello Sarg:
I noticed a very strange bug using version 2.91 b1 (32 bit).
If you try to run to cursor on a line were variable = variable, the debugger reports it as an inaccessable line.
Example. Put the cursor on the x = x line and press run to cursor.

Code: Select all

ScreenRes 800, 600, 32
Dim As Byte x
? "hello"

'If x = 12 Then
	x = x
'EndIf
sleep
St_W
Posts: 1618
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

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

Post by St_W »

I you take a look on the intermediate Assembly/C output from the compiler (compile using "-r -g" options) you'll see that no code is generated for "x = x", so there's nothing that could be debugged (-> inaccessible line). So nothing is wrong with FbDebugger in this case.

Anyway, why would one ever write code like "x = x" ?
If you want to add a dummy instruction doing nothing for debugging purposes you could use e.g. "asm nop" instead (for x86 and x64).
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

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

Post by SARG »

Hi all,

Nothing more to say.
@St_W thanks.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

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

Post by Tourist Trap »

SARG wrote:Hi all,

Nothing more to say.
@St_W thanks.
And a longer chain as x=x=x=x=x=x=x=x=x=x=x=x ? Would it be ignored. Just curiosity ;)
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

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

Post by SARG »

Not ignored as there are 10 comparisons (x equal x ?) then in the end the result is assigned to x.

x=x : just an assignement so no generated code

x = x = x : first one comparison then an assignment so obviously some lines of code
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

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

Post by Tourist Trap »

SARG wrote:Not ignored as there are 10 comparisons (x equal x ?) then in the end the result is assigned to x.

x=x : just an assignement so no generated code

x = x = x : first one comparison then an assignment so obviously some lines of code
Thanks! So it answers to my question. So if there is no assignement finally (correct number of = signs) this will be ignored. That's good to know.
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

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

Post by SARG »

NO.
There is always an assignment but the compiler is able to see that no code is necessary in this particular case x=x.

Once there are 2 '=' or more there are comparisons and the assignment.
The final result could be 0 or -1 depending of the number of comparisons.

Code: Select all

Dim As Byte x
x=x=x=x:Print x
x=x=x  :Print x
sleep
result = 0 or -1
sancho2
Posts: 547
Joined: May 17, 2015 6:41

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

Post by sancho2 »

St_W wrote:If you want to add a dummy instruction doing nothing for debugging purposes you could use e.g. "asm nop" instead (for x86 and x64).
That is exactly what I was doing. I wanted to start stepping through at a certain point under a certain condition, so I needed code inside an if block.
Thanks for the info. I will use asm nop from now on.

Edit:
asm nop doesn't work either.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

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

Post by AGS »

@SARG
I am looking for a place to put my FB related stuff. And I see you are using the German FreeBASIC site. How do I go about setting up an account on the German FreeBASIC server (you seem to be uploading your stuff to http://users.freebasic-portal.de/sarg/).
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

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

Post by SARG »

Hi AGS,

I sent you an email address of the person who created my account.
As your address is old tell me if you get nothing.

Surprisingly I have not received a message from the forum after your last post ????? I just saw it by chance.

Edit : received message after the ST_W's post.
Last edited by SARG on Jul 08, 2017 16:18, edited 1 time in total.
St_W
Posts: 1618
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

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

Post by St_W »

AGS wrote:How do I go about setting up an account on the German FreeBASIC server
http://users.freebasic-portal.de/ wrote:Every FreeBASIC programmer can apply to get a free web hosting account on this server to store and publish his/her programming related contents. Just contact the server operator (see email address below).

[...]

E-mail address of the server operator: mail ((at)) freebasic-portal [dot] de
Post Reply