FB debugger is back (only windows sry)
FB debugger is back (only windows sry)
A new version using the -g option
http://www.mediafire.com/?oobx2djn9io
Include files , DLL could be used.
See the file txt for more informations
Comments are welcome.
Known limitations :
bugs in the compilator (please developpers do something)
- redim global variables
- include files when lines are not inside a proc (subroutines)
Current conception
- the number of modules, variables, proc etc... is fixed (easy to involve)
- No free bugs ;-)
http://www.mediafire.com/?oobx2djn9io
Include files , DLL could be used.
See the file txt for more informations
Comments are welcome.
Known limitations :
bugs in the compilator (please developpers do something)
- redim global variables
- include files when lines are not inside a proc (subroutines)
Current conception
- the number of modules, variables, proc etc... is fixed (easy to involve)
- No free bugs ;-)
Re: FB debugger is back (only windows sry)
Well, you have to help us out, there will always be bugs but you could do us a service by defining them for us.SARG wrote:bugs in the compilator (please developpers do something)
@Chaos
Yes you're right but it's an old problem.
The stabs data for redim global variable are not well defined so not possible to acces to the name and address. See this topic
http://www.freebasic.net/forum/viewtopic.php?t=9783
I have looked in the source of FBC but not easy to find a solution.
The second issue is new when you use include files there's only stabs data with procedure. In the other case the debugger can't find information about the source.
Hope that's a bit more clear.
By the way in the future will the stabs data be the same ?
Thanks for your reply.
Sarg.
Yes you're right but it's an old problem.
The stabs data for redim global variable are not well defined so not possible to acces to the name and address. See this topic
http://www.freebasic.net/forum/viewtopic.php?t=9783
I have looked in the source of FBC but not easy to find a solution.
The second issue is new when you use include files there's only stabs data with procedure. In the other case the debugger can't find information about the source.
Hope that's a bit more clear.
By the way in the future will the stabs data be the same ?
Thanks for your reply.
Sarg.
@AGS and Hard soon an improved version. Sry to be so late again but i spent many time studying the compiler, not so easy.
@AGS to see all the breakpoints right click on the surces windows and select breakpoints manage.
Not sure you can reuse my code : poor in comments and some times in french!!!! But if you get some trouble (or evolution) post examples and i'll try to fix it. By the way the new version of Fbdebugger can be used to trace FBC when compiling.
@countingpine
Could you take into account a fix in the edbg_stab to solve the issue with stabs of redim shared (see the first post).
It's just a workaround but simple and effective. As i can trace now the compiler I'll perhaps find a "cleaner" way.
Change between ''SARG BEGIN and ''SARG END.
Code for test and the obtained asm
@AGS to see all the breakpoints right click on the surces windows and select breakpoints manage.
Not sure you can reuse my code : poor in comments and some times in french!!!! But if you get some trouble (or evolution) post examples and i'll try to fix it. By the way the new version of Fbdebugger can be used to trace FBC when compiling.
@countingpine
Could you take into account a fix in the edbg_stab to solve the issue with stabs of redim shared (see the first post).
It's just a workaround but simple and effective. As i can trace now the compiler I'll perhaps find a "cleaner" way.
Change between ''SARG BEGIN and ''SARG END.
Code: Select all
sub edbgEmitGlobalVar _
( _
byval sym as FBSYMBOL ptr, _
byval section as integer _
) static
dim as integer t, attrib
dim as string desc
dim as zstring ptr sname
if( env.clopt.debug = FALSE ) then
exit sub
end if
'' temporary?
if( symbIsTemp( sym ) ) then
exit sub
end if
'' really global? (because the static local vars)
if( symbIsLocal( sym ) ) then
exit sub
end if
'' depends on section
select case section
case IR_SECTION_CONST
t = STAB_TYPE_FUN
case IR_SECTION_DATA
t = STAB_TYPE_STSYM
case IR_SECTION_BSS
t = STAB_TYPE_LCSYM
end select
'' allocation type (static, global, etc)
desc = *symbGetDBGName( sym )
attrib = symbGetAttrib( sym )
if( (attrib and (FB_SYMBATTRIB_PUBLIC or FB_SYMBATTRIB_COMMON)) > 0 ) then
desc += ":G"
elseif( (attrib and FB_SYMBATTRIB_STATIC) > 0 ) then
desc += ":S"
else
desc += ":"
end if
'' data type
desc += hGetDataType( sym )
''SARG BEGIN
'' workaround in case redim shared : use of back link !!!
If Right(desc,2)=":S" Then
desc = *symbGetDBGName( sym->var_.desc.array )+":S"+hGetDataType( sym->var_.desc.array )
EndIf
''SARG END
''
if( symbIsDynamic( sym ) ) then
sname = symbGetMangledName( symbGetArrayDescriptor( sym ) )
else
sname = symbGetMangledName( sym )
end if
''
hEmitSTABS( t, desc, 0, 0, *sname )
end sub
Code: Select all
Namespace testing
Type toto
titi As longint
End Type
Dim As toto tata
End Namespace
type tudt
udt1 as short
udt2 as ulongint
end type
sub gg()
static as integer subsimple
subsimple=13
redim as integer subredim(99)
subredim(1)=0
dim as integer subarray(5)
subarray(1)=1
end sub
ReDim As testing.toto nsredim(4,7,9)
nsredim(0,0,0).titi=12
ReDim shared As testing.toto nsredimshared(4,7,9)
nsredimshared(0,0,0).titi=12
dim as testing.toto nssimple
nssimple.titi=17:print "nssimple";nssimple.titi
ReDim Shared As tudt redimshared(7,9)
redimshared(1,1).udt1=12345
dim shared as integer sharedarray(7)
sharedarray(7)=87
dim shared as integer sharedsimple
sharedsimple=79
dim as integer mainlocal
mainlocal=5
dim as integer mainlocalarray(9)
mainlocalarray(9)=77
testing.tata.titi=99
Code: Select all
.file "test2.bas"
.stabs "D:/msys/bin/fbcsvn/fbcsrc/src/compiler/obj/win32/",100,0,0,.Lt_0001
.stabs "test2.bas",100,0,0,.Lt_0001
.section .text
.Lt_0001:
.stabs "integer:t1=-1",128,0,0,0
.stabs "void:t7=-11",128,0,0,0
.stabs "byte:t2=-6",128,0,0,0
.stabs "ubyte:t3=-5",128,0,0,0
.stabs "char:t4=-2",128,0,0,0
.stabs "short:t5=-3",128,0,0,0
.stabs "ushort:t6=-7",128,0,0,0
.stabs "uinteger:t8=-8",128,0,0,0
.stabs "longint:t9=-31",128,0,0,0
.stabs "ulongint:t10=-32",128,0,0,0
.stabs "single:t11=-12",128,0,0,0
.stabs "double:t12=-13",128,0,0,0
.stabs "string:t13=s12data:15,0,32;len:1,32,32;size:1,64,32;;",128,0,0,0
.stabs "fixstr:t14=-2",128,0,0,0
.stabs "pchar:t15=*4;",128,0,0,0
.stabs "test2.bas",130,0,0,0
.intel_syntax noprefix
#test2.bas' compilation started at 23:30:46 (FreeBASIC v0.20.0b)
.stabs "GG:F7",36,0,13,_GG@0
.balign 16
.globl _GG@0
_GG@0:
push ebp
mov ebp, esp
sub esp, 92
.stabn 68,0,13,_GG@0-_GG@0
.Lt_0004:
.Lt_0008:
## static as integer subsimple
## subsimple=13
mov dword ptr [_Lt_0009], 13
.stabn 68,0,15,.Lt_0008-_GG@0
.Lt_000A:
##
## redim as integer subredim(99)
mov dword ptr [ebp-36], 0
mov dword ptr [ebp-32], 0
mov dword ptr [ebp-28], 4
mov dword ptr [ebp-24], 4
mov dword ptr [ebp-20], 1
mov dword ptr [ebp-16], 0
mov dword ptr [ebp-12], 0
mov dword ptr [ebp-8], 0
push 99
push 0
push 1
push 0
push -1
push 4
lea eax, [ebp-36]
push eax
call _fb_ArrayRedimEx
add esp, 28
.stabn 68,0,17,.Lt_000A-_GG@0
.Lt_000B:
## subredim(1)=0
mov eax, dword ptr [ebp-36]
mov dword ptr [eax+4], 0
.stabn 68,0,18,.Lt_000B-_GG@0
.Lt_000C:
##
## dim as integer subarray(5)
lea eax, [ebp-60]
push eax
push edi
mov edi, eax
xor eax, eax
mov ecx, 6
rep stosd
pop edi
pop eax
lea eax, [ebp-60]
mov dword ptr [ebp-92], eax
lea eax, [ebp-60]
mov dword ptr [ebp-88], eax
mov dword ptr [ebp-84], 24
mov dword ptr [ebp-80], 4
mov dword ptr [ebp-76], 1
mov dword ptr [ebp-72], 6
mov dword ptr [ebp-68], 0
mov dword ptr [ebp-64], 5
.stabn 68,0,20,.Lt_000C-_GG@0
.Lt_000D:
## subarray(1)=1
mov dword ptr [ebp-56], 1
.stabn 68,0,21,.Lt_000D-_GG@0
.Lt_000E:
push 0
lea eax, [ebp-36]
push eax
call _fb_ArrayErase@8
.Lt_0005:
mov esp, ebp
pop ebp
ret
.stabn 68,0,22,.Lt_0005-_GG@0
.stabs "SUBSIMPLE:V1",40,0,0,_Lt_0009
.stabs "SUBREDIM:16=s256data:17=ar1;0;0;18=*1,0,32;ptr:17=ar1;0;0;18=*1,32,32;size:1,64,32;elen:1,96,32;
dims:1,128,32;dim1_elemns:1,160,32;dim1_lbound:1,192,32;dim1_ubound:1,224,32;;1",128,0,0,-36
.stabs "SUBARRAY:19=ar1;0;5;1",128,0,0,-60
.stabn 192,0,0,.Lt_0004-_GG@0
.stabn 224,0,0,.Lt_0005-_GG@0
.Lt_000F:
.stabs "",36,0,0,.Lt_000F-_GG@0
.section .bss
.balign 4
.lcomm _Lt_0009,4
.section .text
.stabs "{MODLEVEL}:f7",36,0,1,_fb_ctor__test2
.balign 16
_fb_ctor__test2:
push ebp
mov ebp, esp
sub esp, 148
.stabn 68,0,1,_fb_ctor__test2-_fb_ctor__test2
.Lt_0002:
.Lt_0016:
##Namespace testing
## End Type
## Type toto
## titi As longint
## Dim As toto tata
##End Namespace
##
##end type
##type tudt
## udt1 as short
## udt2 as ulongint
##
##
##ReDim As testing.toto nsredim(4,7,9)
mov dword ptr [ebp-64], 0
mov dword ptr [ebp-60], 0
mov dword ptr [ebp-56], 8
mov dword ptr [ebp-52], 8
mov dword ptr [ebp-48], 3
lea eax, [ebp-44]
push eax
push edi
mov edi, eax
xor eax, eax
mov ecx, 9
rep stosd
pop edi
pop eax
push 9
push 0
push 7
push 0
push 4
push 0
push 3
push 0
push -1
push 8
lea eax, [ebp-64]
push eax
call _fb_ArrayRedimEx
add esp, 44
.stabn 68,0,24,.Lt_0016-_fb_ctor__test2
.Lt_0017:
##nsredim(0,0,0).titi=12
mov eax, 0
sal eax, 3
add eax, dword ptr [ebp-64]
mov dword ptr [eax], 12
mov dword ptr [eax+4], 0
.stabn 68,0,25,.Lt_0017-_fb_ctor__test2
.Lt_0018:
##
##ReDim shared As testing.toto nsredimshared(4,7,9)
push 9
push 0
push 7
push 0
push 4
push 0
push 3
push 0
push -1
push 8
push offset _Lt_0011
call _fb_ArrayRedimEx
add esp, 44
.stabn 68,0,27,.Lt_0018-_fb_ctor__test2
.Lt_0019:
##nsredimshared(0,0,0).titi=12
mov eax, 0
sal eax, 3
add eax, dword ptr [_Lt_0011]
mov dword ptr [eax], 12
mov dword ptr [eax+4], 0
.stabn 68,0,28,.Lt_0019-_fb_ctor__test2
.Lt_001A:
##
##dim as testing.toto nssimple
mov dword ptr [ebp-72], 0
mov dword ptr [ebp-68], 0
.stabn 68,0,30,.Lt_001A-_fb_ctor__test2
.Lt_001B:
##nssimple.titi=17:print "nssimple";nssimple.titi
mov dword ptr [ebp-72], 17
mov dword ptr [ebp-68], 0
push 0
push 8
push offset _Lt_0012
call _fb_StrAllocTempDescZEx@8
push eax
push 0
call _fb_PrintString@12
push 1
push dword ptr [ebp-68]
push dword ptr [ebp-72]
push 0
call _fb_PrintLongint@16
.stabn 68,0,31,.Lt_001B-_fb_ctor__test2
.Lt_001C:
##
##ReDim Shared As tudt redimshared(7,9)
push 9
push 0
push 7
push 0
push 2
push 0
push -1
push 16
push offset _Lt_0013
call _fb_ArrayRedimEx
add esp, 36
.stabn 68,0,33,.Lt_001C-_fb_ctor__test2
.Lt_001D:
##redimshared(1,1).udt1=12345
mov eax, dword ptr [_Lt_0013+32]
sal eax, 4
add eax, dword ptr [_Lt_0013]
mov word ptr [eax+16], 12345
.stabn 68,0,34,.Lt_001D-_fb_ctor__test2
.Lt_001E:
##
##dim shared as integer sharedarray(7)
##sharedarray(7)=87
mov dword ptr [_SHAREDARRAY+28], 87
.stabn 68,0,37,.Lt_001E-_fb_ctor__test2
.Lt_001F:
##
##dim shared as integer sharedsimple
##sharedsimple=79
mov dword ptr [_SHAREDSIMPLE], 79
.stabn 68,0,40,.Lt_001F-_fb_ctor__test2
.Lt_0020:
##
##dim as integer mainlocal
mov dword ptr [ebp-76], 0
.stabn 68,0,42,.Lt_0020-_fb_ctor__test2
.Lt_0021:
##mainlocal=5
mov dword ptr [ebp-76], 5
.stabn 68,0,43,.Lt_0021-_fb_ctor__test2
.Lt_0022:
##
##dim as integer mainlocalarray(9)
lea eax, [ebp-116]
push eax
push edi
mov edi, eax
xor eax, eax
mov ecx, 10
rep stosd
pop edi
pop eax
lea eax, [ebp-116]
mov dword ptr [ebp-148], eax
lea eax, [ebp-116]
mov dword ptr [ebp-144], eax
mov dword ptr [ebp-140], 40
mov dword ptr [ebp-136], 4
mov dword ptr [ebp-132], 1
mov dword ptr [ebp-128], 10
mov dword ptr [ebp-124], 0
mov dword ptr [ebp-120], 9
.stabn 68,0,45,.Lt_0022-_fb_ctor__test2
.Lt_0023:
##mainlocalarray(9)=77
mov dword ptr [ebp-80], 77
.stabn 68,0,46,.Lt_0023-_fb_ctor__test2
.Lt_0024:
##
##testing.tata.titi=99
mov dword ptr [__ZN7TESTING4TATAE], 99
mov dword ptr [__ZN7TESTING4TATAE+4], 0
.stabn 68,0,48,.Lt_0024-_fb_ctor__test2
.Lt_0025:
##
push 0
lea eax, [ebp-64]
push eax
call _fb_ArrayErase@8
.Lt_0003:
mov esp, ebp
pop ebp
ret
.stabn 68,0,49,.Lt_0003-_fb_ctor__test2
.stabs "TOTO:Tt23=s8TITI:9,0,64;;",128,0,0,0
.stabs "NSREDIM:20=s448data:21=ar1;0;0;ar1;0;0;ar1;0;0;22=*23,0,32;ptr:21=ar1;0;0;ar1;0;0;ar1;0;0;22=*23,32,32;size:1,64,32;elen:1,96,32;
dims:1,128,32;dim1_elemns:1,160,32;dim1_lbound:1,192,32;dim1_ubound:1,224,32;dim1_elemns:1,256,32;dim1_lbound:1,288,32;dim1_ubound:1,320,32;
dim1_elemns:1,352,32;dim1_lbound:1,384,32;dim1_ubound:1,416,32;;23",128,0,0,-64
.stabs "NSSIMPLE:23",128,0,0,-72
.stabs "MAINLOCAL:1",128,0,0,-76
.stabs "MAINLOCALARRAY:24=ar1;0;9;1",128,0,0,-116
.stabn 192,0,0,.Lt_0002-_fb_ctor__test2
.stabn 224,0,0,.Lt_0003-_fb_ctor__test2
.Lt_0026:
.stabs "",36,0,0,.Lt_0026-_fb_ctor__test2
#test2.bas' compilation took 0.1455707359534415 secs
.section .bss
.balign 4
.lcomm __ZN7TESTING4TATAE,8
.stabs "__ZN7TESTING4TATAE:S23",40,0,0,__ZN7TESTING4TATAE
.section .data
.stabs "NSREDIMSHARED:S25=s448data:26=ar1;0;0;ar1;0;0;ar1;0;0;27=*23,0,32;ptr:26=ar1;0;0;ar1;0;0;ar1;0;0;
27=*23,32,32;size:1,64,32;elen:1,96,32;dims:1,128,32;dim1_elemns:1,160,32;dim1_lbound:1,192,32;
dim1_ubound:1,224,32;dim1_elemns:1,256,32;dim1_lbound:1,288,32;dim1_ubound:1,320,32;
dim1_elemns:1,352,32;dim1_lbound:1,384,32;dim1_ubound:1,416,32;;23",38,0,0,_Lt_0011
.balign 4
_Lt_0011:
.long 0
.long 0
.int 8
.int 8
.int 3
.skip 36,0
.balign 4
_Lt_0012: .ascii "nssimple\0"
.stabs "TUDT:Tt31=s16UDT1:5,0,16;UDT2:10,64,64;;",128,0,0,0
.stabs "REDIMSHARED:S28=s352data:29=ar1;0;0;ar1;0;0;30=*31,0,32;ptr:29=ar1;0;0;ar1;0;0;30=*31,32,32;size:1,64,32;elen:1,96,32;dims:1,128,32;
dim1_elemns:1,160,32;dim1_lbound:1,192,32;dim1_ubound:1,224,32;dim1_elemns:1,256,32;dim1_lbound:1,288,32;dim1_ubound:1,320,32;;31",38,0,0,_Lt_0013
.balign 4
_Lt_0013:
.long 0
.long 0
.int 16
.int 16
.int 2
.skip 24,0
.section .bss
.balign 4
.lcomm _SHAREDARRAY,32
.stabs "SHAREDARRAY:S32=ar1;0;7;1",40,0,0,_SHAREDARRAY
.balign 4
.lcomm _SHAREDSIMPLE,4
.stabs "SHAREDSIMPLE:S1",40,0,0,_SHAREDSIMPLE
.section .ctors
.int _fb_ctor__test2
.section .text
.stabs "",100,0,0,.Lt_0027
.Lt_0027:
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
Thanks.
The compiler is globally complicated and without any documentation it's really a pain for understanding how it works. I spent a lot of time trying to understand only the stabs emiter and the variables management.
As the solution is just a workaround I agree to spend a bit of time to find a best way but what will become the current stabs informations with the use of GCC ?
The compiler is globally complicated and without any documentation it's really a pain for understanding how it works. I spent a lot of time trying to understand only the stabs emiter and the variables management.
As the solution is just a workaround I agree to spend a bit of time to find a best way but what will become the current stabs informations with the use of GCC ?