From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30361 invoked by alias); 31 Oct 2007 12:59:54 -0000 Received: (qmail 30340 invoked by uid 22791); 31 Oct 2007 12:59:51 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate8.de.ibm.com (HELO mtagate8.de.ibm.com) (195.212.29.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 31 Oct 2007 12:59:47 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id l9VCxiYL448412 for ; Wed, 31 Oct 2007 12:59:44 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l9VCxirA2121930 for ; Wed, 31 Oct 2007 13:59:44 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l9VCxiax021284 for ; Wed, 31 Oct 2007 13:59:44 +0100 Received: from bbkeks.boeblingen.de.ibm.com (dyn-9-152-248-41.boeblingen.de.ibm.com [9.152.248.41]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l9VCxgeG021260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Oct 2007 13:59:44 +0100 Message-ID: <47287BD6.208@de.ibm.com> Date: Wed, 31 Oct 2007 14:30:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: GDB Patches CC: Ulrich Weigand Subject: [rfc] Extend frame_id_inner by gdbarch parameter Content-Type: multipart/mixed; boundary="------------000105080408080604050302" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00862.txt.bz2 This is a multi-part message in MIME format. --------------000105080408080604050302 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1027 Hi, I'd like to hear your opinion about the attached patch. It gets rid of the last remaining occurences of current_gdbarch in frame.c (beside the one in get_frame_arch ;-) ). Therefor frame_id_inner is extended by a gdbarch parameter. I build and tested it on x86 without regression. Are there any objections from your side or would this be a way to go? Thanks a lot. ChangeLog: * frame.c (frame_id_inner): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (frame_find_by_id, get_prev_frame_1): Use get_frame_arch to get at the current architecture by frame_info. * frame.h (frame_id_inner): Add gdbarch parameter. * stack.c (return_command): Use get_frame_arch to get at the current architecture by frame_info. Update call of frame_id_inner. * infrun.c (handle_inferior_event): Likewise. * dummy-frame.c (dummy_frame_push): Use get_regcache_arch to get at the current architecture by regcache. Update call of frame_id_inner. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------000105080408080604050302 Content-Type: text/plain; name="diff-frame" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff-frame" Content-length: 4655 diff -urpN dev.orig/gdb/dummy-frame.c dev/gdb/dummy-frame.c --- dev.orig/gdb/dummy-frame.c 2007-08-23 20:08:28.000000000 +0200 +++ dev/gdb/dummy-frame.c 2007-10-31 13:41:29.000000000 +0100 @@ -87,6 +87,7 @@ void dummy_frame_push (struct regcache *caller_regcache, const struct frame_id *dummy_id) { + struct gdbarch *gdbarch = get_regcache_arch (caller_regcache); struct dummy_frame *dummy_frame; /* Check to see if there are stale dummy frames, perhaps left over @@ -95,7 +96,7 @@ dummy_frame_push (struct regcache *calle dummy_frame = dummy_frame_stack; while (dummy_frame) /* FIXME: cagney/2004-08-02: Should just test IDs. */ - if (frame_id_inner (dummy_frame->id, (*dummy_id))) + if (frame_id_inner (gdbarch, dummy_frame->id, (*dummy_id))) /* Stale -- destroy! */ { dummy_frame_stack = dummy_frame->next; diff -urpN dev.orig/gdb/frame.c dev/gdb/frame.c --- dev.orig/gdb/frame.c 2007-10-17 15:36:43.000000000 +0200 +++ dev/gdb/frame.c 2007-10-31 13:42:23.000000000 +0100 @@ -369,7 +369,7 @@ frame_id_eq (struct frame_id l, struct f } int -frame_id_inner (struct frame_id l, struct frame_id r) +frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r) { int inner; if (!l.stack_addr_p || !r.stack_addr_p) @@ -380,7 +380,7 @@ frame_id_inner (struct frame_id l, struc comment in "frame.h", there is some fuzz here. Frameless functions are not strictly inner than (same .stack but different .code and/or .special address). */ - inner = gdbarch_inner_than (current_gdbarch, l.stack_addr, r.stack_addr); + inner = gdbarch_inner_than (gdbarch, l.stack_addr, r.stack_addr); if (frame_debug) { fprintf_unfiltered (gdb_stdlog, "{ frame_id_inner (l="); @@ -410,7 +410,7 @@ frame_find_by_id (struct frame_id id) if (frame_id_eq (id, this)) /* An exact match. */ return frame; - if (frame_id_inner (id, this)) + if (frame_id_inner (get_frame_arch (frame), id, this)) /* Gone to far. */ return NULL; /* Either we're not yet gone far enough out along the frame @@ -1175,7 +1175,8 @@ get_prev_frame_1 (struct frame_info *thi go backwards) and sentinel frames (the test is meaningless). */ if (this_frame->next->level >= 0 && this_frame->next->unwind->type != SIGTRAMP_FRAME - && frame_id_inner (this_id, get_frame_id (this_frame->next))) + && frame_id_inner (get_frame_arch (this_frame), this_id, + get_frame_id (this_frame->next))) { if (frame_debug) { diff -urpN dev.orig/gdb/frame.h dev/gdb/frame.h --- dev.orig/gdb/frame.h 2007-10-17 15:36:43.000000000 +0200 +++ dev/gdb/frame.h 2007-10-31 13:29:51.000000000 +0100 @@ -175,7 +175,8 @@ extern int frame_id_eq (struct frame_id /* Returns non-zero when L is strictly inner-than R (they have different frame .bases). Neither L, nor R can be `null'. See note above about frameless functions. */ -extern int frame_id_inner (struct frame_id l, struct frame_id r); +extern int frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, + struct frame_id r); /* Write the internal representation of a frame ID on the specified stream. */ diff -urpN dev.orig/gdb/infrun.c dev/gdb/infrun.c --- dev.orig/gdb/infrun.c 2007-10-01 02:17:58.000000000 +0200 +++ dev/gdb/infrun.c 2007-10-31 13:37:46.000000000 +0100 @@ -2726,8 +2726,10 @@ process_event_stop_test: function. Fortunately, those days are nearly upon us. */ #endif { - struct frame_id current_frame = get_frame_id (get_current_frame ()); - if (!(frame_id_inner (current_frame, step_frame_id))) + struct frame_info *frame = get_current_frame (); + struct frame_id current_frame = get_frame_id (frame); + if (!(frame_id_inner (get_frame_arch (frame), current_frame, + step_frame_id))) step_frame_id = current_frame; } diff -urpN dev.orig/gdb/stack.c dev/gdb/stack.c --- dev.orig/gdb/stack.c 2007-10-13 02:06:54.000000000 +0200 +++ dev/gdb/stack.c 2007-10-31 13:34:47.000000000 +0100 @@ -1824,7 +1824,9 @@ If you continue, the return value that y struct frame_id selected_id = get_frame_id (get_selected_frame (NULL)); while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ()))) { - if (frame_id_inner (selected_id, get_frame_id (get_current_frame ()))) + struct frame_info *frame = get_current_frame (); + if (frame_id_inner (get_frame_arch (frame), selected_id, + get_frame_id (frame))) /* Caught in the safety net, oops! We've gone way past the selected frame. */ error (_("Problem while popping stack frames (corrupt stack?)")); --------------000105080408080604050302--