Author Topic: Bad file names in errors messages.  (Read 382 times)

HSE

  • Member
  • ****
  • Posts: 544
  • <AMD>< 7-32>
Bad file names in errors messages.
« on: June 20, 2017, 04:07:02 AM »
Hi Nidud!

Not a very critical issue, but sometimes is a little boring.

Its very difficult to make that JWasm derivatives report correct filenames when a error is detected?

(Of course you don't know that this error exist  :biggrin: )

EDIT: Apparently happen when error is inside a macro, and the line number is correct.

nidud

  • Member
  • *****
  • Posts: 1385
    • https://github.com/nidud/asmc
Re: Bad file names in errors messages.
« Reply #1 on: June 20, 2017, 06:44:47 AM »
There are a more than hundred files dedicated to test error output in the regression test, however none of them test included files. Not sure what you actually mean but lets assume the following:
Code: [Select]
; test.asm - extern macro error
;
include macro.inc

    .386
    .model flat
    .code

    mov edx,line_error(5)

    end

macro.inc:
Code: [Select]

line_error macro line

    mov ax,line
    mov eax,ax  ; test.asm(9) : error A2022: instruction operands must be the same size : 4 - 2
    exitm<eax>
    endm

    xor eax,eax ; macro.inc(9) : error A2034: must be in segment block

test.err:
Code: [Select]
C:\Asmc\source\asmc\macro.inc(9) : error A2034: must be in segment block
 C:\Asmc\source\asmc\macro.inc(9): Included by
  C:\Asmc\source\asmc\test.asm(3): Main line code
C:\Asmc\source\asmc\test.asm(9) : error A2022: instruction operands must be the same size : 4 - 2
 line_error(3)[macro.inc]: Macro called from
  C:\Asmc\source\asmc\test.asm(9): Main line code

So the macro will produce an error where it's expanded but in addition also the macro-line and filename where the macro is declared. The same logic as in Masm:
Code: [Select]
C:\Asmc\source\asmc\macro.inc(9) : error A2085: instruction or register not accepted in current CPU mode
C:\Asmc\source\asmc\test.asm(8) : error A2022: instruction operands must be the same size
 line_error(3): Macro Called From
  C:\Asmc\source\asmc\test.asm(8): Main Line Code

HSE

  • Member
  • ****
  • Posts: 544
  • <AMD>< 7-32>
Re: Bad file names in errors messages.
« Reply #2 on: June 20, 2017, 07:37:32 AM »
Making a mistake in file BMPStatic.inc:
Code: [Select]
LOWORD MACRO bigword ;; Retrieves the low word from double word argument
mov eax,bigword2
and eax,0FFFFh ;; Set to low word
ENDM

Code: [Select]
MathArtH.asm(201) : error A2006: undefined symbol : bigword2

201 is the line in BMPStatic.inc where the macro is used.

ML miss the line:
Code: [Select]
.\Controls\BMPStatic.inc(202) : error A2006: undefined symbol : bigword2
 LOWORD(2): Macro Called From
  .\Controls\BMPStatic.inc(202): Include File

Because RadAsm read the line of the first error, send me to that file  ::)

nidud

  • Member
  • *****
  • Posts: 1385
    • https://github.com/nidud/asmc
Re: Bad file names in errors messages.
« Reply #3 on: June 20, 2017, 08:56:09 AM »
Well, that's definitely a bug. I managed to recreate it by moving the model definition to the include file.
Code: [Select]
include macro.inc

    end

Code: [Select]
    .386
    .model flat
    .code


line_error macro line

    mov ax,line1
    exitm<eax>
    endm

    mov edx,line_error(5)

Code: [Select]
C:\Asmc\source\asmc\test.asm(12) : error A2006: undefined symbol : line1

HSE

  • Member
  • ****
  • Posts: 544
  • <AMD>< 7-32>
Re: Bad file names in errors messages.
« Reply #4 on: June 20, 2017, 10:20:10 AM »
Something in that way.

Extracting from Model.inc options and  pasting in MatArtH.asm nothing change, but if I declare a code segment:
Code: [Select]
option casemap:none                                     ;Case sensitive
option dotname                                          ;Enable dot names
.686p                                                   ;Use 686 protected mode
.mmx                                                    ;Enable MMX instructions
.xmm                                                    ;Enable SSE instruc. (MASM 6.15 or higher)
.model flat, stdcall                                    ;Memory model = flat, use StdCall as default
.code
nop

%include @Environ(OA32_PATH)\\Code\\Macros\\Model.inc
Now:
Code: [Select]
\masm32\ObjAsm32\\Code\\Macros\\Model.inc(200) : error A2006: undefined symbol : bigword2

EDIT: now say 200 because I erase a line :biggrin:

nidud

  • Member
  • *****
  • Posts: 1385
    • https://github.com/nidud/asmc
Re: Bad file names in errors messages.
« Reply #5 on: June 20, 2017, 09:38:48 PM »
I provided a quick fix by removing a hack in the line_item structure. The source file index was used for signaling macro lines so I added a new member for that.

Code: [Select]
C:\Asmc\source\asmc\macro.inc(12) : error A2006: undefined symbol : line1

HSE

  • Member
  • ****
  • Posts: 544
  • <AMD>< 7-32>
Re: Bad file names in errors messages.
« Reply #6 on: June 21, 2017, 02:01:11 AM »
Perfect :t
Code: [Select]
.\Controls\BMPStatic.inc(200) : error A2006: undefined symbol : bigword2
Very, very clear your modifications!!... Well... at least this 2 lines:
Code: [Select]
+#define ASMC_VERSSTR "2.25"

+ "Asmc Macro Assembler Version " ASMC_VERSSTR "A\n"
:biggrin: Thanks!!

EDIT: It's perfect for me because usually I work the macro in the same file in which is first used. Perhaps in some future the ideal is the error pointing to the real macro position.