flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [bug] listing tool segfault (from fasm 1.73.32)

Author
Thread Post new topic Reply to topic
dunkaist



Joined: 31 Jul 2015
Posts: 24
dunkaist 16 Jan 2024, 23:11
Hi Tomasz,

Here is the minimized example that crashes the listing tool.
Code:
$ cat pew.asm 
db 0,1

repeat 2
  load a byte from %-1
  if a = 1
    break
  end if
  db a
end repeat

$ fasm pew.asm pew.bin -s pew.fas
flat assembler  version 1.73.32  (16384 kilobytes memory, x64)
1 passes, 3 bytes.

$ listing pew.fas pew.fas.lst
Segmentation fault (core dumped)    

Thank you
Post 16 Jan 2024, 23:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 17 Jan 2024, 20:32
This temporary fix solves the above crash for that code. But might still need more work to fix it for all cases.
Code:
diff LISTING.INC LISTING-proposed-fix.INC 
168c168
<       jz      no_code_listing
---
>       jbe     no_code_listing    
Post 17 Jan 2024, 20:32
View user's profile Send private message Visit poster's website Reply with quote
dunkaist



Joined: 31 Jul 2015
Posts: 24
dunkaist 05 Feb 2024, 01:06
Works for me, thank you!
Perhaps, I should learn how to get listings and symbols in fasmg and switch to it finally.
Post 05 Feb 2024, 01:06
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 27 Feb 2024, 10:57
dunkaist wrote:
Works for me, thank you!
Perhaps, I should learn how to get listings and symbols in fasmg and switch to it finally.
In the following month I hope to arrange some live streams and/or recordings to demonstrate fasmgw and fasm2, this could be a good starting point.

But it should also be easy to try out for yourself. Get the latest fasm2 preview (from the Download page), launch fasmgw, open its own source code (source/ide/windows/fasmgw.asm) and add the line:
Code:
include 'listing.inc'    
anywhere where you want the listing to start. I suggest to place it right before the first section definition. Compile as usual and you should get the fasmgw.lst file in the same directory. Or, if you're on Linux, use fasm2 script to assemble any of the sources with such line added.
Post 27 Feb 2024, 10:57
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 926
Location: Russia
macomics 27 Feb 2024, 12:35
When trying to compile fasm2 from the sources for linux i386 and linux x86_64, I get this error.
Code:
calculate@fasm2-2024-02-27/source/linux$ env INCLUDE="/home/macomics/fasm2-2024-02-27/include/;" fasmg fasmg.asm
flat assembler  version g.kcgn
fasmg.asm [2] /home/macomics/fasm2-2024-02-27/include/macro/struct.inc [67]:
        asm err 'value too long to fit in ',field
Processed: asm err 'value too long to fit in ',field
Error: unexpected instruction.

calculate@fasm2-2024-02-27/source/linux$ cd x64
calculate@fasm2-2024-02-27/source/linux/x64$ env INCLUDE="~/fasm2-2024-02-27/include/;" fasmg fasmg.asm
flat assembler  version g.kcgn
Error: could not generate code within the allowed number of passes.
fasmg.asm [14] /home/macomics/fasm2-2024-02-27/include/macro/struct.inc [67]:
        asm err 'value too long to fit in ',field
Processed: asm err 'value too long to fit in ',field
Error: unexpected instruction.    


ADD: It looks like it was necessary to add -iInclude\ \'fasm2\'
Code:
calculate@fasm2-2024-02-27/source/linux/x64$ env INCLUDE="~/fasm2-2024-02-27/include/;" fasmg -iInclude\ \'fasm2\' fasmg.asm
flat assembler  version g.kcgn
5 passes, 0.7 seconds, 70657 bytes.    
Post 27 Feb 2024, 12:35
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 27 Feb 2024, 12:49
Read my previous post carefully, I mentioned that you're supposed to use the fasm2 script.
Post 27 Feb 2024, 12:49
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 926
Location: Russia
macomics 27 Feb 2024, 13:34
Quote:
Read my previous post carefully, I mentioned that you're supposed to use the fasm2 script.
That's what I did, that's why I wrote about the need to add a key

ADD: What about adding a startup option to fasmw/fasmgw 'run in the debugging program', which can be activated or deactivated to work by flag? At the same time, when the flag is set and F9 is pressed, the debugging program is started and the name of the program received after compilation is specified.

It will need to add another string to the settings file with the path to the debugging program, and possibly a dialog box for configuring it, or add several fields to an existing dialog box.
Post 27 Feb 2024, 13:34
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 27 Feb 2024, 14:31
macomics wrote:
Quote:
Read my previous post carefully, I mentioned that you're supposed to use the fasm2 script.
That's what I did, that's why I wrote about the need to add a key
The bash script does that automatically, there shouldn't be a need to add anything.
Post 27 Feb 2024, 14:31
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.