From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4037 invoked by alias); 7 Aug 2010 19:59:35 -0000 Received: (qmail 4026 invoked by uid 22791); 7 Aug 2010 19:59:35 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 Aug 2010 19:59:30 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o77JxTbu006499 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 7 Aug 2010 15:59:29 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o77JxRFA003574 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 7 Aug 2010 15:59:28 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o77JxQ35004121 for ; Sat, 7 Aug 2010 21:59:26 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o77JxQkF004120 for gdb-patches@sourceware.org; Sat, 7 Aug 2010 21:59:26 +0200 Date: Sat, 07 Aug 2010 19:59:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Code cleanup: Drop frame_unwind_find_by_frame retval Message-ID: <20100807195925.GA4025@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes 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: 2010-08/txt/msg00094.txt.bz2 Hi, it is obvious (as frame->unwind is already pre-set by frame_prepare_for_sniffer). I will check it in in several days if not replied otherwise. No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. Thanks, Jan 2010-08-07 Jan Kratochvil Code cleanup. * frame-unwind.c (frame_unwind_find_by_frame): Remove the return type and returned value. New comment from frame-unwind.h. * frame-unwind.h (frame_unwind_find_by_frame): Remove the return type. Extend the comment. * frame.c (get_frame_id, frame_unwind_register_value) (create_new_frame, get_prev_frame_1, frame_unwinder_is) (get_frame_type, frame_unwind_arch): Do not use the return value of frame_unwind_find_by_frame. --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -88,7 +88,11 @@ frame_unwind_append_unwinder (struct gdbarch *gdbarch, (*ip)->unwinder = unwinder; } -const struct frame_unwind * +/* Iterate through sniffers for THIS_FRAME frame until one returns with an + unwinder implementation. THIS_FRAME->UNWIND must be NULL, it will get set + by this function. Possibly initialize THIS_CACHE. */ + +void frame_unwind_find_by_frame (struct frame_info *this_frame, void **this_cache) { struct gdbarch *gdbarch = get_frame_arch (this_frame); @@ -104,7 +108,7 @@ frame_unwind_find_by_frame (struct frame_info *this_frame, void **this_cache) this_cache)) { discard_cleanups (old_cleanup); - return entry->unwinder; + return; } do_cleanups (old_cleanup); } --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -160,11 +160,12 @@ extern void frame_unwind_prepend_unwinder (struct gdbarch *gdbarch, extern void frame_unwind_append_unwinder (struct gdbarch *gdbarch, const struct frame_unwind *unwinder); -/* Iterate through sniffers for THIS frame until one returns with an - unwinder implementation. Possibly initialize THIS_CACHE. */ +/* Iterate through sniffers for THIS_FRAME frame until one returns with an + unwinder implementation. THIS_FRAME->UNWIND must be NULL, it will get set + by this function. Possibly initialize THIS_CACHE. */ -extern const struct frame_unwind *frame_unwind_find_by_frame (struct frame_info *this_frame, - void **this_cache); +extern void frame_unwind_find_by_frame (struct frame_info *this_frame, + void **this_cache); /* Helper functions for value-based register unwinding. These return a (possibly lazy) value of the appropriate type. */ --- a/gdb/frame.c +++ b/gdb/frame.c @@ -329,7 +329,7 @@ get_frame_id (struct frame_info *fi) fi->level); /* Find the unwinder. */ if (fi->unwind == NULL) - fi->unwind = frame_unwind_find_by_frame (fi, &fi->prologue_cache); + frame_unwind_find_by_frame (fi, &fi->prologue_cache); /* Find THIS frame's ID. */ /* Default to outermost if no ID is found. */ fi->this_id.value = outer_frame_id; @@ -839,7 +839,7 @@ frame_unwind_register_value (struct frame_info *frame, int regnum) /* Find the unwinder. */ if (frame->unwind == NULL) - frame->unwind = frame_unwind_find_by_frame (frame, &frame->prologue_cache); + frame_unwind_find_by_frame (frame, &frame->prologue_cache); /* Ask this frame to unwind its register. */ value = frame->unwind->prev_register (frame, &frame->prologue_cache, regnum); @@ -1328,7 +1328,7 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) /* Select/initialize both the unwind function and the frame's type based on the PC. */ - fi->unwind = frame_unwind_find_by_frame (fi, &fi->prologue_cache); + frame_unwind_find_by_frame (fi, &fi->prologue_cache); fi->this_id.p = 1; fi->this_id.value = frame_id_build (addr, pc); @@ -1463,8 +1463,7 @@ get_prev_frame_1 (struct frame_info *this_frame) sniffers will think that this frame's sniffer tried to unwind further (see frame_cleanup_after_sniffer). */ if (this_frame->unwind == NULL) - this_frame->unwind - = frame_unwind_find_by_frame (this_frame, &this_frame->prologue_cache); + frame_unwind_find_by_frame (this_frame, &this_frame->prologue_cache); this_frame->prev_p = 1; this_frame->stop_reason = UNWIND_NO_REASON; @@ -1961,7 +1960,7 @@ int frame_unwinder_is (struct frame_info *fi, const struct frame_unwind *unwinder) { if (fi->unwind == NULL) - fi->unwind = frame_unwind_find_by_frame (fi, &fi->prologue_cache); + frame_unwind_find_by_frame (fi, &fi->prologue_cache); return fi->unwind == unwinder; } @@ -1983,7 +1982,7 @@ get_frame_type (struct frame_info *frame) if (frame->unwind == NULL) /* Initialize the frame's unwinder because that's what provides the frame's type. */ - frame->unwind = frame_unwind_find_by_frame (frame, &frame->prologue_cache); + frame_unwind_find_by_frame (frame, &frame->prologue_cache); return frame->unwind->type; } @@ -2063,9 +2062,7 @@ frame_unwind_arch (struct frame_info *next_frame) struct gdbarch *arch; if (next_frame->unwind == NULL) - next_frame->unwind - = frame_unwind_find_by_frame (next_frame, - &next_frame->prologue_cache); + frame_unwind_find_by_frame (next_frame, &next_frame->prologue_cache); if (next_frame->unwind->prev_arch != NULL) arch = next_frame->unwind->prev_arch (next_frame,