Date: Tue, 10 Sep 2002 09:12:38 -0400 (EDT) From: Andrew Gallatin <gallatin@cs.duke.edu> To: Joe Marcus Clarke <marcus@marcuscom.com> Cc: obrien@FreeBSD.ORG, alpha@FreeBSD.ORG Subject: Re: getting closer (was Re: mozilla failure on 4.6.2) Message-ID: <15741.61382.872535.426732@grasshopper.cs.duke.edu> In-Reply-To: <1031635953.342.133.camel@gyros.marcuscom.com> References: <20020906040641.GA61111@xor.obsecurity.org> <1031287598.361.2.camel@gyros.marcuscom.com> <15736.40749.986834.818558@grasshopper.cs.duke.edu> <1031329151.342.9.camel@gyros.marcuscom.com> <20020906194732.GA2244@dragon.nuxi.com> <15737.2550.488154.4401@grasshopper.cs.duke.edu> <20020907000825.GA4091@dragon.nuxi.com> <15739.43883.152090.936327@grasshopper.cs.duke.edu> <15741.2822.526047.253409@grasshopper.cs.duke.edu> <1031605410.351.90.camel@gyros.marcuscom.com> <15741.17468.701009.998323@grasshopper.cs.duke.edu> <1031635953.342.133.camel@gyros.marcuscom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Joe Marcus Clarke writes: > Add 8 to the stack pointer ("this", right), and store it in $16. I wish it were that simple :-( The problem seems to be that the application code is passing the "wrong" value in and somehow the c++ calling standard corrects it, and we must correct it too: impl == 0x12001c080 foo == 0x12001c080 bar == 0x12001c088 Notice how "bar" = (char *)impl + 8 ? Somehow, when doing a "direct" call, the "this" pointer ends up as the impl pointer, not as the "bar" pointer, even if "bar" is used in the call. However, in the "invoke" code, we get literally what we asked for -- the "this" pointer == the "bar" pointer. We need to somehow be able to tell that its a case like this and make the this pointer be the impl pointer. Appended is sample output, with some of the methods modified to print out the this pointer. Drew calling direct: 1 + 1 = 2 1L + 1L = 2 2 * 2 = 4 2L * 2L = 4 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55 1 + 2 = 3.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 +1 15 + 16 + 17 + 18 + 19 + 20 = 210.000000f moo cow = milk calling via invoke: 1 + 1 = 2 1L + 1L = 2 2 * 2 = 4 2L * 2L = 4 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55 1 + 2 = 3.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 = 210.000000f moo cow = milk impl == 0x1200160c0 foo == 0x1200160c0 bar == 0x1200160d8 Calling Foo... direct calls: this = 0x1200160c0 FooImpl::FooMethod1 called with i == 1, FooImpl part of a FooBarImpl this = 0x1200160c0 FooImpl::FooMethod2 called with i == 2, FooImpl part of a FooBarImpl invoke calls: this = 0x1200160c0 FooImpl::FooMethod1 called with i == 1, FooImpl part of a FooBarImpl this = 0x1200160c0 FooImpl::FooMethod2 called with i == 2, FooImpl part of a FooBarImpl Calling Bar... direct calls: this = 0x1200160d8 BarImpl::BarMethod1 called with i == 1, BarImpl part of a FooBarImpl this = 0x1200160d8 BarImpl::BarMethod2 called with i == 2, BarImpl part of a FooBarImpl invoke calls: this = 0x1200160d8 BarImpl::BarMethod1 called with i == 1, BarImpl part of a FooBarImpl this = 0x1200160d8 BarImpl::BarMethod2 called with i == 2, BarImpl part of a FooBarImpl impl == 0x12001c080 foo == 0x12001c080 bar == 0x12001c088 Calling Foo... direct calls: this = 0x12001c080 FooBarImpl2::FooMethod1 called with i == 1, local value = 12345678 this = 0x12001c080 FooBarImpl2::FooMethod2 called with i == 2, local value = 12345678 invoke calls: this = 0x12001c080 FooBarImpl2::FooMethod1 called with i == 1, local value = 12345678 this = 0x12001c080 FooBarImpl2::FooMethod2 called with i == 2, local value = 12345678 Calling Bar... direct calls: this = 0x12001c080 FooBarImpl2::BarMethod1 called with i == 1, local value = 12345678 this = 0x12001c080 FooBarImpl2::BarMethod2 called with i == 2, local value = 12345678 invoke calls: this = 0x12001c088 FooBarImpl2::BarMethod1 called with i == 1, local value = 0 this = 0x12001c088 FooBarImpl2::BarMethod2 called with i == 2, local value = 0 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15741.61382.872535.426732>