This is the mail archive of the binutils@sources.redhat.com 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]

RFA: allow BFD to read registers from S/390 core files



This patch to BFD allows GDB to read registers from core files under
S/390 Linux.

2001-12-05  Jim Blandy  <jimb@redhat.com>

	Allow GDB to read general-purpose registers from Linux S/390
        core files.
	* elf32-s390.c (elf32_s390_grok_prstatus): New function.
	(elf_backend_grok_prstatus): Define.	

Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf32-s390.c,v
retrieving revision 1.7
diff -c -r1.7 elf32-s390.c
*** bfd/elf32-s390.c	2001/11/25 23:37:14	1.7
--- bfd/elf32-s390.c	2001/12/05 21:30:21
***************
*** 2388,2393 ****
--- 2388,2423 ----
    return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esa);
  }
  
+ static boolean
+ elf_s390_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+ {
+   int offset;
+   unsigned int raw_size;
+ 
+   switch (note->descsz)
+     {
+       default:
+ 	return false;
+ 
+       case 224:		/* S/390 Linux */
+ 	/* pr_cursig */
+ 	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+ 
+ 	/* pr_pid */
+ 	elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+ 
+ 	/* pr_reg */
+ 	offset = 72;
+ 	raw_size = 144;
+ 
+ 	break;
+     }
+ 
+   /* Make a ".reg/999" section.  */
+   return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ 					  raw_size, note->descpos + offset);
+ }
+ 
  #define TARGET_BIG_SYM	bfd_elf32_s390_vec
  #define TARGET_BIG_NAME	"elf32-s390"
  #define ELF_ARCH	bfd_arch_s390
***************
*** 2421,2426 ****
--- 2451,2457 ----
  #define elf_backend_relocate_section          elf_s390_relocate_section
  #define elf_backend_size_dynamic_sections     elf_s390_size_dynamic_sections
  #define elf_backend_reloc_type_class	      elf_s390_reloc_type_class
+ #define elf_backend_grok_prstatus	      elf_s390_grok_prstatus
  
  #define elf_backend_object_p            elf_s390_object_p
  


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