Add ptid_t::to_string (gdb-11-branch only)
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 28 Oct 2021 20:25:42 +0000 (16:25 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 17 Jan 2022 16:40:31 +0000 (11:40 -0500)
Change-Id: I0c3e9d4faf1bd79c18f2f60c1c32132b8e6e6052

gdbsupport/ptid.cc
gdbsupport/ptid.h

index e61e15e35871d74b7093bbbc13adc134b752210d..d4bd715cb886412bde65cdab61e1a6d946292f6d 100644 (file)
 
 #include "common-defs.h"
 #include "ptid.h"
+#include "print-utils.h"
 
 /* See ptid.h for these.  */
 
 ptid_t const null_ptid = ptid_t::make_null ();
 ptid_t const minus_one_ptid = ptid_t::make_minus_one ();
+
+/* See ptid.h.  */
+
+std::string
+ptid_t::to_string () const
+{
+  return string_printf ("%d.%ld.%s", m_pid, m_lwp, pulongest (m_tid));
+}
index 4f856ab674f7f1b5e370242b197e28ff8f4800c8..034b803f93e0c4f0e0f2d054f041e9e47c052236 100644 (file)
@@ -33,6 +33,7 @@
 */
 
 #include <functional>
+#include <string>
 
 class ptid_t
 {
@@ -124,6 +125,12 @@ public:
            || *this == filter);
   }
 
+  /* Return a string representation of the ptid.
+
+     This is only meant to be used in debug messages.  */
+
+  std::string to_string () const;
+
   /* Make a null ptid.  */
 
   static constexpr ptid_t make_null ()
This page took 0.025057 seconds and 4 git commands to generate.