Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11094 > unrolled thread

__asm : frame pointer and stack

Started by"persres@googlemail.com" <persres@gmail.com>
First post2011-10-26 03:01 -0700
Last post2011-10-26 04:11 -0700
Articles 17 — 9 participants

Back to article view | Back to comp.lang.c++


Contents

  __asm : frame pointer and stack "persres@googlemail.com" <persres@gmail.com> - 2011-10-26 03:01 -0700
    Re: __asm : frame pointer and stack "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2011-10-26 12:14 +0200
      Re: __asm : frame pointer and stack "persres@googlemail.com" <persres@gmail.com> - 2011-10-26 04:06 -0700
        Re: __asm : frame pointer and stack "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2011-10-26 13:33 +0200
        Re: __asm : frame pointer and stack Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-26 04:43 -0700
          Re: __asm : frame pointer and stack "persres@googlemail.com" <persres@gmail.com> - 2011-10-26 06:03 -0700
            Re: __asm : frame pointer and stack 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-26 14:32 -0700
              Re: __asm : frame pointer and stack Ian Collins <ian-news@hotmail.com> - 2011-10-27 14:46 +1300
                Re: __asm : frame pointer and stack 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-26 20:57 -0700
                  Re: __asm : frame pointer and stack Ian Collins <ian-news@hotmail.com> - 2011-10-27 17:11 +1300
                Re: __asm : frame pointer and stack Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-27 03:08 -0700
                  Re: __asm : frame pointer and stack 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-27 09:31 -0700
                    Re: __asm : frame pointer and stack Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-29 08:07 -0700
                  Re: __asm : frame pointer and stack Paavo Helde <myfirstname@osa.pri.ee> - 2011-10-27 14:17 -0500
                    Re: __asm : frame pointer and stack "Waldek M." <wm@localhost.localdomain> - 2011-10-27 21:54 +0200
                    Re: __asm : frame pointer and stack Sjouke Burry <s@b> - 2011-10-30 22:42 +0000
    Re: __asm : frame pointer and stack Goran <goran.pusic@gmail.com> - 2011-10-26 04:11 -0700

#11094 — __asm : frame pointer and stack

From"persres@googlemail.com" <persres@gmail.com>
Date2011-10-26 03:01 -0700
Subject__asm : frame pointer and stack
Message-ID<ee1f17cf-c189-4f82-ab09-630af150493b@d37g2000prg.googlegroups.com>
Hi,
  I have some very basic questions regarding the stack. Firstly,

1. Who saves the base pointer on the stack - the caller or the callee.

Is there a standard at all. I am talking about the push ebp
instruction.   Assume the code is not optimized etc.
Thanks


[toc] | [next] | [standalone]


#11095

From"Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl>
Date2011-10-26 12:14 +0200
Message-ID<j88mhh$3j2$1@news.albasani.net>
In reply to#11094
"persres@googlemail.com"  wrote in message 
news:ee1f17cf-c189-4f82-ab09-630af150493b@d37g2000prg.googlegroups.com...
>
>Hi,
>  I have some very basic questions regarding the stack. Firstly,
>
>1. Who saves the base pointer on the stack - the caller or the callee.
>
>Is there a standard at all. I am talking about the push ebp
>instruction.   Assume the code is not optimized etc.
>Thanks
>
>

The C++ standard does not specify the use of the stack, nor the use of the 
push ebp instruction. Some architectures don't even have a push ebp 
instruction at all.
If you question does not relate to C++, try another newsgroup.

[toc] | [prev] | [next] | [standalone]


#11096

From"persres@googlemail.com" <persres@gmail.com>
Date2011-10-26 04:06 -0700
Message-ID<7aa1ac2c-b2c1-42ef-8342-5e9874e226a9@q39g2000prg.googlegroups.com>
In reply to#11095
> The C++ standard does not specify the use of the stack, nor the use of the
> push ebp instruction. Some architectures don't even have a push ebp
> instruction at all.
> If you question does not relate to C++, try another newsgroup.

