What are the limits of the debug system in ObjAsm32?

I created a bare bones project like this

include \masm32\ObjAsm32\code\macros\model.inc
SysSetup OOP_NONE, DBG(WND)

.code
start:
SysInit

include Project1.inc

SysDone

invoke ExitProcess, 0

end start


Project1.inc contains 2000 copies of the following line:

DbgWarning "Warning","DbgDest"



At assembly time a number of errors occur like this:

Project1_Calls2.inc(923) : error A2008: syntax error : typedef
$ConvEscSeqs(4): Macro Called From
好bsp; $OfsCStrX(4): Macro Called From
好bsp; 好bsp;MacroLoop(2): iteration 1: Macro Called From
好bsp; 好bsp; @invoke(11): Macro Called From
好bsp; 好bsp; 好bsp;DbgWarning(15): Macro Called From
好bsp; 好bsp; 好bsp; Project1_Calls2.inc(923): Include File


I changed the 2000 lines in Project1.inc to:

DbgWarning "Warning"


Now the errors look like this:

Project1_Calls2.inc(1724) : error A2008: syntax error : typedef
$ConvEscSeqs(4): Macro Called From
好bsp; $OfsCStrX(4): Macro Called From
好bsp; 好bsp;MacroLoop(2): iteration 1: Macro Called From
好bsp; 好bsp; @invoke(11): Macro Called From
好bsp; 好bsp; 好bsp;DbgWarning(15): Macro Called From
好bsp; 好bsp; 好bsp; Project1_Calls2.inc(1724): Include File


So: Explicitly naming the output window the first error occurs at the 923th DbgWarning macro.
But: Without naming the output window the first error I get is at the 1724th DbgWarning macro.

Have we reached the limits of the Debug system here?
Or is it possible to extend the possibilities?

Friendly regards,
mdevries.
Posted on 2006-07-05 16:03:01 by mdevries
That's quite interesting.
Offhand I'm going to guess that this is a limitation imposed by masm's macro engine.
I assure you that if you do the same thing programatically it works eg

xor ecx,ecx
.while ecx<2000
DbgWarning "heh","hee"
inc ecx
.endw


but if you try to do it via conditional assembly it fails eg

sillymacro macro blah:VARARG
i=0
while i<2000
blah
i=i+1
endm
endm

.code
start:
SysInit

sillymacro DbgWarning "Warning","DbgDest"

SysDone


Looking through the debug framework I see no particular reason why, so again I suggest that this is an artefact of ML.EXE
I've used thousands of debug lines without encountering this problem before, perhaps Biterider can spot the issue.. but really, you have to admit that this is not a typical scenario.
Just out of curiosity, try the same thing with DbgText and let me know if the same thing happens.
Posted on 2006-07-05 23:33:02 by Homer
The same thing happens when you use DbgText.

I know this is a silly program, but I reached the limit in an other program in which I used many different DbgText an DbgWarning code lines.
I couldn't figure out what was wrong when I got an error on a certain moment.
So I thought I must have reached the limits of the Debug system.
I decided to test it in the way I showed you. Yust to quantify the problem.

As you say: Maybe we didn't reach the limits of the Debug system, but the limits of ML.EXE.

I am curious what Biterider has to say on this issue.

Friendly regards,
mdevries.
Posted on 2006-07-06 00:41:45 by mdevries
Hi mdevries
As Homer said before, it is a flaw of ML that I found when programs become bigger. The reason is that MASM doesnt release local symbols within macros. The obvious consequence is that the symbol database is growing and growing until it reaches its limit of 2^16 (65536) entries. Now the second bug is that it is not reported as such no ML tries to override previous symbols starting at the beginning of the database.
I noted this behaviour some time ago while I was writing bigger apps and some annoying error were reported on lines that were error free before.
Fortunately I found a workaround. I reuse myself the internal symbols I need for ObjAsm32 (20-30 symbols that now start with ??xxxx). As a side effect, the compilation time was speedup considerably since the database is kept small compared with the situation we have before.
Currently I have made the work and wanted to release it as version 1.4, but you can try it out installing the attached files. To compile correctly you need the new Primer.inc. If you are using LoadObjects macro, recompile all objects using the MakeObjects.bat batch file in the Objects directory.

Regards,

Biterider
Attachments:
Posted on 2006-07-06 03:49:33 by Biterider
This is great feedback for me, since I'm currently working on a new compiler/assembler which will make ML.exe obselete :)
I'm not willing to say too much about it since its early days and I'm miles away from a working beta, suffice to say that the other Moderators are aware of it and are able to follow my progress.
Posted on 2006-07-06 04:26:59 by Homer
Thanks for your comments and the update.
I encountered two problems after the update.

Using the MakeObjs.bat file none of the objects were made.
For every object I got error messages like this:

 Assembling: Array.asm
