flat assembler
Message board for the users of flat assembler.

Index > Main > showing macro's in debugger

Author
Thread Post new topic Reply to topic
karl



Joined: 07 Feb 2006
Posts: 63
Location: South Africa
karl
i'm trying to get macro names to show up in ollydbg. so when i say

Text "hello"

I see this in debugger

push Output.2023212 | ASCII "Text"
push Output.2232311 | ASCII "hello"
call Output.238483

I'm trying to do that by saying

macro tmacro [params] {
common macro params {
String name,'tmacro ; put into data section with label 'name'
push name
}

MACRO fix tmacro
ENDM fix pop edi }

So now to define my macros I say

MACRO Text string

push string
call writetext

ENDM

But the problem is that ollydbg shows up "tmacro" instead of "Text". I tried writing '#tmacro instead but that doesn't work either, says too many characters on line.

Any ideas?
Post 01 Apr 2008, 08:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
It is not clear to me what you want.

Do you want to push the address of name of the macro on to the stack so that you can visually see it in Olly?

O think this line is where you have a problem
Code:
String name,'tmacro ; put into data section with label 'name'    
You push the string tmacro so of course it will display tmacro.
Post 01 Apr 2008, 08:21
View user's profile Send private message Visit poster's website Reply with quote
karl



Joined: 07 Feb 2006
Posts: 63
Location: South Africa
karl
hmmm no see what string does is

macro String name,[string] {
local offset
strings#offset db string,0 ; this is placed into data section
name equ strings#offset
}

so when i say

String name,'tmacro

i want it to be replaced with

String name,"Text"

but instead it's being replaced with

String name,"tmacro"

.... so yes, I want the name of the macro to come up in olly. but i don't know how you can put the name of the macro into the macro....
Post 01 Apr 2008, 08:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
Try something like this:
Code:
macro tmacro mac_name,[params] {
common macro mac_name,params {
String name,`mac_name ; NOTE the ` character
push name
}    
But note that you will need a more complex setup using "match" if you want to support macros without and parameters.


Last edited by revolution on 01 Apr 2008, 09:07; edited 1 time in total
Post 01 Apr 2008, 09:06
View user's profile Send private message Visit poster's website Reply with quote
karl



Joined: 07 Feb 2006
Posts: 63
Location: South Africa
karl
i've changed it to include the name of the macro

macro tmacro name, [params] {

macro name params {
String string,`name
push string
}

MACRO fix tmacro
ENDM fix pop edi }

but now when I say

MACRO tester param
ENDM

fasmpre comes out with

;macro tester param{
; String string,'tester' param
; push string
;
; pop edi}

strange, huh? why is the extra 'param' being put in?
Post 01 Apr 2008, 09:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
You need a comma
Code:
MACRO tester,param
ENDM    


Try to use "match" for a better solution to your problem.
Post 01 Apr 2008, 09:20
View user's profile Send private message Visit poster's website Reply with quote
karl



Joined: 07 Feb 2006
Posts: 63
Location: South Africa
karl
awesome. thanks revolution
Post 01 Apr 2008, 09:33
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.