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@efficios.com>
Thu, 28 Oct 2021 20:25:42 +0000 (16:25 -0400)
Change-Id: I0c3e9d4faf1bd79c18f2f60c1c32132b8e6e6052

gdbsupport/ptid.cc
gdbsupport/ptid.h

index 73e2918cbc5f492a6c3e17f3f1eea2da166bea97..e51806626127098929bf7dceda3e8eaeb36b7925 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 a0a91758b374e9ef3c1e3f5aaa166cfb652da6e5..a2553b29c1a8342d44118a25af27b8c1dbde58eb 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.024652 seconds and 4 git commands to generate.