This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[COMMITTED][RFC/TileGX 2/6] simplify the handling of skip prologue for plt stub
- From: Jiong Wang <jiwang at tilera dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Yao Qi <yao at codesourcery dot com>, Joel Brobecker <brobecker at adacore dot com>, <gdb-patches at sourceware dot org>, Walter Lee <walt at tilera dot com>
- Date: Sat, 2 Mar 2013 09:40:34 +0800
- Subject: [COMMITTED][RFC/TileGX 2/6] simplify the handling of skip prologue for plt stub
- References: <50F91516.6010204@tilera.com> <20130118131511.GF3564@adacore.com> <50F9664D.2090008@tilera.com> <511F0FE9.8030300@codesourcery.com> <51243991.4040304@tilera.com> <51244CBA.4000009@codesourcery.com> <512623BE.2030608@tilera.com> <51309167.5050608@redhat.com> <5130B63A.1060304@tilera.com> <5130D06A.9000701@redhat.com>
On 03/01/2013 11:59 PM, Pedro Alves wrote:
"improve" is a "Why?", and subjective. ChangeLogs are objective, and document
the "What" changed. I suggest:
* tilegx-tdep.c (tilegx_analyze_prologue): Limit bundle reading to END_ADDR.
(tilegx_skip_prologue): Limit prologue analysis to section end.
tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
- CORE_ADDR func_start;
+ CORE_ADDR func_start, end_pc;
+ struct obj_section *s = NULL;
No need to initialize 's' here, it's unconditionally initialized below.
+ s = find_pc_section (start_pc);
OK with these changes.
Thanks.
thanks, all fixed, and committed.
--
Regards,
Jiong. Wang
Tilera Corporation.
Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.15197
diff -u -r1.15197 ChangeLog
--- gdb/ChangeLog 1 Mar 2013 21:18:18 -0000 1.15197
+++ gdb/ChangeLog 2 Mar 2013 01:31:04 -0000
@@ -1,3 +1,10 @@
+2013-03-01 Jiong Wang <jiwang@tilera.com>
+ Pedro Alves <palves@redhat.com>
+
+ * tilegx-tdep.c (tilegx_analyze_prologue): Limit bundle reading
+ to END_ADDR.
+ (tilegx_skip_prologue): Limit prologue analysis to section end.
+
2013-03-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2loc.c (call_site_find_chain_1): New variable save_callee_pc,
Index: gdb/tilegx-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/tilegx-tdep.c,v
retrieving revision 1.9
diff -u -r1.9 tilegx-tdep.c
--- gdb/tilegx-tdep.c 1 Mar 2013 10:45:28 -0000 1.9
+++ gdb/tilegx-tdep.c 2 Mar 2013 01:31:29 -0000
@@ -433,6 +433,8 @@
if (instbuf_size > size_on_same_page)
instbuf_size = size_on_same_page;
+
+ instbuf_size = min (instbuf_size, (end_addr - next_addr));
instbuf_start = next_addr;
status = safe_frame_unwind_memory (next_frame, instbuf_start,
@@ -745,7 +747,8 @@
static CORE_ADDR
tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
- CORE_ADDR func_start;
+ CORE_ADDR func_start, end_pc;
+ struct obj_section *s;
/* This is the preferred method, find the end of the prologue by
using the debugging information. */
@@ -758,10 +761,16 @@
return max (start_pc, post_prologue_pc);
}
+ /* Don't straddle a section boundary. */
+ s = find_pc_section (start_pc);
+ end_pc = start_pc + 8 * TILEGX_BUNDLE_SIZE_IN_BYTES;
+ if (s != NULL)
+ end_pc = min (end_pc, obj_section_endaddr (s));
+
/* Otherwise, try to skip prologue the hard way. */
return tilegx_analyze_prologue (gdbarch,
start_pc,
- start_pc + 8 * TILEGX_BUNDLE_SIZE_IN_BYTES,
+ end_pc,
NULL, NULL);
}