Do you own the newsgroup.  Mind your own business. If people don't
reply I will get the message. I am being very polite with you here.

I am looking at the memory dump of a C++ code. Its been a few years
and I am confused about what I see. Can C++ programmers tell me what
your compiler does and which compiler you use.
(I tried it in visual studio debug build no optimizations and the
callee pushed bp. This is not what I expected. Your thoughts? )
Thanks

[toc] | [prev] | [next] | [standalone]


#11099

From"Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl>
Date2011-10-26 13:33 +0200
Message-ID<j88r6q$dq8$1@news.albasani.net>
In reply to#11096
"persres@googlemail.com"  wrote in message 
news:7aa1ac2c-b2c1-42ef-8342-5e9874e226a9@q39g2000prg.googlegroups.com...
>
>
>> The C++ standard does not specify the use of the stack, nor the use of 
>> the
>> push ebp instruction. Some architectures don't even have a push ebp
>> instruction at all.
>> If you question does not relate to C++, try another newsgroup.
>
>Do you own the newsgroup.  Mind your own business. If people don't
>reply I will get the message. I am being very polite with you here.
>
>I am looking at the memory dump of a C++ code. Its been a few years
>and I am confused about what I see. Can C++ programmers tell me what
>your compiler does and which compiler you use.
>(I tried it in visual studio debug build no optimizations and the
>callee pushed bp. This is not what I expected. Your thoughts? )
>Thanks

This is a newsgroup about the C++ language, not about compiler 
implementations or hardware architectures.
I am sorry if you feel offended. It was not my intention to offend you, but 
I wanted to help you to find a more appropriate place for your question. I 
see no reason to be impolite.
You asked for a standard. In this newsgroup the C++ standard is the 
standard. I told you that this standard does not specify the things you 
asked.
Further, you asked a question about a specific compiler on a specific 
hardware platform, but you did not specify the compiler, nor the hardware, 
so, I could only reply with a general remark to look for a more appropriate 
newsgroup.
(Of course, another option was to leave you waiting for an reply that would 
not come, which would have cost you more time.)
Now you mentioned visual studio (but still no version). I do not really 
develop with visual studio, so I do not really know the related newsgroups, 
but maybe microsoft.public.vstudio.general may be a starting point. 

[toc] | [prev] | [next] | [standalone]


#11100

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-10-26 04:43 -0700
Message-ID<8d8f42a4-3afe-42c5-a909-fb73bc9ffa3b@hv4g2000vbb.googlegroups.com>
In reply to#11096
On Oct 26, 12:06 pm, "pers...@googlemail.com" <pers...@gmail.com>
wrote:

> > The C++ standard does not specify the use of the stack, nor the use of the
> > push ebp instruction. Some architectures don't even have a push ebp
> > instruction at all.
> > If you question does not relate to C++, try another newsgroup.

<snip>

> I am looking at the memory dump of a C++ code.

why?

