Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: Andrew Cagney <cagney@gnu.org>
Cc: Daniel Jacobowitz <drow@false.org>, gdb-patches@sources.redhat.com
Subject: Re: [patch/rfc] New program_changed event, cleanup some HPUXHPPA mess
Date: Thu, 03 Jun 2004 17:41:00 -0000	[thread overview]
Message-ID: <20040603174102.GP601@tausq.org> (raw)
In-Reply-To: <40BBDC52.7060106@gnu.org>

> In that case, since the cache was originally added to work around what 
> was a >>O(1) lookup, it should no longer be needed.

There were two parts to this actually, the first part was the symbol
caching, but there is also some stuff related to how the hp cxx abi
support worked that required some cleaning up when a new symbol table
gets loaded.

Here's a new patch for getting rid of the symbol caching. I'll see how
best to handle the hp c++ abi support... 

ok to apply?

randolph

2004-06-03  Randolph Chung  <tausq@debian.org>

	* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline) 
	(hppa_hpux_skip_trampoline_code): Don't cache symbol values.
	* hppa-linux-tdep.c (hppa_linux_in_dyncall): Likewise.
	* hppa-tdep.c (hppa_symbol_address): New function definition.
	* hppa-tdep.h (hppa_symbol_address): New function declaration.

Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.19
diff -u -p -r1.19 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c	26 May 2004 05:31:39 -0000	1.19
+++ hppa-hpux-tdep.c	3 Jun 2004 17:32:47 -0000
@@ -61,32 +61,10 @@ hppa32_hpux_in_solib_call_trampoline (CO
 {
   struct minimal_symbol *minsym;
   struct unwind_table_entry *u;
-  static CORE_ADDR dyncall = 0;
-  static CORE_ADDR sr4export = 0;
-
-  /* FIXME XXX - dyncall and sr4export must be initialized whenever we get a
-     new exec file */
 
   /* First see if PC is in one of the two C-library trampolines.  */
-  if (!dyncall)
-    {
-      minsym = lookup_minimal_symbol ("$$dyncall", NULL, NULL);
-      if (minsym)
-	dyncall = SYMBOL_VALUE_ADDRESS (minsym);
-      else
-	dyncall = -1;
-    }
-
-  if (!sr4export)
-    {
-      minsym = lookup_minimal_symbol ("_sr4export", NULL, NULL);
-      if (minsym)
-	sr4export = SYMBOL_VALUE_ADDRESS (minsym);
-      else
-	sr4export = -1;
-    }
-
-  if (pc == dyncall || pc == sr4export)
+  if (pc == hppa_symbol_address("$$dyncall") 
+      || pc == hppa_symbol_address("_sr4export"))
     return 1;
 
   minsym = lookup_minimal_symbol_by_pc (pc);
@@ -295,45 +273,12 @@ hppa_hpux_skip_trampoline_code (CORE_ADD
 {
   long orig_pc = pc;
   long prev_inst, curr_inst, loc;
-  static CORE_ADDR dyncall = 0;
-  static CORE_ADDR dyncall_external = 0;
-  static CORE_ADDR sr4export = 0;
   struct minimal_symbol *msym;
   struct unwind_table_entry *u;
 
-  /* FIXME XXX - dyncall and sr4export must be initialized whenever we get a
-     new exec file */
-
-  if (!dyncall)
-    {
-      msym = lookup_minimal_symbol ("$$dyncall", NULL, NULL);
-      if (msym)
-	dyncall = SYMBOL_VALUE_ADDRESS (msym);
-      else
-	dyncall = -1;
-    }
-
-  if (!dyncall_external)
-    {
-      msym = lookup_minimal_symbol ("$$dyncall_external", NULL, NULL);
-      if (msym)
-	dyncall_external = SYMBOL_VALUE_ADDRESS (msym);
-      else
-	dyncall_external = -1;
-    }
-
-  if (!sr4export)
-    {
-      msym = lookup_minimal_symbol ("_sr4export", NULL, NULL);
-      if (msym)
-	sr4export = SYMBOL_VALUE_ADDRESS (msym);
-      else
-	sr4export = -1;
-    }
-
   /* Addresses passed to dyncall may *NOT* be the actual address
      of the function.  So we may have to do something special.  */
-  if (pc == dyncall)
+  if (pc == hppa_symbol_address("$$dyncall"))
     {
       pc = (CORE_ADDR) read_register (22);
 
@@ -343,12 +288,12 @@ hppa_hpux_skip_trampoline_code (CORE_ADD
       if (pc & 0x2)
 	pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, TARGET_PTR_BIT / 8);
     }
-  if (pc == dyncall_external)
+  if (pc == hppa_symbol_address("$$dyncall_external"))
     {
       pc = (CORE_ADDR) read_register (22);
       pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, TARGET_PTR_BIT / 8);
     }
-  else if (pc == sr4export)
+  else if (pc == hppa_symbol_address("_sr4export"))
     pc = (CORE_ADDR) (read_register (22));
 
   /* Get the unwind descriptor corresponding to PC, return zero
Index: hppa-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-linux-tdep.c,v
retrieving revision 1.6
diff -u -p -r1.6 hppa-linux-tdep.c
--- hppa-linux-tdep.c	26 May 2004 05:51:39 -0000	1.6
+++ hppa-linux-tdep.c	3 Jun 2004 17:32:47 -0000
@@ -161,21 +164,7 @@ insns_match_pattern (CORE_ADDR pc,
 static int
 hppa_linux_in_dyncall (CORE_ADDR pc)
 {
-  static CORE_ADDR dyncall = 0;
-
-  /* FIXME: if we switch exec files, dyncall should be reinitialized */
-  if (!dyncall)
-    {
-      struct minimal_symbol *minsym;
-
-      minsym = lookup_minimal_symbol ("$$dyncall", NULL, NULL);
-      if (minsym)
-	dyncall = SYMBOL_VALUE_ADDRESS (minsym);
-      else
-	dyncall = -1;
-    }
-
-  return pc == dyncall;
+  return pc == hppa_symbol_address("$$dyncall");
 }
 
 /* There are several kinds of "trampolines" that we need to deal with:
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.166
diff -u -p -r1.166 hppa-tdep.c
--- hppa-tdep.c	30 May 2004 14:11:00 -0000	1.166
+++ hppa-tdep.c	3 Jun 2004 17:32:48 -0000
@@ -262,6 +262,18 @@ hppa_extract_17 (unsigned word)
 		      hppa_get_field (word, 11, 15) << 11 |
 		      (word & 0x1) << 16, 17) << 2;
 }
+
+CORE_ADDR 
+hppa_symbol_address(const char *sym)
+{
+  struct minimal_symbol *minsym;
+
+  minsym = lookup_minimal_symbol (sym, NULL, NULL);
+  if (minsym)
+    return SYMBOL_VALUE_ADDRESS (minsym);
+  else
+    return (CORE_ADDR)-1;
+}
 \f
 
 /* Compare the start address for two unwind entries returning 1 if 
Index: hppa-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.h,v
retrieving revision 1.11
diff -u -p -r1.11 hppa-tdep.h
--- hppa-tdep.h	30 May 2004 14:31:29 -0000	1.11
+++ hppa-tdep.h	3 Jun 2004 17:32:48 -0000
@@ -190,6 +195,7 @@ int hppa_extract_21 (unsigned);
 int hppa_extract_14 (unsigned);
 int hppa_low_sign_extend (unsigned int, unsigned int);
 int hppa_sign_extend (unsigned int, unsigned int);
+CORE_ADDR hppa_symbol_address(const char *sym);
 
 void
 hppa_frame_prev_register_helper (struct frame_info *next_frame,


  parent reply	other threads:[~2004-06-03 17:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-19 20:40 Randolph Chung
2004-05-19 21:37 ` Joel Brobecker
2004-05-19 21:44   ` Randolph Chung
2004-05-19 22:06     ` Joel Brobecker
2004-05-21 18:48 ` [patch/rfc] New program_changed event, cleanup some HPUXHPPAmess Andrew Cagney
2004-05-21 19:02   ` [patch/rfc] New program_changed event, cleanup some HPUXHPPA mess Randolph Chung
     [not found]     ` <40AE6260.2090205@gnu.org>
2004-05-26  5:27       ` Randolph Chung
2004-05-26 13:25         ` Daniel Jacobowitz
2004-05-26 15:35           ` Randolph Chung
2004-05-26 16:48             ` Daniel Jacobowitz
2004-05-26 17:54             ` [patch/rfc] New program_changed event, cleanup some HPUXHPPAmess Andrew Cagney
2004-05-28 23:43               ` [patch/rfc] New program_changed event, cleanup some HPUXHPPA mess Daniel Jacobowitz
2004-05-31 19:43                 ` [patch/rfc] New program_changed event, cleanup some HPUXHPPAmess Andrew Cagney
2004-05-31 20:43                   ` [patch/rfc] New program_changed event, cleanup some HPUXHPPA mess Daniel Jacobowitz
2004-06-01  1:31                     ` Andrew Cagney
2004-06-01  1:40                       ` Daniel Jacobowitz
2004-06-03 17:41                       ` Randolph Chung [this message]
2004-06-04 18:26                         ` Andrew Cagney
2004-05-24 15:45   ` Randolph Chung
2004-05-24 18:55     ` [patch/rfc] New program_changed event, cleanup some HPUXHPPAmess Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040603174102.GP601@tausq.org \
    --to=randolph@tausq.org \
    --cc=cagney@gnu.org \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox