flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Problem with Listing

Author
Thread Post new topic Reply to topic
booter



Joined: 08 Dec 2006
Posts: 67
booter 17 May 2009, 07:07
As I understand, program listing is needed when you want to know what exactly was generated by FASM from your source file.
That includes not just hex code, but also what was generated by macros. What we currently have is just the text of the macro call on the right and some "magic" hex data on the left.
I don't really want to digg into how the macro was processed, but I want to see (in human readable form) what exactly was generated.
Particularly to deal with problems like that:
Code:
; That's OK
push ecx
push edx
invoke someW32,a,b,c,d
pop  edx
pop  ecx
; That's not OK (somehow different)
macro callW32 prc,[arg]
{
  push ecx
  push edx
  invoke prc,arg
  pop  edx
  pop  ecx
}
callW32 someW32,a,b,c,d    


Also, unused procedures are present in the listing for no apparent reason. No code is generated for them. Same with constants and macro definitions. Why copy them from program source? Macro calls and source comments are useful to match the listing and source, but why would we need the rest?

Also, in the listing I see all kernel32 entries (import kernel32,\...), but they are not in the executable. So where hex data on the left have come from?
Post 17 May 2009, 07:07
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 17 May 2009, 07:31
Post 17 May 2009, 07:31
View user's profile Send private message Visit poster's website Reply with quote
booter



Joined: 08 Dec 2006
Posts: 67
booter 17 May 2009, 10:09
Quote:
http://board.flatassembler.net/topic.php?t=4490


1. Even "short" FasmPre by decard produces way too much information unrelated to the compiler results, for example
Code:
if used GetCurrentProcessId&'GetCurrentProcessId' eqtype ''
_label?00006A0 dw 0
db 'GetCurrentProcessId',0
rb RVA $ and 1
end if    


2. I was writing about the listing, not results of preprocessor.
Post 17 May 2009, 10:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 17 May 2009, 11:00
You can combine the two. You need the preprocessor output code to see the macro expansion and you need the listing output code to see the byte codes generated.
Post 17 May 2009, 11:00
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 17 May 2009, 16:17
revolution: there already is a prepsrc tool in the official fas-processing tools pack, no need to hack the fasm source anymore (well, unless you need to get preprocessed source in case when assembly failed, but that's a different story).
Post 17 May 2009, 16:17
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 18 May 2009, 06:50
Please help me to find the "official fas-processing tools pack" Question
Post 18 May 2009, 06:50
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 18 May 2009, 07:04
1) Get any of the fasm packages and unpack it.
2) Go to the TOOLS directory.
[OPTIONAL] 3) Read this thread, too: http://board.flatassembler.net/topic.php?t=9792
Post 18 May 2009, 07:04
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 18 May 2009, 07:07
Tomasz Grysztar wrote:
2) Go to the TOOLS directory.
Thanks, I hadn't seen that folder before!
Post 18 May 2009, 07:07
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 18 May 2009, 12:04
Yeah, I also found it by accident. It was a nice surprise. Sorry that I didn't let the other board members know, but at that time I thought everybody else knew Smile
Post 18 May 2009, 12:04
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger 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.