From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6411 invoked by alias); 21 Jun 2013 11:42:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 6397 invoked by uid 89); 21 Jun 2013 11:42:33 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_BJ,TW_EG autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 21 Jun 2013 11:42:30 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UpzjY-000070-2B from Maciej_Rozycki@mentor.com ; Fri, 21 Jun 2013 04:42:28 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 21 Jun 2013 04:42:27 -0700 Received: from [172.30.64.40] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Fri, 21 Jun 2013 12:42:21 +0100 Date: Fri, 21 Jun 2013 11:43:00 -0000 From: "Maciej W. Rozycki" To: Pedro Alves CC: Tom Tromey , Richard Sandiford , Catherine Moore , Subject: Re: [PING^2][PATCH] in_plt_section: support alternate stub section names In-Reply-To: <51C331B0.1010502@redhat.com> Message-ID: References: <87wqu19y1x.fsf@fleche.redhat.com> <51C331B0.1010502@redhat.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2013-06/txt/msg00586.txt.bz2 Pedro, Thanks for your review. > > Index: gdb-fsf-trunk-quilt/gdb/mips-tdep.c > > =================================================================== > > --- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.c 2013-06-19 16:54:49.000000000 +0100 > > +++ gdb-fsf-trunk-quilt/gdb/mips-tdep.c 2013-06-19 16:55:00.280199593 +0100 > > @@ -3628,12 +3628,7 @@ mips_stub_frame_sniffer (const struct fr > > if (in_plt_section (pc, NULL)) > > return 1; > > > > - /* Binutils for MIPS puts lazy resolution stubs into .MIPS.stubs. */ > > - s = find_pc_section (pc); > > - > > - if (s != NULL > > - && strcmp (bfd_get_section_name (s->objfile->obfd, s->the_bfd_section), > > - ".MIPS.stubs") == 0) > > + if (in_plt_section (pc, ".MIPS.stubs")) > > return 1; > > Quite honestly, this looks like an odd API to me. If all > MIPS callers will have to pass in ".MIPS.stubs", then it just > looks like in_plt_section becomes a convenience for "is > pc in section. Well, I have focused here, perhaps mistakenly, on the intended use of the call -- to determine whether the PC is in a dynamic function call trampoline. Contrary to the description we currently have at in_plt_section, .plt is not -- per SVR4 ABI -- a standard name of the trampoline section. The name (and the presence of any such section in the first place) is actually left to processor-specific ABI supplements. For many processors .plt has indeed been the choice, but for MIPS .plt has only recently been added as an ABI extension. The original MIPS SVR4 processor-specific ABI supplement defined no specific section name to be used for its .plt equivalent. I can't easily check what IRIX tools chose for this section's name (if anything; in a final executable you can have ELF segments whose contents are not mapped to any section). Binutils chose .stubs long ago and more recently switched to .MIPS.stubs. This may well be the same names IRIX used in different versions (compare .reginfo vs .MIPS.options standard MIPS SVR4 psABI sections). That written... > It'd make more sense to me to refactor in_plt_section to > something like this, somewhere: > > int > pc_in_section (CORE_ADDR pc, const char *name) > { > struct obj_section *s; > int retval = 0; > > s = find_pc_section (pc); > > retval = (s != NULL > && s->the_bfd_section->name != NULL > && strcmp (s->the_bfd_section->name, name) == 0); > return (retval); > } > > And then: > > /* In SVR4, we recognize a trampoline by it's section name. > That is, if the pc is in a section named ".plt" then we are in > a trampoline. */ > > int > in_plt_section (CORE_ADDR pc) > { > return pc_in_section (pc, ".plt"); > } > > And then MIPS would have somewhere, mips-tdep.c perhaps, > something like: > > int > in_mips_stubs_section (CORE_ADDR pc) > { > return pc_in_section (pc, ".MIPS.stubs"); > } > > Or > > #define MIPS_STUBS_SECTION ".MIPS.stubs" > pc_in_section (pc, MIPS_STUBS_SECTION); > > As bonus, you end up with just one place that > can typo the section name. > > Perhaps missed the plan to make in_plt_section fetch the > section name from elsewhere, instead of taking it as argument, > so callers in common code don't care? ... actually I like your suggestion, especially as it seems pc_in_section will have more uses than just to check for .plt or .MIPS.stubs. What I don't like is the extra call nesting for something that is otherwise rather a trivial piece. I'm not that particularly fond of macros either. How about this change then? 2013-06-21 Maciej W. Rozycki gdb/ * objfiles.h (pc_in_section): New prototype. (in_plt_section): Remove prototype. * objfiles.c (pc_in_section): New function. (in_plt_section): Remove function. * solib-svr4.h (in_plt_section): New function. * aarch64-tdep.c (aarch64_stub_unwind_sniffer): Update in_plt_section call accordingly. * arm-symbian-tdep.c (arm_symbian_skip_trampoline_code): Likewise. * arm-tdep.c (arm_stub_unwind_sniffer): Likewise. * hppa-linux-tdep.c (hppa_linux_find_global_pointer): Likewise. * hppa-tdep.c (hppa_in_solib_call_trampoline): Likewise. (hppa_skip_trampoline_code): Likewise. * hppabsd-tdep.c (hppabsd_find_global_pointer): Likewise. * nios2-tdep.c (nios2_stub_frame_sniffer): Likewise. * nto-tdep.c (nto_relocate_section_addresses): Likewise. * s390-tdep.c (s390_stub_frame_sniffer): Likewise. * sh-tdep.c (sh_stub_unwind_sniffer): Likewise. * solib-dsbt.c (dsbt_in_dynsym_resolve_code): Likewise. * solib-frv.c (frv_in_dynsym_resolve_code): Likewise. * solib-svr4.c (svr4_in_dynsym_resolve_code): Likewise. * solib-target.c (solib_target_in_dynsym_resolve_code): Likewise. * sparc-tdep.c (sparc_analyze_prologue): Likewise. * tic6x-tdep.c (tic6x_stub_unwind_sniffer): Likewise. * hppa-hpux-tdep.c (in_opd_section): Remove function. (hppa64_hpux_find_global_pointer): Use pc_in_section rather than in_opd_section. * mips-tdep.h (in_mips_stubs_section): New function. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Call in_mips_stubs_section. Remove unused `name' argument. Return 1 rather than the low 16-bit halfword of any instruction examined. (mips_linux_in_dynsym_resolve_code): Update mips_linux_in_dynsym_stub call accordingly. * mips-tdep.c (mips_stub_frame_sniffer): Use in_mips_stubs_section rather than an equivalent hand-coded sequence. Maciej gdb-mips-in-stubs-section.diff Index: gdb-fsf-trunk-quilt/gdb/aarch64-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/aarch64-tdep.c 2013-05-30 17:44:44.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/aarch64-tdep.c 2013-06-21 01:10:49.551246100 +0100 @@ -39,6 +39,7 @@ #include "dwarf2-frame.h" #include "gdbtypes.h" #include "prologue-value.h" +#include "solib-svr4.h" #include "target-descriptions.h" #include "user-regs.h" #include "language.h" @@ -1094,7 +1095,7 @@ aarch64_stub_unwind_sniffer (const struc gdb_byte dummy[4]; addr_in_block = get_frame_address_in_block (this_frame); - if (in_plt_section (addr_in_block, NULL) + if (in_plt_section (addr_in_block) /* We also use the stub winder if the target memory is unreadable to avoid having the prologue unwinder trying to read it. */ || target_read_memory (get_frame_pc (this_frame), dummy, 4) != 0) Index: gdb-fsf-trunk-quilt/gdb/arm-symbian-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/arm-symbian-tdep.c 2013-01-30 22:34:28.000000000 +0000 +++ gdb-fsf-trunk-quilt/gdb/arm-symbian-tdep.c 2013-06-21 01:04:03.021206927 +0100 @@ -22,6 +22,7 @@ #include "objfiles.h" #include "osabi.h" #include "solib.h" +#include "solib-svr4.h" #include "solib-target.h" #include "target.h" #include "elf-bfd.h" @@ -38,7 +39,7 @@ arm_symbian_skip_trampoline_code (struct CORE_ADDR dest; gdb_byte buf[4]; - if (!in_plt_section (pc, NULL)) + if (!in_plt_section (pc)) return 0; if (target_read_memory (pc, buf, 4) != 0) Index: gdb-fsf-trunk-quilt/gdb/arm-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/arm-tdep.c 2013-05-10 17:01:47.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/arm-tdep.c 2013-06-21 01:10:07.041186876 +0100 @@ -41,6 +41,7 @@ #include "gdbtypes.h" #include "prologue-value.h" #include "remote.h" +#include "solib-svr4.h" #include "target-descriptions.h" #include "user-regs.h" #include "observer.h" @@ -2907,7 +2908,7 @@ arm_stub_unwind_sniffer (const struct fr gdb_byte dummy[4]; addr_in_block = get_frame_address_in_block (this_frame); - if (in_plt_section (addr_in_block, NULL) + if (in_plt_section (addr_in_block) /* We also use the stub winder if the target memory is unreadable to avoid having the prologue unwinder trying to read it. */ || target_read_memory (get_frame_pc (this_frame), dummy, 4) != 0) Index: gdb-fsf-trunk-quilt/gdb/hppa-hpux-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/hppa-hpux-tdep.c 2013-05-10 17:01:47.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/hppa-hpux-tdep.c 2013-06-21 02:02:12.741232587 +0100 @@ -65,20 +65,6 @@ extern void _initialize_hppa_hpux_tdep (void); extern initialize_file_ftype _initialize_hppa_hpux_tdep; -static int -in_opd_section (CORE_ADDR pc) -{ - struct obj_section *s; - int retval = 0; - - s = find_pc_section (pc); - - retval = (s != NULL - && s->the_bfd_section->name != NULL - && strcmp (s->the_bfd_section->name, ".opd") == 0); - return (retval); -} - /* Return one if PC is in the call path of a trampoline, else return zero. Note we return one for *any* call trampoline (long-call, arg-reloc), not @@ -798,7 +784,7 @@ hppa64_hpux_find_global_pointer (struct faddr = value_as_address (function); - if (in_opd_section (faddr)) + if (pc_in_section (faddr, ".opd")) { target_read_memory (faddr, buf, sizeof (buf)); return extract_unsigned_integer (&buf[24], 8, byte_order); Index: gdb-fsf-trunk-quilt/gdb/hppa-linux-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/hppa-linux-tdep.c 2013-03-08 11:08:54.000000000 +0000 +++ gdb-fsf-trunk-quilt/gdb/hppa-linux-tdep.c 2013-06-21 00:18:52.351224271 +0100 @@ -356,7 +356,7 @@ hppa_linux_find_global_pointer (struct g /* If the address is in the plt section, then the real function hasn't yet been fixed up by the linker so we cannot determine the gp of that function. */ - if (in_plt_section (faddr, NULL)) + if (in_plt_section (faddr)) return 0; faddr_sect = find_pc_section (faddr); Index: gdb-fsf-trunk-quilt/gdb/hppa-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/hppa-tdep.c 2013-05-10 17:01:47.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/hppa-tdep.c 2013-06-21 01:12:08.051202254 +0100 @@ -39,6 +39,7 @@ #include "gdbcmd.h" #include "gdbtypes.h" #include "objfiles.h" +#include "solib-svr4.h" #include "hppa-tdep.h" static int hppa_debug = 0; @@ -2861,7 +2862,7 @@ hppa_in_solib_call_trampoline (struct gd unsigned int insn[HPPA_MAX_INSN_PATTERN_LEN]; struct unwind_table_entry *u; - if (in_plt_section (pc, name) || hppa_in_dyncall (pc)) + if (in_plt_section (pc) || hppa_in_dyncall (pc)) return 1; /* The GNU toolchain produces linker stubs without unwind @@ -2918,13 +2919,13 @@ hppa_skip_trampoline_code (struct frame_ /* fallthrough */ } - if (in_plt_section (pc, NULL)) + if (in_plt_section (pc)) { pc = read_memory_typed_address (pc, func_ptr_type); /* If the PLT slot has not yet been resolved, the target will be the PLT stub. */ - if (in_plt_section (pc, NULL)) + if (in_plt_section (pc)) { /* Sanity check: are we pointing to the PLT stub? */ if (!hppa_match_insns (gdbarch, pc, hppa_plt_stub, insn)) Index: gdb-fsf-trunk-quilt/gdb/hppabsd-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/hppabsd-tdep.c 2013-01-30 22:34:28.000000000 +0000 +++ gdb-fsf-trunk-quilt/gdb/hppabsd-tdep.c 2013-06-21 00:19:35.361228186 +0100 @@ -47,7 +47,7 @@ hppabsd_find_global_pointer (struct gdba /* If the address is in the .plt section, then the real function hasn't yet been fixed up by the linker so we cannot determine the Global Pointer for that function. */ - if (in_plt_section (faddr, NULL)) + if (in_plt_section (faddr)) return 0; faddr_sec = find_pc_section (faddr); Index: gdb-fsf-trunk-quilt/gdb/mips-linux-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/mips-linux-tdep.c 2013-06-19 16:54:49.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/mips-linux-tdep.c 2013-06-21 00:19:51.859933668 +0100 @@ -30,6 +30,7 @@ #include "trad-frame.h" #include "tramp-frame.h" #include "gdbtypes.h" +#include "objfiles.h" #include "solib.h" #include "solib-svr4.h" #include "solist.h" @@ -666,25 +667,34 @@ mips_linux_core_read_description (struct /* Check the code at PC for a dynamic linker lazy resolution stub. - Because they aren't in the .plt section, we pattern-match on the - code generated by GNU ld. They look like this: + GNU ld for MIPS has put lazy resolution stubs into a ".MIPS.stubs" + section uniformly since version 2.15. If the pc is in that section, + then we are in such a stub. Before that ".stub" was used in 32-bit + ELF binaries, however we do not bother checking for that since we + have never had and that case should be extremely rare these days. + Instead we pattern-match on the code generated by GNU ld. They look + like this: lw t9,0x8010(gp) addu t7,ra jalr t9,ra addiu t8,zero,INDEX - (with the appropriate doubleword instructions for N64). Also - return the dynamic symbol index used in the last instruction. */ + (with the appropriate doubleword instructions for N64). As any lazy + resolution stubs in microMIPS binaries will always be in a + ".MIPS.stubs" section we only ever verify standard MIPS patterns. */ static int -mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name) +mips_linux_in_dynsym_stub (CORE_ADDR pc) { gdb_byte buf[28], *p; ULONGEST insn, insn1; int n64 = (mips_abi (target_gdbarch ()) == MIPS_ABI_N64); enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + if (in_mips_stubs_section (pc)) + return 1; + read_memory (pc - 12, buf, 28); if (n64) @@ -742,7 +752,7 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, return 0; } - return (insn & 0xffff); + return 1; } /* Return non-zero iff PC belongs to the dynamic linker resolution @@ -756,9 +766,10 @@ mips_linux_in_dynsym_resolve_code (CORE_ if (svr4_in_dynsym_resolve_code (pc)) return 1; - /* Pattern match for the stub. It would be nice if there were a - more efficient way to avoid this check. */ - if (mips_linux_in_dynsym_stub (pc, NULL)) + /* Likewise for the stubs. They live in the .MIPS.stubs section these + days, so we check if the PC is within, than fall back to a pattern + match. */ + if (mips_linux_in_dynsym_stub (pc)) return 1; return 0; Index: gdb-fsf-trunk-quilt/gdb/mips-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.c 2013-06-19 16:54:49.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/mips-tdep.c 2013-06-21 01:13:24.059825608 +0100 @@ -52,6 +52,7 @@ #include "infcall.h" #include "floatformat.h" #include "remote.h" +#include "solib-svr4.h" #include "target-descriptions.h" #include "dwarf2-frame.h" #include "user-regs.h" @@ -3625,15 +3626,7 @@ mips_stub_frame_sniffer (const struct fr if (target_read_memory (get_frame_pc (this_frame), dummy, 4) != 0) return 1; - if (in_plt_section (pc, NULL)) - return 1; - - /* Binutils for MIPS puts lazy resolution stubs into .MIPS.stubs. */ - s = find_pc_section (pc); - - if (s != NULL - && strcmp (bfd_get_section_name (s->objfile->obfd, s->the_bfd_section), - ".MIPS.stubs") == 0) + if (in_plt_section (pc) || in_mips_stubs_section (pc)) return 1; /* Calling a PIC function from a non-PIC function passes through a Index: gdb-fsf-trunk-quilt/gdb/mips-tdep.h =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.h 2013-06-19 16:54:49.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/mips-tdep.h 2013-06-21 01:14:02.561228728 +0100 @@ -20,6 +20,8 @@ #ifndef MIPS_TDEP_H #define MIPS_TDEP_H +#include "objfiles.h" + struct gdbarch; /* All the possible MIPS ABIs. */ @@ -187,4 +189,11 @@ extern void mips_write_pc (struct regcac extern struct target_desc *mips_tdesc_gp32; extern struct target_desc *mips_tdesc_gp64; +/* Return non-zero if PC is in the MIPS SVR4 lazy-binding stub section. */ +static inline int +in_mips_stubs_section (CORE_ADDR pc) +{ + return pc_in_section (pc, ".MIPS.stubs"); +} + #endif /* MIPS_TDEP_H */ Index: gdb-fsf-trunk-quilt/gdb/nios2-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/nios2-tdep.c 2013-05-10 17:01:48.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/nios2-tdep.c 2013-06-21 01:14:22.059908100 +0100 @@ -41,6 +41,7 @@ #include "gdb_assert.h" #include "infcall.h" #include "regset.h" +#include "solib-svr4.h" #include "target-descriptions.h" /* To get entry_point_address. */ @@ -1324,7 +1325,7 @@ nios2_stub_frame_sniffer (const struct f if (target_read_memory (get_frame_pc (this_frame), dummy, 4) != 0) return 1; - if (in_plt_section (pc, NULL)) + if (in_plt_section (pc)) return 1; return 0; Index: gdb-fsf-trunk-quilt/gdb/nto-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/nto-tdep.c 2013-01-30 22:34:28.000000000 +0000 +++ gdb-fsf-trunk-quilt/gdb/nto-tdep.c 2013-06-21 00:24:19.870386783 +0100 @@ -318,7 +318,7 @@ nto_relocate_section_addresses (struct s int nto_in_dynsym_resolve_code (CORE_ADDR pc) { - if (in_plt_section (pc, NULL)) + if (in_plt_section (pc)) return 1; return 0; } Index: gdb-fsf-trunk-quilt/gdb/objfiles.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/objfiles.c 2013-06-19 16:45:58.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/objfiles.c 2013-06-21 00:25:44.880419344 +0100 @@ -1410,12 +1410,10 @@ find_pc_section (CORE_ADDR pc) } -/* In SVR4, we recognize a trampoline by it's section name. - That is, if the pc is in a section named ".plt" then we are in - a trampoline. */ +/* Return non-zero if PC is in a section called NAME. */ int -in_plt_section (CORE_ADDR pc, char *name) +pc_in_section (CORE_ADDR pc, char *name) { struct obj_section *s; int retval = 0; @@ -1424,7 +1422,7 @@ in_plt_section (CORE_ADDR pc, char *name retval = (s != NULL && s->the_bfd_section->name != NULL - && strcmp (s->the_bfd_section->name, ".plt") == 0); + && strcmp (s->the_bfd_section->name, name) == 0); return (retval); } Index: gdb-fsf-trunk-quilt/gdb/objfiles.h =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/objfiles.h 2013-06-06 20:41:11.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/objfiles.h 2013-06-21 00:48:49.961188758 +0100 @@ -495,7 +495,8 @@ extern int have_minimal_symbols (void); extern struct obj_section *find_pc_section (CORE_ADDR pc); -extern int in_plt_section (CORE_ADDR, char *); +/* Return non-zero if PC is in a section called NAME. */ +extern int pc_in_section (CORE_ADDR, char *); /* Keep a registry of per-objfile data-pointers required by other GDB modules. */ Index: gdb-fsf-trunk-quilt/gdb/s390-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/s390-tdep.c 2013-05-10 17:01:48.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/s390-tdep.c 2013-06-21 00:29:09.391203827 +0100 @@ -2116,7 +2116,7 @@ s390_stub_frame_sniffer (const struct fr have trapped due to an invalid function pointer call. We handle the non-existing current function like a PLT stub. */ addr_in_block = get_frame_address_in_block (this_frame); - if (in_plt_section (addr_in_block, NULL) + if (in_plt_section (addr_in_block) || s390_readinstruction (insn, get_frame_pc (this_frame)) < 0) return 1; return 0; Index: gdb-fsf-trunk-quilt/gdb/sh-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/sh-tdep.c 2013-05-10 17:01:47.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/sh-tdep.c 2013-06-21 00:29:15.891186375 +0100 @@ -2036,7 +2036,7 @@ sh_stub_unwind_sniffer (const struct fra CORE_ADDR addr_in_block; addr_in_block = get_frame_address_in_block (this_frame); - if (in_plt_section (addr_in_block, NULL)) + if (in_plt_section (addr_in_block)) return 1; return 0; Index: gdb-fsf-trunk-quilt/gdb/solib-dsbt.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/solib-dsbt.c 2013-05-10 17:01:48.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/solib-dsbt.c 2013-06-21 01:15:01.560542073 +0100 @@ -22,6 +22,7 @@ #include "inferior.h" #include "gdbcore.h" #include "solib.h" +#include "solib-svr4.h" #include "solist.h" #include "objfiles.h" #include "symtab.h" @@ -764,7 +765,7 @@ dsbt_in_dynsym_resolve_code (CORE_ADDR p return ((pc >= info->interp_text_sect_low && pc < info->interp_text_sect_high) || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high) - || in_plt_section (pc, NULL)); + || in_plt_section (pc)); } /* Print a warning about being unable to set the dynamic linker Index: gdb-fsf-trunk-quilt/gdb/solib-frv.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/solib-frv.c 2013-05-10 17:01:48.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/solib-frv.c 2013-06-21 01:15:12.561201093 +0100 @@ -22,6 +22,7 @@ #include "inferior.h" #include "gdbcore.h" #include "solib.h" +#include "solib-svr4.h" #include "solist.h" #include "frv-tdep.h" #include "objfiles.h" @@ -448,7 +449,7 @@ frv_in_dynsym_resolve_code (CORE_ADDR pc { return ((pc >= interp_text_sect_low && pc < interp_text_sect_high) || (pc >= interp_plt_sect_low && pc < interp_plt_sect_high) - || in_plt_section (pc, NULL)); + || in_plt_section (pc)); } /* Given a loadmap and an address, return the displacement needed Index: gdb-fsf-trunk-quilt/gdb/solib-svr4.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/solib-svr4.c 2013-06-06 20:41:11.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/solib-svr4.c 2013-06-21 00:30:09.891212016 +0100 @@ -1532,7 +1532,7 @@ svr4_in_dynsym_resolve_code (CORE_ADDR p && pc < info->interp_text_sect_high) || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high) - || in_plt_section (pc, NULL) + || in_plt_section (pc) || in_gnu_ifunc_stub (pc)); } Index: gdb-fsf-trunk-quilt/gdb/solib-svr4.h =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/solib-svr4.h 2013-01-30 22:34:28.000000000 +0000 +++ gdb-fsf-trunk-quilt/gdb/solib-svr4.h 2013-06-21 00:56:26.991137107 +0100 @@ -20,7 +20,8 @@ #ifndef SOLIB_SVR4_H #define SOLIB_SVR4_H -struct objfile; +#include "objfiles.h" + struct target_so_ops; extern struct target_so_ops svr4_so_ops; @@ -84,4 +85,11 @@ extern struct link_map_offsets *svr4_lp6 SVR4 run time loader. */ int svr4_in_dynsym_resolve_code (CORE_ADDR pc); +/* Return non-zero if PC is in the SVR4 procedure linkage table section. */ +static inline int +in_plt_section (CORE_ADDR pc) +{ + return pc_in_section (pc, ".plt"); +} + #endif /* solib-svr4.h */ Index: gdb-fsf-trunk-quilt/gdb/solib-target.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/solib-target.c 2013-05-10 17:01:48.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/solib-target.c 2013-06-21 01:15:38.571204241 +0100 @@ -24,6 +24,7 @@ #include "symfile.h" #include "target.h" #include "vec.h" +#include "solib-svr4.h" #include "solib-target.h" #include "gdb_string.h" @@ -476,7 +477,7 @@ solib_target_in_dynsym_resolve_code (COR /* We don't have a range of addresses for the dynamic linker; there may not be one in the program's address space. So only report PLT entries (which may be import stubs). */ - return in_plt_section (pc, NULL); + return in_plt_section (pc); } struct target_so_ops solib_target_so_ops; Index: gdb-fsf-trunk-quilt/gdb/sparc-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/sparc-tdep.c 2013-02-17 03:31:06.000000000 +0000 +++ gdb-fsf-trunk-quilt/gdb/sparc-tdep.c 2013-06-21 01:15:58.571226323 +0100 @@ -32,6 +32,7 @@ #include "objfiles.h" #include "osabi.h" #include "regcache.h" +#include "solib-svr4.h" #include "target.h" #include "value.h" @@ -855,7 +856,7 @@ sparc_analyze_prologue (struct gdbarch * dynamic linker patches up the first PLT with some code that starts with a SAVE instruction. Patch up PC such that it points at the start of our PLT entry. */ - if (tdep->plt_entry_size > 0 && in_plt_section (current_pc, NULL)) + if (tdep->plt_entry_size > 0 && in_plt_section (current_pc)) pc = current_pc - ((current_pc - pc) % tdep->plt_entry_size); insn = sparc_fetch_instruction (pc); Index: gdb-fsf-trunk-quilt/gdb/tic6x-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/tic6x-tdep.c 2013-05-10 17:01:47.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/tic6x-tdep.c 2013-06-21 01:16:10.571208681 +0100 @@ -43,6 +43,7 @@ #include "tramp-frame.h" #include "linux-tdep.h" #include "solib.h" +#include "solib-svr4.h" #include "objfiles.h" #include "gdb_assert.h" #include "osabi.h" @@ -530,7 +531,7 @@ tic6x_stub_unwind_sniffer (const struct CORE_ADDR addr_in_block; addr_in_block = get_frame_address_in_block (this_frame); - if (in_plt_section (addr_in_block, NULL)) + if (in_plt_section (addr_in_block)) return 1; return 0;