From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31167 invoked by alias); 8 Mar 2003 17:32:17 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 31160 invoked from network); 8 Mar 2003 17:32:15 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (62.163.169.212) by 172.16.49.205 with SMTP; 8 Mar 2003 17:32:15 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6/8.12.5) with ESMTP id h28HW0Ja000380; Sat, 8 Mar 2003 18:32:01 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6/8.12.6) with ESMTP id h28HW0lT000463; Sat, 8 Mar 2003 18:32:00 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6/8.12.6/Submit) id h28HW0ZX000460; Sat, 8 Mar 2003 18:32:00 +0100 (CET) Date: Sat, 08 Mar 2003 17:32:00 -0000 Message-Id: <200303081732.h28HW0ZX000460@elgar.kettenis.dyndns.org> From: Mark Kettenis To: ac131313@redhat.com CC: gdb@sources.redhat.com In-reply-to: <3E6A0A28.9000304@redhat.com> (message from Andrew Cagney on Sat, 08 Mar 2003 10:20:08 -0500) Subject: Re: Unwinding dummy frames on the i386 References: <200303072059.h27KxgX1029877@elgar.kettenis.dyndns.org> <3E691984.4030207@redhat.com> <200303081142.h28Bg1BL035199@elgar.kettenis.dyndns.org> <3E6A0A28.9000304@redhat.com> X-SW-Source: 2003-03/txt/msg00141.txt.bz2 Date: Sat, 08 Mar 2003 10:20:08 -0500 From: Andrew Cagney > Date: Fri, 07 Mar 2003 17:13:24 -0500 > From: Andrew Cagney > > > For now I've worked around this by having my own do-nothing > > i386_save_dummy_frame_tos(), and having i386_unwind_dummy_id() return > > contents of the (saved) frame pointer register for the frame's base. > > Is there a better way to solve this? > > Can i386_save_dummy_frame_tos() save the `frame pointer register' that > the unwind_dummy_id() method later returns? > > If reading the current value of FP_REGNUM from current_regcache is OK > the answer is yes. Yes. Just add a comment to gdbarch.sh saying that tos's successor needs to be explicitly parameterized with the new regcache (along with anything else that might prove useful - old regcache, struct_addr, bp addr :-). Will do. > Hmm, in that case it's probably an even better > idea to actually set the frame pointer register to the top-of-stack in > i386_save_dummy_frame_tos(). That way, we won't have a problem when > there are several frameless function calls in a row. Is writing into > current_regcache acceptable? Shouldn't the push arguments code have already adjusted the FP? Not necessarily. It's the job of the called function to set up the FP (if it needs one or otherwise chooses to do so, e.g. for the benefit of a debugger). The called function doesn't care what the value of the FP is. The only reason I'm trying to set up a FP is for us to be able to find the right dummy frame upon unwinding. Therefore I'd like to restrict fiddling with the FP to save_dummy_frame_tos(). Anyway, regardless, you want to add frame_align() to the i386 architecture vector. It forces a non-empty correctly aligned dummy frame (thus eliminating the frameless dummy frame problem) (but read the comments that go with the call). Probably, yes. The System V ABI says that the stack should be word aligned. It doesn't help though, since it only fiddles with the SP. And on the i386 the frames are already non-empty since the return address gets pushed on the stack before a function call. Mark