* [patch] add hppa-linux corefile support
@ 2004-11-22 22:37 Randolph Chung
2004-11-29 23:53 ` Randolph Chung
0 siblings, 1 reply; 3+ messages in thread
From: Randolph Chung @ 2004-11-22 22:37 UTC (permalink / raw)
To: binutils
this patch teaches elf32-hppa.c about hppa-linux corefiles. Useful for
tools like gdb.
Tested with gdb-6.3. Please apply if ok.
randolph
2004-11-22 Randolph Chung <tausq@debian.org>
* elf32-hppa.c (elf32_hppa_grok_prstatus): New function.
(elf32_hppa_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Define.
Index: elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.123
diff -u -p -r1.123 elf32-hppa.c
--- elf32-hppa.c 21 Oct 2004 15:28:21 -0000 1.123
+++ elf32-hppa.c 22 Nov 2004 22:33:21 -0000
@@ -1600,6 +1600,68 @@ elf32_hppa_gc_sweep_hook (bfd *abfd,
return TRUE;
}
+\f
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+elf32_hppa_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+ int offset;
+ size_t size;
+
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 396: /* Linux/hppa */
+ /* 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;
+ size = 320;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ size, note->descpos + offset);
+}
+
+static bfd_boolean
+elf32_hppa_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 124: /* Linux/hppa elf_prpsinfo. */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return TRUE;
+}
+
/* Our own version of hide_symbol, so that we can keep plt entries for
plabels. */
@@ -4165,6 +4227,8 @@ elf32_hppa_elf_get_symbol_type (Elf_Inte
#define elf_backend_size_dynamic_sections elf32_hppa_size_dynamic_sections
#define elf_backend_gc_mark_hook elf32_hppa_gc_mark_hook
#define elf_backend_gc_sweep_hook elf32_hppa_gc_sweep_hook
+#define elf_backend_grok_prstatus elf32_hppa_grok_prstatus
+#define elf_backend_grok_psinfo elf32_hppa_grok_psinfo
#define elf_backend_object_p elf32_hppa_object_p
#define elf_backend_final_write_processing elf_hppa_final_write_processing
#define elf_backend_post_process_headers elf32_hppa_post_process_headers
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] add hppa-linux corefile support
2004-11-22 22:37 [patch] add hppa-linux corefile support Randolph Chung
@ 2004-11-29 23:53 ` Randolph Chung
2004-11-30 1:10 ` Alan Modra
0 siblings, 1 reply; 3+ messages in thread
From: Randolph Chung @ 2004-11-29 23:53 UTC (permalink / raw)
To: binutils
Ping?
randolph
In reference to a message from Randolph Chung, dated Nov 22:
> this patch teaches elf32-hppa.c about hppa-linux corefiles. Useful for
> tools like gdb.
>
> Tested with gdb-6.3. Please apply if ok.
>
> randolph
>
>
> 2004-11-22 Randolph Chung <tausq@debian.org>
>
> * elf32-hppa.c (elf32_hppa_grok_prstatus): New function.
> (elf32_hppa_grok_psinfo): New function.
> (elf_backend_grok_prstatus): Define.
> (elf_backend_grok_psinfo): Define.
>
> Index: elf32-hppa.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
> retrieving revision 1.123
> diff -u -p -r1.123 elf32-hppa.c
> --- elf32-hppa.c 21 Oct 2004 15:28:21 -0000 1.123
> +++ elf32-hppa.c 22 Nov 2004 22:33:21 -0000
> @@ -1600,6 +1600,68 @@ elf32_hppa_gc_sweep_hook (bfd *abfd,
> return TRUE;
> }
>
> +\f
> +/* Support for core dump NOTE sections. */
> +
> +static bfd_boolean
> +elf32_hppa_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
> +{
> + int offset;
> + size_t size;
> +
> + switch (note->descsz)
> + {
> + default:
> + return FALSE;
> +
> + case 396: /* Linux/hppa */
> + /* 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;
> + size = 320;
> +
> + break;
> + }
> +
> + /* Make a ".reg/999" section. */
> + return _bfd_elfcore_make_pseudosection (abfd, ".reg",
> + size, note->descpos + offset);
> +}
> +
> +static bfd_boolean
> +elf32_hppa_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
> +{
> + switch (note->descsz)
> + {
> + default:
> + return FALSE;
> +
> + case 124: /* Linux/hppa elf_prpsinfo. */
> + elf_tdata (abfd)->core_program
> + = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
> + elf_tdata (abfd)->core_command
> + = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
> + }
> +
> + /* Note that for some reason, a spurious space is tacked
> + onto the end of the args in some (at least one anyway)
> + implementations, so strip it off if it exists. */
> + {
> + char *command = elf_tdata (abfd)->core_command;
> + int n = strlen (command);
> +
> + if (0 < n && command[n - 1] == ' ')
> + command[n - 1] = '\0';
> + }
> +
> + return TRUE;
> +}
> +
> /* Our own version of hide_symbol, so that we can keep plt entries for
> plabels. */
>
> @@ -4165,6 +4227,8 @@ elf32_hppa_elf_get_symbol_type (Elf_Inte
> #define elf_backend_size_dynamic_sections elf32_hppa_size_dynamic_sections
> #define elf_backend_gc_mark_hook elf32_hppa_gc_mark_hook
> #define elf_backend_gc_sweep_hook elf32_hppa_gc_sweep_hook
> +#define elf_backend_grok_prstatus elf32_hppa_grok_prstatus
> +#define elf_backend_grok_psinfo elf32_hppa_grok_psinfo
> #define elf_backend_object_p elf32_hppa_object_p
> #define elf_backend_final_write_processing elf_hppa_final_write_processing
> #define elf_backend_post_process_headers elf32_hppa_post_process_headers
> --
> Randolph Chung
> Debian GNU/Linux Developer, hppa/ia64 ports
> http://www.tausq.org/
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] add hppa-linux corefile support
2004-11-29 23:53 ` Randolph Chung
@ 2004-11-30 1:10 ` Alan Modra
0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2004-11-30 1:10 UTC (permalink / raw)
To: Randolph Chung; +Cc: binutils
On Mon, Nov 29, 2004 at 03:53:21PM -0800, Randolph Chung wrote:
> Ping?
> > * elf32-hppa.c (elf32_hppa_grok_prstatus): New function.
> > (elf32_hppa_grok_psinfo): New function.
> > (elf_backend_grok_prstatus): Define.
> > (elf_backend_grok_psinfo): Define.
Applied.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-11-30 1:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-22 22:37 [patch] add hppa-linux corefile support Randolph Chung
2004-11-29 23:53 ` Randolph Chung
2004-11-30 1:10 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).