From 16e9c715dffb96efda481dc20cdb5bb6fbde0dff Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 10 Jan 2000 18:50:16 +0000 Subject: [PATCH] Apply patch from Egor Duda to process win32_pstatus notes in core dumps. --- bfd/ChangeLog | 14 ++++++++ bfd/config.bfd | 2 +- bfd/config.in | 3 ++ bfd/configure | 8 +++++ bfd/configure.in | 1 + bfd/elf.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 109 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 063dbce4b9..ddec5930c5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2000-01-10 Egor Duda + + * config.bfd: Include elf32_i386 vector to target list for cygwin + and mingw. + + * config.in: Undefine HAVE_WIN32_PSTATUS_T. + * configure.in: Test for structure win32_pstatus_t in + + * configure: Regenerate. + + * elf.c (elfcore_grok_win32pstatus): New function: process + win32_pstatus_t notes in elf core file. + (elfcore_grok_note): Detect win32_pstatus notes. + 2000-01-03 Martin v. Loewis * elflink.c (_bfd_elf_link_record_dynamic_symbol): Process symbol diff --git a/bfd/config.bfd b/bfd/config.bfd index b5f08a3c50..e844bf1d68 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -316,7 +316,7 @@ case "${targ}" in ;; i[3456]86-*-mingw32* | i[3456]86-*-cygwin* | i[3456]86-*-winnt | i[3456]86-*-pe) targ_defvec=i386pe_vec - targ_selvecs="i386pe_vec i386pei_vec" + targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec" ;; i[3456]86-none-*) targ_defvec=i386coff_vec diff --git a/bfd/config.in b/bfd/config.in index abb2c7872c..7383656618 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -232,6 +232,9 @@ /* Define if has lwpstatus_t.pr_reg. */ #undef HAVE_LWPSTATUS_T_PR_REG +/* Define if has win32_pstatus_t. */ +#undef HAVE_WIN32_PSTATUS_T + /* Name of host specific header file to include in trad-core.c. */ #undef TRAD_HEADER diff --git a/bfd/configure b/bfd/configure index adc316db9c..53c7b3f83f 100755 --- a/bfd/configure +++ b/bfd/configure @@ -5267,6 +5267,14 @@ EOF fi fi + if test $bfd_cv_have_sys_procfs_type_lwpstatus_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LWPSTATUS_T 1 +EOF + + fi + echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 + cat >> confdefs.h <descsz < sizeof (pstatus)) + return true; + + memcpy (& pstatus, note->descdata, note->descsz); + + switch (pstatus.data_type) + { + case NOTE_INFO_PROCESS: + /* FIXME: need to add ->core_command. */ + elf_tdata (abfd)->core_signal = pstatus.data.process_info.signal; + elf_tdata (abfd)->core_pid = pstatus.data.process_info.pid; + break ; + + case NOTE_INFO_THREAD: + /* Make a ".reg/999" section. */ + sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid); + + name = bfd_alloc (abfd, strlen (buf) + 1); + if (name == NULL) + return false; + + strcpy (name, buf); + + sect = bfd_make_section (abfd, name); + if (sect == NULL) + return false; + + sect->_raw_size = sizeof (pstatus.data.thread_info.thread_context); + sect->filepos = note->descpos + offsetof (struct win32_pstatus, + data.thread_info.thread_context); + sect->flags = SEC_HAS_CONTENTS; + sect->alignment_power = 2; + + if (pstatus.data.thread_info.is_active_thread) + if (! elfcore_maybe_make_sect (abfd, ".reg", sect)) + return false; + break; + + case NOTE_INFO_MODULE: + /* Make a ".module/xxxxxxxx" section. */ + sprintf (buf, ".module/%08x" , pstatus.data.module_info.base_address); + + name = bfd_alloc (abfd, strlen (buf) + 1); + if (name == NULL) + return false; + + strcpy (name, buf); + sect = bfd_make_section (abfd, name); + + if (sect == NULL) + return false; + + sect->_raw_size = note->descsz; + sect->filepos = note->descpos; + sect->flags = SEC_HAS_CONTENTS; + sect->alignment_power = 2; + break; + + default: + return true; + } + + return true; +} +#endif /* HAVE_WIN32_PSTATUS_T */ static boolean elfcore_grok_note (abfd, note) @@ -5322,7 +5398,12 @@ elfcore_grok_note (abfd, note) case NT_FPREGSET: /* FIXME: rename to NT_PRFPREG */ return elfcore_grok_prfpreg (abfd, note); - case NT_PRXFPREG: /* Linux SSE extension */ +#if defined (HAVE_WIN32_PSTATUS_T) + case NT_WIN32PSTATUS: + return elfcore_grok_win32pstatus (abfd, note); +#endif + + case NT_PRXFPREG: /* Linux SSE extension */ if (note->namesz == 5 && ! strcmp (note->namedata, "LINUX")) return elfcore_grok_prxfpreg (abfd, note); -- 2.34.1