diff options
author | Joel Brobecker <brobecker@gnat.com> | 2004-09-13 03:51:22 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2004-09-13 03:51:22 +0000 |
commit | 94ea025abda2c91f5e53b7e949ac3628ba2081cd (patch) | |
tree | 682b6b4989e021a0cb23a707bb2190e34eb0b6d4 | |
parent | 2159ac21e244ff361e244b0fa03219b96dbc4673 (diff) | |
download | gdb-94ea025abda2c91f5e53b7e949ac3628ba2081cd.zip gdb-94ea025abda2c91f5e53b7e949ac3628ba2081cd.tar.gz gdb-94ea025abda2c91f5e53b7e949ac3628ba2081cd.tar.bz2 |
* hpux-core.c (thread_section_p): New function.
(hpux_core_core_file_p): Fix computation of offset in call
to bfd_seek. Create a ".reg" section from an arbitrary
".reg/<id>" section if none was created after having read
all sections.
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/hpux-core.c | 36 |
2 files changed, 43 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8a8e991..8ef66c6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2004-09-10 Joel Brobecker <brobecker@gnat.com> + + * hpux-core.c (thread_section_p): New function. + (hpux_core_core_file_p): Fix computation of offset in call + to bfd_seek. Create a ".reg" section from an arbitrary + ".reg/<id>" section if none was created after having read + all sections. + 2004-09-11 Andreas Schwab <schwab@suse.de> * acinclude.m4: Fix spelling of ACX_NONCANONICAL_*. diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index 32b4eb4..347de21 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -145,6 +145,17 @@ make_bfd_asection (abfd, name, flags, size, vma, alignment_power) return asect; } +/* Return true if the given core file section corresponds to a thread, + based on its name. */ + +static int +thread_section_p (bfd *abfd ATTRIBUTE_UNUSED, + asection *sect, + void *obj ATTRIBUTE_UNUSED) +{ + return (strncmp (bfd_section_name (abfd, sect), ".reg/", 5) == 0); +} + /* this function builds a bfd target if the file is a corefile. It returns null or 0 if it finds out thaat it is not a core file. The way it checks this is by looking for allowed 'type' field values. @@ -207,7 +218,7 @@ hpux_core_core_file_p (abfd) /* However, we also want to create those sections with the file positioned at the start of the record, it seems. */ - if (bfd_seek (abfd, (file_ptr) -core_header.len, SEEK_CUR) != 0) + if (bfd_seek (abfd, -((file_ptr) core_header.len), SEEK_CUR) != 0) break; #if defined(PROC_INFO_HAS_THREAD_ID) @@ -301,6 +312,29 @@ hpux_core_core_file_p (abfd) /* OK, we believe you. You're a core file (sure, sure). */ + /* On HP/UX, we sometimes encounter core files where none of the threads + was found to be the running thread (ie the signal was set to -1 for + all threads). This happens when the program was aborted externally + via a TT_CORE ttrace system call. In that case, we just pick one + thread at random to be the active thread. */ + if (core_kernel_thread_id (abfd) != 0 + && bfd_get_section_by_name (abfd, ".reg") == NULL) + { + asection *asect = bfd_sections_find_if (abfd, thread_section_p, NULL); + asection *reg_sect; + + if (asect != NULL) + { + reg_sect = make_bfd_asection (abfd, ".reg", asect->flags, + asect->size, asect->vma, + asect->alignment_power); + if (reg_sect == NULL) + goto fail; + + reg_sect->filepos = asect->filepos; + } + } + /* Were there sections of unknown type? If so, yet there were at least some complete sections of known type, then, issue a warning. Possibly the core file was generated on a version |