C:\Masm32\ObjAsm32\Code\Objects\ObjErrs.inc(15) : error A2006: undefined symbol : DEBUGGING
RegErrMsg(1): Macro Called From
?  C:\Masm32\ObjAsm32\Code\Objects\ObjErrs.inc(15): Include File


The second problem was when I recompiled existing projects.
I got error messages like this:

C:\Masm32\ObjAsm32\Code\Objects\ObjErrs.inc(83) : error A2006: undefined symbol : ??ObjErrTableCount
RegErrMsg(7): Macro Called From
?  C:\Masm32\ObjAsm32\Code\Objects\ObjErrs.inc(15): Include File


Your attached zip-file contained the following 5 files:
- Objects.inc
- Primer.asm
- Primer.inc
- ObjIDs.inc
- ObjErrs.inc

I quess something must be missing?

Friendly regards,
mdevries.
Posted on 2006-07-06 09:24:34 by mdevries
I guess that I forgot to add 2 additional files that were also altered to support the changes I described before. These files are Model.inc and Objects.cop. Especially this last file is important since it defines all C???ompilation OP???tions for the object contained in the Objects folder. I added these 2 files to the Update.zip file of the previous post. I hope it works now  ;)

Biterider
Posted on 2006-07-06 13:01:05 by Biterider
Hi BiteRider,

I updated the two extra files.
Now some object assemble, and others don't.

In the attached file you can see the error messages.

Friendly regards,
mdevries.
Attachments:
Posted on 2006-07-06 17:29:29 by mdevries
Hi mdevries
From the listing you post, I see that ICall fails. I added the new ICall macro to the above zip file.

Biterider
Posted on 2006-07-07 00:33:26 by Biterider
Hi Biterider,

That does part of the job. But I still have errors. (See attached file)

I also compiled the barebones project I started this thread with.
This resulted in the following errors:

C:\Masm32\ObjAsm32\Code\Objects\Primer.inc(105) : error A2006: undefined symbol : pObjIDTableStart
C:\Masm32\ObjAsm32\Code\Objects\Primer.inc(116) : error A2006: undefined symbol : dObjIDTableCount
C:\Masm32\ObjAsm32\Code\Objects\Primer.inc(122) : error A2006: undefined symbol : pObjErrTableStart
C:\Masm32\ObjAsm32\Code\Objects\Primer.inc(133) : error A2006: undefined symbol : dObjErrTableCount
Project1.asm(72) : error A2006: undefined symbol : pObjErrTableStart
SysInit(9): Macro Called From
  Project1.asm(72): Main Line Code
Project1.asm(72) : error A2006: undefined symbol : dObjErrTableCount
SysInit(10): Macro Called From
  Project1.asm(72): Main Line Code
Project1.asm(72) : error A2006: undefined symbol : pObjIDTableStart
SysInit(11): Macro Called From
  Project1.asm(72): Main Line Code
Project1.asm(72) : error A2006: undefined symbol : dObjIDTableCount
SysInit(12): Macro Called From
  Project1.asm(72): Main Line Code


Friendly regards,
mdevries
Attachments:
Posted on 2006-07-07 01:16:52 by mdevries
Hi mdevries
OK, now I think we will get it :)

The missing definitions are in the Debug.inc file I added to the zip file. I added some other files too in case that there are affected by the changes.

The compilation problems are now reduced to 2 little things:
1. There is a wrong definition of the VarBstrFromDate api in the OleAut32.inc file from the MASM32 package. Change it to the following proto:
VarBstrFromDate PROTO :REAL8,:DWORD,:DWORD,:DWORD
2. The second problem is a line size issue in the SkinnedMsgBox.Init Method. Try to reduce the line size to something like this:
Method SkinnedMsgBox.Init, uses esi, pOwner:Pointer,   hParentWnd:Handle, dTtlResID:dword, \
dMsgResID:dword, pGifResName:Pointer, \
pBtn1ResName:Pointer, dBtn1ID:dword, \
pBtn2ResName:Pointer, dBtn2ID:dword, \
pBtn3ResName:Pointer, dBtn3ID:dword

Regards,

Biterider
Posted on 2006-07-07 08:35:53 by Biterider
We are a few steps further again.

After installing the files you added to the zip-file, I was able to build the bare bones project. It assembles fine now.

And now the results of the update are becoming visible:
In my first post I mentioned the debug system produced an error on the 923th line, in case I added the name of the output window.
After the update I can have more than 13.000 DbgWarning or DbgText lines before the first error occurs. That's quite an improvement!! Thanks Biterider.
I'm glad you encountered the problem in bigger programs too! Otherwise we wouldn't have been that far now.

1. There is a wrong definition of the VarBstrFromDate api in the OleAut32.inc file from the MASM32 package. Change it to the following proto:
VarBstrFromDate PROTO :REAL8,:DWORD,:DWORD,:DWORD


I updated OleAut32.inc.
The error message related to it is gone now.

2. The second problem is a line size issue in the SkinnedMsgBox.Init Method. Try to reduce the line size to something like this:


