[rfc/rft] Remove DEPRECATED_PC_REQUIRED_RUN_BEFORE_USE

Ulrich Weigand
2007-10-05T13:28:11Z

Hello,

I was trying to understand the need for DEPRECATED_PC_REQUIRED_RUN_BEFORE_USE
for hppa targets. According to the most up-to-date discussion of this issue
I could find in the archives:
http://www.sourceware.org/ml/gdb/2004-12/msg00022.html
it appears this hack was needed to work around some issues with the SOM
symbol reader and treatment of shared libraries.

However, as we've in the meantime removed a lot of the SOM symbol reader
code (hpread.c etc) I'm wondering whether this hack is actually still
necessary ...

Joel, do you still have access to a HP/UX machine? It would be interesting
to see whether the following patch actually shows any regressions
these days. According to the above email, the gdb.base/so-indr-cl
test case is supposed to specifically check for this problem.

Thanks,
Ulrich

ChangeLog:

* breakpoint.c (breakpoint_sals_to_pc): Do not check for
DEPRECATED_PC_REQUIRED_RUN_BEFORE_USE.

* config/pa/tm-hppa.h: Delete file.
* config/pa/hppa64.mt: Do not set DEPRECATED_TM_FILE.
* config/pa/hppahpux.mt: Likewise.
* config/pa/hppa.mt: Likewise.
* config/pa/linux.mt: Likewise.
* hppa-tdep.c (hppa_pc_requires_run_before_use): Delete.

