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]

FYI: a couple minsym usage fixes


I'm checking this in on the trunk.

This is extracted from patch 16 in my recent series:

http://sourceware.org/ml/gdb-patches/2011-12/msg00492.html

This just changes jit.c and hppa-hpux-tdep.c to use the correct APIs to
interact with minimal symbols.

Tom

2011-12-21  Tom Tromey  <tromey@redhat.com>

	* hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence): Use
	ALL_OBJFILE_MSYMBOLS.
	(hppa_hpux_find_dummy_bpaddr): Likewise.
	* jit.c (jit_object_close_impl): Use
	terminate_minimal_symbol_table.

Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.81
diff -u -r1.81 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c	18 Mar 2011 18:52:30 -0000	1.81
+++ hppa-hpux-tdep.c	21 Dec 2011 21:32:55 -0000
@@ -957,7 +957,6 @@
   struct hppa_objfile_private *priv;
   CORE_ADDR addr;
   struct minimal_symbol *msym;
-  int i;
 
   sec = find_pc_section (pc);
   obj = sec->objfile;
@@ -980,7 +979,7 @@
      scheme; try to read in blocks of code, and look for a "bve,n (rp)" 
      instruction.  These are likely to occur at the end of functions, so
      we only look at the last two instructions of each function.  */
-  for (i = 0, msym = obj->msymbols; i < obj->minimal_symbol_count; i++, msym++)
+  ALL_OBJFILE_MSYMBOLS (obj, msym)
     {
       CORE_ADDR begin, end;
       char *name;
@@ -1088,7 +1087,6 @@
   struct unwind_table_entry *u;
   struct minimal_symbol *msym;
   CORE_ADDR func;
-  int i;
 
   sec = find_pc_section (addr);
   if (sec)
@@ -1108,9 +1106,7 @@
 	 work.  */
 
       find_pc_partial_function (addr, NULL, &func, NULL);
-      for (i = 0, msym = sec->objfile->msymbols;
-      	   i < sec->objfile->minimal_symbol_count;
-	   i++, msym++)
+      ALL_OBJFILE_MSYMBOLS (sec->objfile, msym)
 	{
 	  u = find_unwind_entry (SYMBOL_VALUE_ADDRESS (msym));
 	  if (func != SYMBOL_VALUE_ADDRESS (msym) 
Index: jit.c
===================================================================
RCS file: /cvs/src/src/gdb/jit.c,v
retrieving revision 1.23
diff -u -r1.23 jit.c
--- jit.c	29 Nov 2011 08:30:29 -0000	1.23
+++ jit.c	21 Dec 2011 21:32:55 -0000
@@ -694,9 +694,7 @@
   objfile = allocate_objfile (NULL, 0);
   objfile->gdbarch = target_gdbarch;
 
-  objfile->msymbols = obstack_alloc (&objfile->objfile_obstack,
-                                     sizeof (struct minimal_symbol));
-  memset (objfile->msymbols, 0, sizeof (struct minimal_symbol));
+  terminate_minimal_symbol_table (objfile);
 
   xfree (objfile->name);
   objfile->name = xstrdup ("<< JIT compiled code >>");


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