Menu

Debugging with JWasm/JWlink

cinolt
2012-08-01
2013-04-20
  • cinolt

    cinolt - 2012-08-01

    I'm trying to debug a program assembled and linked with JWasm/JWlink using the debugger WinDbg on the x86-64 Windows 7 platform. I assume that I need to include certain command-line options to enable debugging with symbols and the source code. This is how I compiled/linked my program:

    jwasm -I\WinInc202\Include -Zd -Zi -win64 a.asm
    jwlink form win pe libp \WinInc202\Lib\x64 d c ru win f a.obj
    

    And this is the output I get:

    JWasm v2.07a, Jul 21 2012, Masm-compatible assembler.
    Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
    Source code is available under the Sybase Open Watcom Public License.
    a.asm: 60 lines, 2 passes, 234 ms, 0 warnings, 0 errors
    JWlink Version 1.9
    Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
    Source code is available under the Sybase Open Watcom Public License.
    loading object files
    unknown reloc type 0 at .debug$S:7479
    Error! E2015: file a.obj(a.asm): bad relocation type specified
    unknown reloc type 0 at .debug$S:7567
    Error! E2015: file a.obj(a.asm): bad relocation type specified
    unknown reloc type 0 at .debug$S:8AEF
    Error! E2015: file a.obj(a.asm): bad relocation type specified
    unknown reloc type 0 at .debug$S:8C4D
    Error! E2015: file a.obj(a.asm): bad relocation type specified
    unknown reloc type 0 at .debug$S:A7C6
    Error! E2015: file a.obj(a.asm): bad relocation type specified
    

    It assembles fine but it gives the above error messages when linking. I appreciate any help.

     
  • cinolt

    cinolt - 2012-08-01

    Also, here is the source code if needed:

    ;Windows 7 x86-64
    ;Compiled with "jwasm -I\WinInc202\Include -Zd -Zi -win64 a.asm"
    option casemap:none
    ;WIN32_LEAN_AND_MEAN equ 1
    include windows.inc
    include winuser.inc
    includelib kernel32.lib
    includelib user32.lib
    .const
    ClassName db "aWinClass",0
    AppName db "a",0
    .data
    .data?
    ghWnd HWND ?
    .code
    WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
        invoke DefWindowProc,hWnd,uMsg,wParam,lParam
        ret
    WndProc endp
    Start proc
        local hinst:HINSTANCE
        local wc:WNDCLASS
        int 3h
        mov wc.style,0
        mov rax,offset WndProc
        mov wc.lpfnWndProc,rax
        mov wc.cbClsExtra,NULL
        mov wc.cbWndExtra,NULL
        invoke GetModuleHandle,NULL
        mov hinst,rax
        mov wc.hInstance,rax
        invoke LoadIcon,NULL,IDI_APPLICATION
        mov wc.hIcon,rax
        invoke LoadCursor,NULL,IDC_ARROW
        mov wc.hCursor,rax
        mov wc.hbrBackground,COLOR_WINDOW+1
        mov wc.lpszMenuName,NULL
        mov rax,offset ClassName
        mov wc.lpszClassName,rax
        invoke RegisterClass,addr wc
        ;invoke CreateWindowEx,0,offset ClassName,offset AppName,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,128,128,NULL,NULL,hinst,NULL
        ;mov ghWnd,rax
        ;invoke ShowWindow,rax,SW_SHOWNORMAL
        ;invoke UpdateWindow,rax
        ;invoke Sleep,2000
        invoke ExitProcess,0
    Start endp
    end Start
    
     
  • japheth

    japheth - 2012-08-01

    Symbolic debugging info for Win64 ( aka CodeView V8 ) isn't implemented yet.

    It looks like jwasm tries to write the old CV4 info for 64-bit, but this is useless, because no linker will be able to handle it (including jwlink).

     
  • cinolt

    cinolt - 2012-08-01

    Ah, that's a shame. Are there plans to implement symbolic debugging for Win64 any time soon?

     
  • japheth

    japheth - 2012-08-01

    > Are there plans to implement symbolic debugging for Win64 any time soon?

    Yes, there are plans to implement it "any time soon". That's the good news. The not so good news is that the plans exist now for 2 years and virtually nothing has happened yet. The problem is: I don't need this feature - hence my interest is low.

     
  • japheth

    japheth - 2012-11-04

    > Symbolic debugging info for Win64 ( aka CodeView V8 ) isn't implemented yet.

    This is only partially true. Codeview 8 debugging info isn't implemented, but this format isn't really required for 64-bit symbolic debugging. I tried with JWasm's CV4 info and WinDbg 6.12 and had no problems with symbolic debugging on 64-bit Windows 7.

     

Log in to post a comment.