From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb@sources.redhat.com
Subject: corelow and threads question
Date: Fri, 05 Jun 2009 18:55:00 -0000 [thread overview]
Message-ID: <h0bplu$o36$1@ger.gmane.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]
Hello,
Since:
http://sourceware.org/ml/gdb-patches/2009-06/msg00101.html
diverged from original intention, I would like to ask a
question regarding core_ops and possible solution to my problem.
Right now, we are treating core_ops somewhat specially since
we add threads before calling target_find_new_threads in
core_open; but why don't we let target_find_new_threads add
the threads instead of adding them in core_open?
Wouldn't that actually be the right solution?
(attached is diff for corelow.c that illustrates what I am
talking about).
With corelow.c patched as proposed, on Neutrino I could do this:
For NTO, I "hijack" core_ops:
static void
init_nto_core_ops ()
{
struct target_ops *core_ops;
core_ops = find_core_target ();
gdb_assert (core_ops && core_ops->to_shortname != NULL
&& !!"core_ops must be initialized first!");
original_core_ops = *core_ops;
core_ops->to_extra_thread_info =
nto_target_extra_thread_info;
core_ops->to_open = nto_core_open;
core_ops->to_xfer_partial = nto_core_xfer_partial;
core_ops->to_pid_to_str = nto_pid_to_str;
}
I can provide to_find_new_threads there:
static void
nto_find_new_threads_in_core (void)
{
if (core_bfd)
bfd_map_over_sections (core_bfd,
nto_core_add_thread_private_data, NULL);
}
where I add_thread and also add thread private data. All
works well.
Thoughts?
--
Aleksandar Ristovski
QNX Software Systems
[-- Attachment #2: corelow.c.diff --]
[-- Type: text/x-patch, Size: 1322 bytes --]
Index: gdb/corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.86
diff -u -p -r1.86 corelow.c
--- gdb/corelow.c 5 Jun 2009 18:08:53 -0000 1.86
+++ gdb/corelow.c 5 Jun 2009 18:51:03 -0000
@@ -395,12 +395,6 @@ core_open (char *filename, int from_tty)
previous session, and the frame cache being stale. */
registers_changed ();
- /* Build up thread list from BFD sections, and possibly set the
- current thread to the .reg/NN section matching the .reg
- section. */
- bfd_map_over_sections (core_bfd, add_to_thread_list,
- bfd_get_section_by_name (core_bfd, ".reg"));
-
post_create_inferior (&core_ops, from_tty);
/* Now go through the target stack looking for threads since there
@@ -748,6 +742,13 @@ core_pid_to_str (struct target_ops *ops,
return buf;
}
+static void
+core_find_new_threads (struct target_ops *ops)
+{
+ if (core_bfd)
+ bfd_map_over_sections (core_bfd, add_to_thread_list, NULL);
+}
+
/* Fill in core_ops with its defined operations and properties. */
static void
@@ -775,6 +776,7 @@ init_core_ops (void)
core_ops.to_has_stack = 1;
core_ops.to_has_registers = 1;
core_ops.to_magic = OPS_MAGIC;
+ core_ops.to_find_new_threads = core_find_new_threads;
}
void
next reply other threads:[~2009-06-05 18:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-05 18:55 Aleksandar Ristovski [this message]
2009-06-05 19:03 ` Daniel Jacobowitz
2009-06-05 19:20 ` Aleksandar Ristovski
2009-06-05 19:24 ` Pedro Alves
2009-06-05 19:41 ` Aleksandar Ristovski
2009-06-06 0:01 ` Pedro Alves
2009-06-06 0:27 ` Pedro Alves
2009-06-09 16:10 ` Aleksandar Ristovski
2009-06-10 16:49 ` Pedro Alves
2009-06-10 20:38 ` Aleksandar Ristovski
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='h0bplu$o36$1@ger.gmane.org' \
--to=aristovski@qnx.com \
--cc=gdb@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