diff -urNp gdb-orig/gdb/breakpoint.c gdb-head/gdb/breakpoint.c
--- gdb-orig/gdb/breakpoint.c 2007-10-02 15:57:55.000000000 +0200
+++ gdb-head/gdb/breakpoint.c 2007-10-05 15:05:11.619076608 +0200
@@ -5483,33 +5483,7 @@ breakpoint_sals_to_pc (struct symtabs_an
{
int i;
for (i = 0; i < sals->nelts; i++)
- {
- resolve_sal_pc (&sals->sals[i]);
-
- /* It's possible for the PC to be nonzero, but still an illegal
- value on some targets.
-
- For example, on HP-UX if you start gdb, and before running the
- inferior you try to set a breakpoint on a shared library function
- "foo" where the inferior doesn't call "foo" directly but does
- pass its address to another function call, then we do find a
- minimal symbol for the "foo", but it's address is invalid.
- (Appears to be an index into a table that the loader sets up
- when the inferior is run.)
-
- Give the target a chance to bless sals.sals[i].pc before we
- try to make a breakpoint for it. */
-#ifdef DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE
- if (DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE (sals->sals[i].pc))
- {
- if (address == NULL)
- error (_("Cannot break without a running program."));
- else
- error (_("Cannot break on %s without a running program."),
- address);
- }
-#endif
- }
+ resolve_sal_pc (&sals->sals[i]);
}

static void
diff -urNp gdb-orig/gdb/config/pa/hppa64.mt gdb-head/gdb/config/pa/hppa64.mt
--- gdb-orig/gdb/config/pa/hppa64.mt 2007-06-21 17:29:56.000000000 +0200
+++ gdb-head/gdb/config/pa/hppa64.mt 2007-10-05 15:02:41.188002076 +0200
@@ -1,3 +1,2 @@
# Target: HP PA-RISC 2.0 running HPUX 11.00 in wide mode
TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o solib-som.o solib-pa64.o somread.o solib.o
-DEPRECATED_TM_FILE= tm-hppa.h
diff -urNp gdb-orig/gdb/config/pa/hppahpux.mt gdb-head/gdb/config/pa/hppahpux.mt
--- gdb-orig/gdb/config/pa/hppahpux.mt 2007-06-21 17:29:56.000000000 +0200
+++ gdb-head/gdb/config/pa/hppahpux.mt 2007-10-05 15:02:47.319048788 +0200
@@ -1,4 +1,3 @@
# Target: HP PA-RISC running hpux
MT_CFLAGS = -DPA_SOM_ONLY=1
TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o corelow.o somread.o solib-som.o solib-pa64.o solib.o
-DEPRECATED_TM_FILE= tm-hppa.h
diff -urNp gdb-orig/gdb/config/pa/hppa.mt gdb-head/gdb/config/pa/hppa.mt
--- gdb-orig/gdb/config/pa/hppa.mt 2007-06-21 17:29:56.000000000 +0200
+++ gdb-head/gdb/config/pa/hppa.mt 2007-10-05 15:02:51.879058584 +0200
@@ -1,2 +1 @@
TDEPFILES= hppa-tdep.o
-DEPRECATED_TM_FILE= tm-hppa.h
diff -urNp gdb-orig/gdb/config/pa/linux.mt gdb-head/gdb/config/pa/linux.mt
--- gdb-orig/gdb/config/pa/linux.mt 2007-06-21 17:29:56.000000000 +0200
+++ gdb-head/gdb/config/pa/linux.mt 2007-10-05 15:02:57.247083314 +0200
@@ -1,3 +1,2 @@
# Target: HP PA-RISC running Linux
TDEPFILES= hppa-tdep.o hppa-linux-tdep.o glibc-tdep.o solib.o solib-svr4.o symfile-mem.o
-DEPRECATED_TM_FILE=tm-hppa.h
diff -urNp gdb-orig/gdb/config/pa/tm-hppa.h gdb-head/gdb/config/pa/tm-hppa.h
--- gdb-orig/gdb/config/pa/tm-hppa.h 2007-08-27 15:47:55.000000000 +0200
+++ gdb-head/gdb/config/pa/tm-hppa.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,27 +0,0 @@
-/* Parameters for execution on any Hewlett-Packard PA-RISC machine.
-
- Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
-
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu).
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "regcache.h"
-
-extern int hppa_pc_requires_run_before_use (CORE_ADDR pc);
-#define DEPRECATED_PC_REQUIRES_RUN_BEFORE_USE(pc) hppa_pc_requires_run_before_use (pc)
diff -urNp gdb-orig/gdb/hppa-tdep.c gdb-head/gdb/hppa-tdep.c
--- gdb-orig/gdb/hppa-tdep.c 2007-09-10 20:36:42.000000000 +0200
+++ gdb-head/gdb/hppa-tdep.c 2007-10-05 15:04:04.091561855 +0200
@@ -68,10 +68,6 @@ const struct objfile_data *hppa_objfile_
#define UNWIND_ENTRY_SIZE 16
#define STUB_UNWIND_ENTRY_SIZE 8

-/* FIXME: brobecker 2002-11-07: We will likely be able to make the
- following functions static, once we hppa is partially multiarched. */
-int hppa_pc_requires_run_before_use (CORE_ADDR pc);
-
/* Routines to extract various sized constants out of hppa
instructions. */

@@ -2612,34 +2608,6 @@ unwind_command (char *exp, int from_tty)
}
}

-int
-hppa_pc_requires_run_before_use (CORE_ADDR pc)
-{
- /* Sometimes we may pluck out a minimal symbol that has a negative address.
-
- An example of this occurs when an a.out is linked against a foo.sl.
- The foo.sl defines a global bar(), and the a.out declares a signature
- for bar(). However, the a.out doesn't directly call bar(), but passes
- its address in another call.
-
- If you have this scenario and attempt to "break bar" before running,
- gdb will find a minimal symbol for bar() in the a.out. But that
- symbol's address will be negative. What this appears to denote is
- an index backwards from the base of the procedure linkage table (PLT)
- into the data linkage table (DLT), the end of which is contiguous
- with the start of the PLT. This is clearly not a valid address for
- us to set a breakpoint on.
-
- Note that one must be careful in how one checks for a negative address.
- 0xc0000000 is a legitimate address of something in a shared text
- segment, for example. Since I don't know what the possible range
- is of these "really, truly negative" addresses that come from the
- minimal symbols, I'm resorting to the gross hack of checking the
- top byte of the address for all 1's. Sigh. */
-
- return (!target_has_stack && (pc & 0xFF000000) == 0xFF000000);
-}
-
/* Return the GDB type object for the "standard" data type of data in
register REGNUM. */