About your second suggestion:
The line in SkinnedMsgBox.inc looks already just like you suggested.
I even removed the leading spaces. But it doesn't work.
So I can't get SkinnedMsgBox to work (assembled).

Friendly regards,
mdevries.
Posted on 2006-07-07 11:48:04 by mdevries
Try to replace the SkinnedMsgBox.init method with the following lines (copy and paste them):

Method SkinnedMsgBox.Init, uses esi, pOwner:Pointer, hParentWnd:Handle, \
        dTtlID:dword, dMsgID:dword, pGifName:Pointer, \
        pBtn1Name:Pointer, dBtn1ID:dword, \
        pBtn2Name:Pointer, dBtn2ID:dword, \
        pBtn3Name:Pointer, dBtn3ID:dword
    local bBuffer[1024]:byte

    SetObject esi
    ACall esi.Init, pOwner, hParentWnd, "SkinnedMsgBox"
    invoke LoadString, hInstance, dTtlID, addr bBuffer, sizeof bBuffer
    mov .pCaptionText, $invoke(StrNew, addr bBuffer)
    invoke LoadString, hInstance, dMsgID, addr bBuffer, sizeof bBuffer
    mov .pMessageText, $invoke(StrNew, addr bBuffer)

    m2m .pBtn1ResName, pBtn1Name
    m2m .dBtn1ID, dBtn1ID
    m2m .pBtn2ResName, pBtn2Name
    m2m .dBtn2ID, dBtn2ID
    m2m .pBtn3ResName, pBtn3Name
    m2m .dBtn3ID, dBtn3ID
    m2m .pGifResName, pGifName
MethodEnd


I think it should compile correctly now  ;)

Biterider
Posted on 2006-07-07 15:52:02 by Biterider
Hi Biterider,

I copied and pasted your text, and it compiles ok now. Thanks for the update.

Just to be sure I had all object now I compared the created LIB-files in the LIB directory with the ASM and INC files in the OBJECTS directory.

I noticed some Inc files that didn't have an asm file. So: A corresponding LIB file can't be created.
If they are to be used as a LIB file, a corresponding ASM file should be added, and the creation of the objects should be added to the MakeObjs.bat file:

D3Camera.inc
D3Light.inc
D3Math.inc
D3Object.inc
D3Scene.inc
D3Triangle.inc
D3VectronCollection.inc
SkinnedModalDialog.inc


Some objects do have a corresponding ASM file, but MakeObjs.bat doesn't mention them. So, for those object no LIB files are created. Again: If they are to be used as a LIB file they should be added to the MakeObjs.bat file too:

CAD_DialogSetup.asm
EditStream.asm
RA_Float.asm
RA_MethodSetup.asm
RA_TextSource.asm


Maybe for the next release?
Just in case you didn't have noticed it yourself...

Friendly regards,
mdevries.
Posted on 2006-07-08 06:51:54 by mdevries
Hi mdevries

The files D3xxx.inc are implementations of objects contained in the D3Engine.inc file. The compilation file is D3Engine.asm. This must be this way, since all these objects work together and need to know about the structure of each other. Another way to do it is using VirtualObjects or playing with the compilation switches, but I prefer to do it this way.

SkinnedModalDialog.asm is a relict, you can delete it.
All CAD_xxx are files from my own that should not be in the package.

EditStream and the RA_xxx objects are erroneously not included in MakeObjects.bat file.

I updated the zip file to include and update some files.

If you find any other issue, please dont hesitate to write it.

Regards,

Biterider
Posted on 2006-07-09 07:32:16 by Biterider
Hi Biterider,

The new MakeObjs.bat searches for Demo01.asm which is not in the Objects directory. The error message is:

MASM : fatal error A1000: cannot open file : Demo01.asm


And EditStream gives the following error messages.
In fact it's only one: EditStreamID is missing.

C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(20) : error A2006: undefined symbol : EditStreamID
MacroLoop(1): iteration 1: Macro Called From
  Object(7): Macro Called From
  C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(20): Include File
C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(20) : error A2006: undefined symbol : EditStreamID
MacroLoop(1): iteration 2: Macro Called From
  Object(7): Macro Called From
  C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(20): Include File
C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(20) : error A2006: undefined symbol : EditStreamID
MacroLoop(1): iteration 3: Macro Called From
  Object(7): Macro Called From
  C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(20): Include File
C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(19) : error A2006: undefined symbol : EditStreamID
Object(9): Macro Called From
  C:\Masm32\ObjAsm32\Code\Objects\EditStream.inc(20): Include File


Friendly regards,
mdevries.
Posted on 2006-07-09 09:13:50 by mdevries
zip updated.

Biterider
Posted on 2006-07-09 10:09:25 by Biterider
Thanks. Everything assembles fine now.

Friendly regards,
mdevries.
Posted on 2006-07-09 10:25:32 by mdevries