JWasm version v2.0 now really beta

Started by japheth, August 26, 2009, 04:46:35 PM

Previous topic - Next topic

japheth


Hello,

JWasm v2 beta was announced 14 days ago, but in the meantime another feature has been implemented: symbolic debugging info is now created, that is, cmdline options -Zd and -Zi are supported.

So JWasm now is - really - beta and the new features are:

-  64bit support for COFF and ELF ( -win64 and -elf64 )
-  Win64 SEH support
-  .SAFESEH supported for Win32
-  symbolic debugging info for OMF and COFF


Jimg

I've been waiting impatiently for better debug support, thank you.

Unfortunately, I'm getting the following problem when I link-

F:\masm32\BIN\ML /c /coff /Cp /Zi /Zd /I"F:\masm32\INCLUDE" "F:\JWasm\urltest\UrlTest.asm"

JWasm v2.00pre, Aug 24 2009, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

F:\JWasm\urltest\UrlTest.asm: 38 lines, 3 passes, 141 ms, 0 warnings, 0 errors

F:\masm32\BIN\Link @"F:\JWasm\urltest\link.war"

Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /INCREMENTAL:NO "/LIBPATH:F:\masm32\LIB" "F:\JWasm\urltest\UrlTest.obj" "/OUT:F:\JWasm\urltest\UrlTest.exe"
UrlTest.obj : warning LNK4200: corrupt line number information in object file; ignored


It's only a warning, but it keep the program from running automatically.

Again, unfortunately, it includes my ugly printx macro, and I can't seem to pin down the problem.

The stripped down main code looks like-
include Printx.inc
.list
Program:
    invoke ExitProcess,0
    ret
   
WndProc Proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
    .if uMsg==WM_COMMAND
        .if wParam==2010
        .endif
    .elseif uMsg==WM_CREATE
        printx addr xbuff, /,"lParam (return value)=",dd lParam," ",hx lParam,/,"wParam (flag)=",dd wParam
        msgx
    .endif
    ret
WndProc EndP

End Program

if I comment out the .if wParam==2010/.endif, it works, so I think it's something internally getting confused due the messy macro.

No problem if in regular mode, only in debug.





japheth


JWasm wrote line number debug info for lines inside macros. This confused the linker a lot.

Now macro lines are filtered and it works better, but I'll have to find out how to write a line number debug info for the macro invokation itself.

dedndave

i was just playing with that in MASM
the @Line directive (equate to be more correct) gives the line the macro is called from, no matter where it appears in the macro
as it turns out, that was what i really wanted
if you want to know where to go in the source file - you want it to point to the line where the macro was called

drizz

first of all thank you for all the work you have done making jwasm a TOP ASSEMBLER!

one thing about x64 code...
you use "and rsp,-16" in your samples, and correct me if im wrong, but if the proc uses "uses reg1 reg2" wouldn't this make the order of registers that are popped in epilogue wrong (assuming rsp was not aligned after prologue) ?
Shouldn't the stack be aligned automatically by including extra  with add rsp,-8 if neccessary ?

The truth cannot be learned ... it can only be recognized.

japheth


Hello,

a new version was uploaded. It should fix the printx problem.

There was also indeed a problem with the @Line symbol, which returned the macro line no inside macros.

Quote
you use "and rsp,-16" in your samples, and correct me if im wrong, but if the proc uses "uses reg1 reg2" wouldn't this make the order of registers that are popped in epilogue wrong (assuming rsp was not aligned after prologue) ?

True. However, I used this "and rsp,-16" in 1 sample only, and in this sample "uses ..." isn't used.

Quote
Shouldn't the stack be aligned automatically by including extra  with add rsp,-8 if neccessary ?

It should, but ML64.EXE doesn't, so I think JWasm shouldn't also. Automatic Stack alignment is implemented for frame procs if the OPTION FRAME directive is set.



jj2007

This works in ml v9.0 but fails in 2.0:

; JWasm: Error! E071: Operand is expected;  Erase(2)[Tmp_File.asm]: Macro called from Tmp_File.asm(720)
Erase MyA$()


The brackets in opattr seem to be a problem for JWasm:

Erase MACRO arrId
LOCAL oa, is, tmp$
oa = (opattr(arrId)) AND 127
  if oa eq 36
