From: "Kris Warkentin" <kewarken@qnx.com>
To: "Gdb-Patches@Sources.Redhat.Com" <gdb-patches@sources.redhat.com>
Subject: [BFD PATCH] Fix QNX Neutrino core file reading
Date: Thu, 15 May 2003 19:30:00 -0000 [thread overview]
Message-ID: <045401c31b18$7ebac400$0202040a@catdog> (raw)
I finally figured out why our core files weren't showing which thread was
active when it was generated. It seems we weren't setting lwpid correctly
and were not making the .reg section at the correct time. Okay to apply?
cheers,
Kris
Changelog:
* elf.c (elfcore_grok_nto_status): Only set lwpid for the active or
signalled thread.
(elfcore_grok_nto_gregs): Only make .reg section for the active thread.
Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.184
diff -u -r1.184 elf.c
--- elf.c 9 May 2003 10:58:12 -0000 1.184
+++ elf.c 15 May 2003 19:27:31 -0000
@@ -7001,18 +7001,30 @@
char buf[100];
char *name;
asection *sect;
+ short sig;
+ unsigned flags;
/* nto_procfs_status 'pid' field is at offset 0. */
elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, (bfd_byte *) ddata);
- /* nto_procfs_status 'tid' field is at offset 4. */
- elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, (bfd_byte *) ddata + 4);
+ /* nto_procfs_status 'tid' field is at offset 4. Pass it back. */
+ *tid = bfd_get_32 (abfd, (bfd_byte *) ddata + 4);
- /* nto_procfs_status 'what' field is at offset 14. */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, (bfd_byte *) ddata +
14);
+ /* nto_procfs_status 'flags' field is at offset 8. */
+ flags = bfd_get_32 (abfd, (bfd_byte *) ddata + 8);
- /* Pass tid back. */
- *tid = elf_tdata (abfd)->core_lwpid;
+ /* nto_procfs_status 'what' field is at offset 14. */
+ if( (sig = bfd_get_16 (abfd, (bfd_byte *) ddata + 14)) > 0 ){
+ elf_tdata (abfd)->core_signal = sig;
+ elf_tdata (abfd)->core_lwpid = *tid;
+ }
+
+ /* _DEBUG_FLAG_CURTID (current thread) is 0x80. Some cores
+ do not come from signals so we make sure we set the current
+ thread just in case. */
+ if (flags & 0x00000080){
+ elf_tdata (abfd)->core_lwpid = *tid;
+ }
/* Make a ".qnx_core_status/%d" section. */
sprintf (buf, ".qnx_core_status/%d", *tid);
@@ -7022,8 +7034,7 @@
return FALSE;
strcpy (name, buf);
- sect = bfd_make_section (abfd, name);
- if (sect == NULL)
+ if ( (sect = bfd_make_section (abfd, name)) == NULL )
return FALSE;
sect->_raw_size = note->descsz;
@@ -7061,7 +7072,12 @@
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
- return elfcore_maybe_make_sect (abfd, ".reg", sect);
+ /* This is the current thread. */
+ if (elf_tdata (abfd)->core_lwpid == tid){
+ return elfcore_maybe_make_sect (abfd, ".reg", sect);
+ }
+
+ return TRUE;
}
#define BFD_QNT_CORE_INFO 7
next reply other threads:[~2003-05-15 19:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-15 19:30 Kris Warkentin [this message]
2003-05-15 19:59 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='045401c31b18$7ebac400$0202040a@catdog' \
--to=kewarken@qnx.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox