From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org, binutils@sourceware.org
Subject: [PATCH 3/8] Move the thread_section_name class to gdbcore.h.
Date: Thu, 29 Jun 2017 23:33:00 -0000 [thread overview]
Message-ID: <20170629233226.20155-4-jhb@FreeBSD.org> (raw)
In-Reply-To: <20170629233226.20155-1-jhb@FreeBSD.org>
This allows it to be used outside of corelow.c.
---
gdb/ChangeLog | 5 +++++
gdb/corelow.c | 45 ---------------------------------------------
gdb/gdbcore.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 45 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1e624d3667..bdedb63435 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-06-28 John Baldwin <jhb@FreeBSD.org>
+ * corelow.c (thread_section_name): Move to ...
+ * gdbcore.h (thread_section_name): ... here.
+
+2017-06-28 John Baldwin <jhb@FreeBSD.org>
+
* fbsd-nat.c [PT_LWPINFO && __LP64__] (union sigval32)
(struct siginfo32): New.
[PT_LWPINFO] (fbsd_siginfo_size, fbsd_convert_siginfo): New.
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 0aff02d4db..578c910bb5 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -485,51 +485,6 @@ core_detach (struct target_ops *ops, const char *args, int from_tty)
printf_filtered (_("No core file now.\n"));
}
-/* Build either a single-thread or multi-threaded section name for
- PTID.
-
- If ptid's lwp member is zero, we want to do the single-threaded
- thing: look for a section named NAME (as passed to the
- constructor). If ptid's lwp member is non-zero, we'll want do the
- multi-threaded thing: look for a section named "NAME/LWP", where
- LWP is the shortest ASCII decimal representation of ptid's lwp
- member. */
-
-class thread_section_name
-{
-public:
- /* NAME is the single-threaded section name. If PTID represents an
- LWP, then the build section name is "NAME/LWP", otherwise it's
- just "NAME" unmodified. */
- thread_section_name (const char *name, ptid_t ptid)
- {
- if (ptid.lwp_p ())
- {
- m_storage = string_printf ("%s/%ld", name, ptid.lwp ());
- m_section_name = m_storage.c_str ();
- }
- else
- m_section_name = name;
- }
-
- /* Return the computed section name. The result is valid as long as
- this thread_section_name object is live. */
- const char *c_str () const
- { return m_section_name; }
-
- /* Disable copy. */
- thread_section_name (const thread_section_name &) = delete;
- void operator= (const thread_section_name &) = delete;
-
-private:
- /* Either a pointer into M_STORAGE, or a pointer to the name passed
- as parameter to the constructor. */
- const char *m_section_name;
- /* If we need to build a new section name, this is where we store
- it. */
- std::string m_storage;
-};
-
/* Try to retrieve registers from a section in core_bfd, and supply
them to core_vec->core_read_registers, as the register set numbered
WHICH.
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index e3eed0395d..87f3dcd64d 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -226,6 +226,51 @@ struct core_fns
};
+/* Build either a single-thread or multi-threaded section name for
+ PTID.
+
+ If ptid's lwp member is zero, we want to do the single-threaded
+ thing: look for a section named NAME (as passed to the
+ constructor). If ptid's lwp member is non-zero, we'll want do the
+ multi-threaded thing: look for a section named "NAME/LWP", where
+ LWP is the shortest ASCII decimal representation of ptid's lwp
+ member. */
+
+class thread_section_name
+{
+public:
+ /* NAME is the single-threaded section name. If PTID represents an
+ LWP, then the build section name is "NAME/LWP", otherwise it's
+ just "NAME" unmodified. */
+ thread_section_name (const char *name, ptid_t ptid)
+ {
+ if (ptid.lwp_p ())
+ {
+ m_storage = string_printf ("%s/%ld", name, ptid.lwp ());
+ m_section_name = m_storage.c_str ();
+ }
+ else
+ m_section_name = name;
+ }
+
+ /* Return the computed section name. The result is valid as long as
+ this thread_section_name object is live. */
+ const char *c_str () const
+ { return m_section_name; }
+
+ /* Disable copy. */
+ thread_section_name (const thread_section_name &) = delete;
+ void operator= (const thread_section_name &) = delete;
+
+private:
+ /* Either a pointer into M_STORAGE, or a pointer to the name passed
+ as parameter to the constructor. */
+ const char *m_section_name;
+ /* If we need to build a new section name, this is where we store
+ it. */
+ std::string m_storage;
+};
+
/* NOTE: cagney/2004-04-05: Replaced by "regset.h" and
regset_from_core_section(). */
extern void deprecated_add_core_fns (struct core_fns *cf);
--
2.11.0
next prev parent reply other threads:[~2017-06-29 23:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 23:33 [PATCH 0/8] Add support for $_siginfo on FreeBSD John Baldwin
2017-06-29 23:33 ` [PATCH 2/8] Fetch signal information for native FreeBSD processes John Baldwin
2017-06-29 23:33 ` [PATCH 8/8] Read signal information from FreeBSD core dumps John Baldwin
2017-06-29 23:33 ` [PATCH 6/8] Recognize the recently-added FreeBSD core dump note for LWP info John Baldwin
2017-06-30 3:19 ` Alan Modra
2017-06-29 23:33 ` [PATCH 7/8] Create psuedo sections for FreeBSD NT_PTLWPINFO core notes John Baldwin
2017-06-30 3:20 ` Alan Modra
2017-06-29 23:33 ` John Baldwin [this message]
2017-06-29 23:33 ` [PATCH 1/8] Implement the "get_siginfo_type" gdbarch method for FreeBSD architectures John Baldwin
2017-06-29 23:41 ` [PATCH 4/8] Add a new gdbarch method to fetch signal information from core files John Baldwin
2017-06-29 23:41 ` [PATCH 5/8] Use the thread_section_name helper class in fbsd_core_thread_name John Baldwin
2017-07-06 11:17 ` [PATCH 0/8] Add support for $_siginfo on FreeBSD John Baldwin
2017-07-06 13:29 ` Pedro Alves
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=20170629233226.20155-4-jhb@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
/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