summaryrefslogtreecommitdiff
path: root/devel/gdb/files/commit-6e5eab33ab
blob: 9b45c3e9e3c889073276c9c9aa4d965b10ec4fce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
commit 6e5eab33abe09041b29e0ce484f684ad0ffe80a5
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Wed Jun 28 10:41:57 2017 -0700

    Move the thread_section_name class to gdbcore.h.
    
    This allows it to be used outside of corelow.c.

diff --git gdb/corelow.c gdb/corelow.c
index 0aff02d4db..578c910bb5 100644
--- gdb/corelow.c
+++ 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 gdb/gdbcore.h gdb/gdbcore.h
index e3eed0395d..87f3dcd64d 100644
--- gdb/gdbcore.h
+++ 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);