From patchwork Wed Feb 25 15:27:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei-cheng, Wang" X-Patchwork-Id: 5284 Received: (qmail 93160 invoked by alias); 25 Feb 2015 15:28:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 93124 invoked by uid 89); 25 Feb 2015 15:28:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_FROM_URIBL_PCCC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pa0-f44.google.com Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 25 Feb 2015 15:28:08 +0000 Received: by paceu11 with SMTP id eu11so5940677pac.10 for ; Wed, 25 Feb 2015 07:28:06 -0800 (PST) X-Received: by 10.68.132.103 with SMTP id ot7mr6646705pbb.0.1424878086227; Wed, 25 Feb 2015 07:28:06 -0800 (PST) Received: from [192.168.2.3] ([123.110.214.155]) by mx.google.com with ESMTPSA id x1sm14897618pdl.51.2015.02.25.07.28.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 07:28:05 -0800 (PST) Message-ID: <54EDE9FF.3040608@gmail.com> Date: Wed, 25 Feb 2015 23:27:59 +0800 From: Wei-cheng Wang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: uweigand@de.ibm.com, gdb-patches@sourceware.org Subject: [PATCH 3/3 v2] Fast tracepoint for powerpc64le Hi, This changes are used to build unavailable frame id for tracepoint. It is related to this https://sourceware.org/ml/gdb-patches/2013-12/msg00535.html Thanks, Wei-cheng --- gdb/ChangeLog 2015-02-25 Wei-cheng Wang * rs6000-tdep.c (rs6000_frame_cache, rs6000_frame_this_id): Handle unavailable PC/SP to build unavailable frame. --- gdb/rs6000-tdep.c | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index dc27cfb..5f0cb67 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3152,11 +3152,17 @@ struct rs6000_frame_cache CORE_ADDR base; CORE_ADDR initial_sp; struct trad_frame_saved_reg *saved_regs; + + /* Set BASE_P to true if this frame cache is properly initialized. + Otherwise set to false because some registers or memory cannot + collected. */ + int base_p; }; static struct rs6000_frame_cache * rs6000_frame_cache (struct frame_info *this_frame, void **this_cache) { + volatile struct gdb_exception ex; struct rs6000_frame_cache *cache; struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -3171,19 +3177,28 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache) (*this_cache) = cache; cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); - func = get_frame_func (this_frame); - pc = get_frame_pc (this_frame); - skip_prologue (gdbarch, func, pc, &fdata); - - /* Figure out the parent's stack pointer. */ - - /* NOTE: cagney/2002-04-14: The ->frame points to the inner-most - address of the current frame. Things might be easier if the - ->frame pointed to the outer-most address of the frame. In - the mean time, the address of the prev frame is used as the - base address of this frame. */ - cache->base = get_frame_register_unsigned - (this_frame, gdbarch_sp_regnum (gdbarch)); + TRY_CATCH (ex, RETURN_MASK_ERROR) + { + func = get_frame_func (this_frame); + pc = get_frame_pc (this_frame); + skip_prologue (gdbarch, func, pc, &fdata); + + /* Figure out the parent's stack pointer. */ + + /* NOTE: cagney/2002-04-14: The ->frame points to the inner-most + address of the current frame. Things might be easier if the + ->frame pointed to the outer-most address of the frame. In + the mean time, the address of the prev frame is used as the + base address of this frame. */ + cache->base = get_frame_register_unsigned + (this_frame, gdbarch_sp_regnum (gdbarch)); + } + if (ex.reason < 0) + { + if (ex.error != NOT_AVAILABLE_ERROR) + throw_exception (ex); + return (*this_cache); + } /* If the function appears to be frameless, check a couple of likely indicators that we have simply failed to find the frame setup. @@ -3332,6 +3347,7 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache) cache->initial_sp = get_frame_register_unsigned (this_frame, fdata.alloca_reg); + cache->base_p = 1; return cache; } @@ -3341,6 +3357,13 @@ rs6000_frame_this_id (struct frame_info *this_frame, void **this_cache, { struct rs6000_frame_cache *info = rs6000_frame_cache (this_frame, this_cache); + + if (!info->base_p) + { + (*this_id) = frame_id_build_unavailable_stack (0); + return; + } + /* This marks the outermost frame. */ if (info->base == 0) return;