Skip to content

Commit

Permalink
Complement to Fix for debugging lines in include files but not in pro…
Browse files Browse the repository at this point in the history
…cedures
  • Loading branch information
SARG-FB authored and jayrm committed Sep 13, 2018
1 parent f697fba commit 0f2a7c8
Showing 1 changed file with 20 additions and 35 deletions.
55 changes: 20 additions & 35 deletions src/compiler/edbg_stab.bas
Expand Up @@ -214,7 +214,11 @@ sub edbgEmitHeader( byval filename as zstring ptr )
ctx.typecnt = 1
ctx.label = NULL
ctx.incfile = NULL
ctx.filename = *filename
#If defined( __FB_WIN32__ ) or defined( __FB_DOS__ )
ctx.filename = UCase(*filename)
#Else
ctx.filename = *filename
#EndIf

'' emit source file name
lname = *symbUniqueLabel( )
Expand All @@ -240,7 +244,6 @@ sub edbgEmitHeader( byval filename as zstring ptr )

emitWriteStr( "" )

hEmitSTABS( STAB_TYPE_BINCL, filename, 0, 0 )
end sub

'':::::
Expand Down Expand Up @@ -1018,40 +1021,22 @@ end sub
sub edbgInclude( byval incfile as zstring ptr )
dim as string lname

'' incfile is the new include file for which we should open a block.
'' incfile can be NULL to indicate that no next include file is coming,
'' in which case we just want to return to the toplevel .bas file name,
'' if we previously opened an include file block.
'' incfile is the new include file or main file name

'' Already in the correct block?
'' (same include file, or NULL for toplevel)
if( incfile = ctx.incfile ) then
exit sub
end if

'' Currently in an include file block?
if( ctx.incfile ) then
'' Close it
hEmitSTABS( STAB_TYPE_EINCL, "", 0, 0 )

'' "Return" to the main filename, if no new include file block
'' will be opened
if( incfile = NULL ) then
emitSECTION( IR_SECTION_CODE, 0 )
lname = *symbUniqueLabel( )
hEmitSTABS( STAB_TYPE_SOL, ctx.filename, 0, 0, lname )
hLABEL( lname )
end if
end if
'' coming from _close incfile is null so no real need to change
If( incfile = NULL )Then
Exit Sub
EndIf

ctx.incfile = incfile
'' Already handling the correct name
if( incfile = ctx.incfile ) Then
exit sub
end If

emitSECTION( IR_SECTION_CODE, 0 )
lname = *symbUniqueLabel( )
hEmitSTABS( STAB_TYPE_SOL, incfile, 0, 0, lname )
hLABEL( lname )

'' Open new include file block if needed
if( incfile ) then
hEmitSTABS( STAB_TYPE_BINCL, incfile, 0, 0 )
emitSECTION( IR_SECTION_CODE, 0 )
lname = *symbUniqueLabel( )
hEmitSTABS( STAB_TYPE_SOL, incfile, 0, 0, lname )
hLABEL( lname )
end if
ctx.incfile = incfile
end sub

0 comments on commit 0f2a7c8

Please sign in to comment.