This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMITTED][RFC/TileGX 2/6] simplify the handling of skip prologue for plt stub


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);
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]