This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

[commit, arm] Fix GDB breakage after BFD change (Re: RFC: Adding an extra field to Elf_Internal_Sym)


Richard Sandiford wrote:

> This approach does still need some changes to BFD users that already
> use STT_ARM_TFUNC to check for Thumbness.  However, the changes needed
> there are also the changes that would need to be made for any Thumb
> STT_GNU_IFUNC support, and they would be restricted to ARM-specific
> code.  If binutils is anything to go by, the changes are much less
> invasive than they would be for odd-valued function symbols.
> 
> A corresponding (but simple) change would be needed in GDB.

Indeed, this change caused GDB to break completely on a Thumb-based system.

Every program would go into an endless loop at startup, because GDB had set
an incorrect ARM breakpoint at the Thumb routine _dl_debug_state exported
by the dynamic loader :-/

The following patch fixes this for me; does this look correct to you?

Tested on armv7l-unknown-linux-gnueabi; committed to mainline.

Bye,
Ulrich

ChangeLog:

	* arm-tdep.c (arm_elf_make_msymbol_special): Use ARM_SYM_BRANCH_TYPE
	instead of checking for STT_ARM_TFUNC symbol type.

Index: gdb/arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.338
diff -u -p -r1.338 arm-tdep.c
--- gdb/arm-tdep.c	21 Mar 2011 17:28:04 -0000	1.338
+++ gdb/arm-tdep.c	25 Mar 2011 20:40:33 -0000
@@ -7793,10 +7793,8 @@ coff_sym_is_thumb (int val)
 static void
 arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
 {
-  /* Thumb symbols are of type STT_LOPROC, (synonymous with
-     STT_ARM_TFUNC).  */
-  if (ELF_ST_TYPE (((elf_symbol_type *)sym)->internal_elf_sym.st_info)
-      == STT_LOPROC)
+  if (ARM_SYM_BRANCH_TYPE (&((elf_symbol_type *)sym)->internal_elf_sym)
+      == ST_BRANCH_TO_THUMB)
     MSYMBOL_SET_SPECIAL (msym);
 }
 

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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