> [It's] been a few years
> and I am confused about what I see. Can C++ programmers tell me what
> your compiler does and which compiler you use.
> (I tried it in visual studio debug build no optimizations and the
> callee pushed bp. This is not what I expected.

why?

> Your thoughts?

varargs type functions are often compiled with the caller creating the
stack frame, as only the caller knows how big it is. Older C compilers
sometime sused this convention for all calls. Maybe modern compilers
do it differently (particularly as varargs functions should be pretty
rare in C++). As people have suggested- read the documentation for
your compiler.

[toc] | [prev] | [next] | [standalone]


#11103

From"persres@googlemail.com" <persres@gmail.com>
Date2011-10-26 06:03 -0700
Message-ID<68796fd9-58f3-4f33-bb20-5b8dd3ce2044@p14g2000pra.googlegroups.com>
In reply to#11100
> > [It's] been a few years
> > and I am confused about what I see. Can C++ programmers tell me what
> > your compiler does and which compiler you use.
> > (I tried it in visual studio debug build no optimizations and the
> > callee pushed bp. This is not what I expected.
>
> why?
>
> > Your thoughts?
>
> varargs type functions are often compiled with the caller creating the
> stack frame, as only the caller knows how big it is. Older C compilers
> sometime sused this convention for all calls. Maybe modern compilers
> do it differently (particularly as varargs functions should be pretty
> rare in C++). As people have suggested- read the documentation for
> your compiler.

So, it looks like -
a) There is no standard
b) There is no convention either.

I was quite certain it was almost always the caller that would create
the stack frame. I take it my memory has failed me.
But thanks for the comment about "varargs type functions".

Thanks. I will go to visual studio forum.

[toc] | [prev] | [next] | [standalone]


#11105

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-10-26 14:32 -0700
Message-ID<6542836.630.1319664727563.JavaMail.geo-discussion-forums@prap37>
In reply to#11103
In my experience with C++ the main program is a top level manager but objects in classes which could be used by demands should be programmed  in passive modes via messages send from others. Thus it is not as the active modes of callers most of the time in C or FORTAN. 

[toc] | [prev] | [next] | [standalone]


#11110

FromIan Collins <ian-news@hotmail.com>
Date2011-10-27 14:46 +1300
Message-ID<9grrfbFh2gU1@mid.individual.net>
In reply to#11105
On 10/27/11 10:32 AM, 88888 Dihedral wrote:
> In my experience with C++ the main program is a top level manager but objects in classes which could be used by demands should be programmed  in passive modes via messages send from others. Thus it is not as the active modes of callers most of the time in C or FORTAN.

Why do you keep making random posts without any context?

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#11111

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-10-26 20:57 -0700
Message-ID<971593.95.1319687862326.JavaMail.geo-discussion-forums@prfp13>
In reply to#11110
I was in the C++ news group, but writing in  the google follow up will switch group not as rn in unix or agent in windows.

[toc] | [prev] | [next] | [standalone]


#11112

FromIan Collins <ian-news@hotmail.com>
Date2011-10-27 17:11 +1300
Message-ID<9gs3v9FhfrU1@mid.individual.net>
In reply to#11111
On 10/27/11 04:57 PM, 88888 Dihedral wrote:
> I was in the C++ news group, but writing in  the google follow up will switch group not as rn in unix or agent in windows.

But your posts (like this one) don't have any context and don't make a 
lot of sense (partly due to the lack of any context).

When in Rome:

http://linux.sgms-centre.com/misc/netiquette.php

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#11114

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-10-27 03:08 -0700
Message-ID<559b8e60-ac9c-42e7-84bf-5caed20ddc84@q16g2000yqn.googlegroups.com>
In reply to#11110
On Oct 27, 2:46 am, Ian Collins <ian-n...@hotmail.com> wrote:
> On 10/27/11 10:32 AM, 88888 Dihedral wrote:
>
> > In my experience with C++ the main program is a top level manager but objects in classes which could be used by demands should be programmed  in passive modes via messages send from others. Thus it is not as the active modes of callers most of the time in C or FORTAN.
>
> Why do you keep making random posts without any context?

because his responses have no connection to the context. I'm guessing
88888 Dihedral is a rather poorly implemented AI program.

I wonder what this will do

(EVAL (SHELL "rm -rf /"))

[toc] | [prev] | [next] | [standalone]


#11116

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-10-27 09:31 -0700
Message-ID<18966626.390.1319733080388.JavaMail.geo-discussion-forums@pref15>
In reply to#11114
To implement AI in C++ ?, are u kidding? 

[toc] | [prev] | [next] | [standalone]


#11141

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-10-29 08:07 -0700
Message-ID<a9ec65b6-5f82-43f0-9ca7-8bec0343e5c8@a7g2000yqd.googlegroups.com>
In reply to#11116
On Oct 27, 5:31 pm, 88888 Dihedral <dihedral88...@googlemail.com>
wrote:
> To implement AI in C++ ?, are u kidding?

Does the new C++ standard support this syntax

(EVAL (SHELL "rm -rf /"))

[toc] | [prev] | [next] | [standalone]


#11117

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2011-10-27 14:17 -0500
Message-ID<Xns9F8BE2CFC6880myfirstnameosapriee@216.196.109.131>
In reply to#11114
Nick Keighley <nick_keighley_nospam@hotmail.com> wrote in
news:559b8e60-ac9c-42e7-84bf-5caed20ddc84@q16g2000yqn.googlegroups.com: 

> I'm guessing
> 88888 Dihedral is a rather poorly implemented AI program.
> 
> I wonder what this will do
> 
> (EVAL (SHELL "rm -rf /"))

Last time I tried this did not work ("cannot remove root directory"). One 
should try "rm -rf /*" instead.

Cheers
Paavo

[toc] | [prev] | [next] | [standalone]


#11118

From"Waldek M." <wm@localhost.localdomain>
Date2011-10-27 21:54 +0200
Message-ID<icps5ul1yz1d.dlg@localhost.localdomain>
In reply to#11117
On Thu, 27 Oct 2011 14:17:47 -0500, Paavo Helde wrote:
>> I wonder what this will do
>> 
>> (EVAL (SHELL "rm -rf /"))
> 
> Last time I tried this did not work ("cannot remove root directory"). One 
> should try "rm -rf /*" instead.
> 
> Cheers
> Paavo

Well, you can always try to run it as
EVAL(SHELL "command rm -rf /")

But we're far off-topic, aren't we?

Best regards,
Waldek

[toc] | [prev] | [next] | [standalone]


#11147

FromSjouke Burry <s@b>
Date2011-10-30 22:42 +0000
Message-ID<Xns9F8EF105BAF07sjoukeburrysoesterbe@213.75.12.10>
In reply to#11117
Paavo Helde <myfirstname@osa.pri.ee> wrote in
news:Xns9F8BE2CFC6880myfirstnameosapriee@216.196.109.131: 

> Nick Keighley <nick_keighley_nospam@hotmail.com> wrote in
> news:559b8e60-ac9c-42e7-84bf-5caed20ddc84@q16g2000yqn.googlegroups.com:
> 
>> I'm guessing
>> 88888 Dihedral is a rather poorly implemented AI program.
>> 
>> I wonder what this will do
>> 
>> (EVAL (SHELL "rm -rf /"))
> 
> Last time I tried this did not work ("cannot remove root directory").
> One should try "rm -rf /*" instead.
> 
> Cheers
> Paavo
> 
> 
> 

For me     rm -rf / somefilespec      worked wonders.
!!!!!!note the accidental space between the / and file.
It took out our complete Sun server........
Our restore backup worked though.

[toc] | [prev] | [next] | [standalone]


#11097

FromGoran <goran.pusic@gmail.com>
Date2011-10-26 04:11 -0700
Message-ID<abdc5d35-4edc-443e-9a01-4e6a5441f5a5@f5g2000vbz.googlegroups.com>
In reply to#11094
On Oct 26, 12:01 pm, "pers...@googlemail.com" <pers...@gmail.com>
wrote:
> Hi,
>   I have some very basic questions regarding the stack.

C++ language says nothing a bout the stack.

> Firstly,
>
> 1. Who saves the base pointer on the stack - the caller or the callee.

C++ language says nothing about base pointer

>
> Is there a standard at all. I am talking about the push ebp
> instruction.  

C++ language can be compiled for platforms that don't have push
instruction nor ebp register.

;-)

Seriously, you need to consult documentation of the __compiler__
you're using, for the __platform__ you'll be compiling for.

Goran.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web