From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14974 invoked by alias); 4 Dec 2004 11:27:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 14884 invoked from network); 4 Dec 2004 11:27:10 -0000 Received: from unknown (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org with SMTP; 4 Dec 2004 11:27:10 -0000 Received: from elgar.sibelius.xs4all.nl (elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id iB4BR2wm012096; Sat, 4 Dec 2004 12:27:02 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (localhost [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.12.6p3/8.12.6) with ESMTP id iB4BR2tI000667; Sat, 4 Dec 2004 12:27:02 +0100 (CET) (envelope-from kettenis@elgar.sibelius.xs4all.nl) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.12.6p3/8.12.6/Submit) id iB4BQsd8000662; Sat, 4 Dec 2004 12:26:54 +0100 (CET) Date: Sat, 04 Dec 2004 12:42:00 -0000 Message-Id: <200412041126.iB4BQsd8000662@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: randolph@tausq.org CC: brobecker@adacore.com, gdb-patches@sources.redhat.com In-reply-to: <20041204084624.GS6359@tausq.org> (message from Randolph Chung on Sat, 4 Dec 2004 00:46:24 -0800) Subject: Re: [RFC/RFA/hppa] unwind pc in bottom frame using correct register References: <20041204042049.GR16491@adacore.com> <20041204053132.GR6359@tausq.org> <20041204075101.GS16491@adacore.com> <20041204084624.GS6359@tausq.org> X-SW-Source: 2004-12/txt/msg00106.txt.bz2 Date: Sat, 4 Dec 2004 00:46:24 -0800 From: Randolph Chung Funny, I was just looking at the same issue yesterday. > Almost works. We get the first frame right, but then the backtraces > are broken because we get identical frames. This sort of makes sense > to me, since once you are past frame 0, you know which register to > unwind by inspecting the function associated to the frame (either prologue > analysis, or using the unwind info, or ...). No? So I would venture > that the SS_INSYSCALL thingy might be specific to the innermost frame? hrm, yes.... you are right. > > the bit about HPPA_FLAG_REGNUM seems to be an hpux specific thing. I > > think the syscall stub does something special so we try to return r31 > > instead of pcoqh. I haven't looked at this in detail... > > If it's HP/UX specific, it must be hurting hppa-linux? well, on hppa-linux the "flags" register is always 0, so we always read pcoqh. Given that this "flags" register isn't a real ISA register but an HP-UX-specific thingy that makes sense. For OpenBSD/NetBSD I don't explicitly set the "flags" register, which means it'll contain 0 as long as you don't change it. Hmm, I think the code that looks at this "flags" register should be moved into hppa-hpux-tdep.c. as you said i think we need to first better understand what is this SS_INSYSCALL thing.... Well, I've never seen the HP-UX source code, but it seems that the pcoqh and pcoqt returned by ttrace(2) when the program being debugged is in a system call, are the pcoqh and pcoqt for the currently running kernel code, which are quite useless to us. Apparently, at that stage %r31 contains the address where the system call will return to, which actually is what we're interested in. Anyway, the problems Joel sees can be fixed by explicitly setting "flags" to zero in all unwound frames. This somehow seems the correct approach since this "flags" register is only meaningful in the sentinel frame. This is implemented by the attached patch (wich will no longer apply after Randolph's recent change, but you get the idea). Alternatively, we can ditch this "flags" register alltogether, and let the native code deal with it. Unfortunately that means that any implementations of the remote protocol will have to be changed to. Anyway, if y'all agree I can check in something along the lines of the patch below tomorrow. Mark Index: hppa-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/hppa-tdep.c,v retrieving revision 1.183 diff -u -p -r1.183 hppa-tdep.c --- hppa-tdep.c 1 Dec 2004 06:54:56 -0000 1.183 +++ hppa-tdep.c 4 Dec 2004 11:02:43 -0000 @@ -2185,6 +2185,12 @@ hppa_unwind_dummy_id (struct gdbarch *gd static CORE_ADDR hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { + ULONGEST flags; + + flags = frame_unwind_register_unsigned (next_frame, HPPA_FLAGS_REGNUM); + if (flags & 2) + return frame_unwind_register_signed (next_frame, HPPA_R31_REGNUM) & ~3; + return frame_unwind_register_signed (next_frame, HPPA_PCOQ_HEAD_REGNUM) & ~3; } @@ -2413,6 +2419,18 @@ hppa_frame_prev_register_helper (struct *realnump = -1; return; } + if (regnum == HPPA_FLAGS_REGNUM) + { + if (valuep) + store_unsigned_integer (valuep, 4, 0); + + /* It's a computed value. */ + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + return; + } trad_frame_get_prev_register (next_frame, saved_regs, regnum, optimizedp, lvalp, addrp, realnump, valuep);