push arrId
  else
  is INSTR <arrId>, <(>
@CatStr(<Dim >, @SubStr(<arrId>, 1, is), <-123>, @SubStr(<arrId>, is+1))
@CatStr(<push >, @SubStr(<arrId>, 1, is), <id>, @SubStr(<arrId>, is+1))
  endif
  call MbArrayErase
ENDM


BlackVortex

What in the ...

You and your weirdo macros    :cheekygreen:

japheth

Hi JJ,

Quote from: jj2007 on September 04, 2009, 06:22:38 PM
This works in ml v9.0 but fails in 2.0:

Erase MACRO arrId
LOCAL oa, is, tmp$
oa = (opattr(arrId)) AND 127
  if oa eq 36
push arrId
  else
  is INSTR <arrId>, <(>
@CatStr(<Dim >, @SubStr(<arrId>, 1, is), <-123>, @SubStr(<arrId>, is+1))
@CatStr(<push >, @SubStr(<arrId>, 1, is), <id>, @SubStr(<arrId>, is+1))
  endif
  call MbArrayErase
ENDM



Please tell how this macro is supposed to be invoked! Or even better, supply a valid test case!

jj2007

Quote from: japheth on September 05, 2009, 11:37:09 AM
Or even better, supply a valid test case!

I'll do my best :bg
Output in MASM:
String 2: The second string
Erasing My$()
Erase error: NoSuch$() has never been defined
String 2: My$() array erased, sorry


; CONSOLE Assembly
include \masm32\include\masm32rt.inc

Erase MACRO arrId
LOCAL oa, is, tmp$

tmp$ CATSTR <Trying to erase >, <arrId>
% echo tmp$

oa = (opattr(arrId)) AND 127

  if oa eq 38 ;; an offset
  print "Erasing "
print arrId, 13, 10
  else
print "Erase error: "
print chr$("&arrId&"), " has never been defined", 13, 10
  endif
ENDM

My$ MACRO arg
  ifb <arg>
mov Strings, 0
EXITM <offset MyName>
  else
  .if Strings
mov eax, [Strings+4*arg+4]
.else
mov eax, offset Erased
.endif
EXITM <eax>
  endif
ENDM

.data
Strings dd 4, S0, S1, S2, S3
S0 db "Element zero", 0
S1 db "The first string", 0
S2 db "The second string", 0
S3 db "The third string", 0
Erased db "My$() array erased, sorry", 0
MyName db "My$()", 0

.code
start:
print "String 2: "
print My$(2), 13, 10
Erase My$()
Erase NoSuch$()
print "String 2: "
print My$(2), 13, 10
invoke ExitProcess, 0

end start

japheth


Ok,

OPATTR(NoSuch$())

is accepted now.

jj2007

Quote from: japheth on September 07, 2009, 01:28:36 PM

OPATTR(NoSuch$())

is accepted now.


Works like a charm, thanks a lot. It assembles also about 40% faster than Masm - compliments!

One minor difference:
JWASM
Address               Hex dump                       Command
0040287D              .0F86 7F000000                jbe 00402902
...
00402902

MASM
Address               Hex dump                       Command
0040287D              .76 7F                        jbe short 004028FE
...
004028FE


Is it possible that the decision to use a long jmp does not take account that the short jmp is 4 bytes shorter...?

In any case: Kudos for your fantastic work :U

Jimg

Thank you Japeth.  I no longer have to go back to masm for a debug session.  Much appreciated.  All the problems I have found except one have been fixed.
Now the only time I need to use masm is to get a listing, but I can understand why listing control would be low in your priorities.

japheth


Good!

There's now also a jwasm.rules included which is meant for MS VS EE integration. I stole this idea from the Yasm project. And even better, I created a Multimedia Show :eek at http://www.japheth.de/JWasm/JWasmVS.html to show how this file is supposed to be used.

Ficko

Quote from: japheth on September 08, 2009, 06:28:07 PM

Good!

There's now also a jwasm.rules included which is meant for MS VS EE integration. I stole this idea from the Yasm project. And even better, I created a Multimedia Show :eek at http://www.japheth.de/JWasm/JWasmVS.html to show how this file is supposed to be used.

Thanks that's cool! :U

And how can you make some syntax highlighting in VS ?? ::) :bg