Skip to contentSkip to conversation

Help finding ARGC

DISCUSSION Liam 3 participants 3 messages Nov 15, 2007 – Nov 27, 2007

lore
Share & tools
lore

Liam

author
#0 lore raw

Hi all,

I was reading about ARGC and that it holds how many arguments were given on the command line when the program was executed.

My question is, where is it on the stack?

If I do:

movl %esp, %ebp

at the beginning of the program, how can I get to the ARGC value?

      ____________________________________________________________________________________

Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ

#1 lore raw

in the beginning of execution %esp point to argc value get it: movl (%esp), %eax
or: popl %eax
Now %eax contains argc value

#2 lore raw

maybe you want to have a look at this one
http://linux.xulin.de/asm/cmdline/

Citing Mike Osipov (Thursday, 2007/11/15 12:56)...

Quoted 8 lines

in the beginning of execution %esp point to argc value
get it: movl (%esp), %eax
or: popl %eax
Now %eax contains argc value
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
------------------------------------
Steffen Solyga
mail: [email protected]
www : http://www.absinth.net/solyga/
------------------------------------