thread_info *thread_handle_to_thread_info (const gdb_byte *thread_handle,
int handle_len,
inferior *inf) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *) override;
+ gdb::array_view<const gdb_byte> thread_info_to_thread_handle (struct thread_info *) override;
};
static std::string libthread_db_search_path = LIBTHREAD_DB_SEARCH_PATH;
/* Cached thread state. */
td_thrhandle_t th {};
thread_t tid {};
+ gdb::optional<gdb::byte_vector> thread_handle;
};
static thread_db_thread_info *
/* Return the thread handle associated the thread_info pointer TP. */
-gdb::byte_vector
+gdb::array_view<const gdb_byte>
thread_db_target::thread_info_to_thread_handle (struct thread_info *tp)
{
thread_db_thread_info *priv = get_thread_db_thread_info (tp);
if (priv == NULL)
- return gdb::byte_vector ();
+ return {};
int handle_size = sizeof (priv->tid);
- gdb::byte_vector rv (handle_size);
+ priv->thread_handle.emplace (handle_size);
- memcpy (rv.data (), &priv->tid, handle_size);
+ memcpy (priv->thread_handle->data (), &priv->tid, handle_size);
- return rv;
+ return *priv->thread_handle;
}
/* Get the address of the thread local variable in load module LM which
thread_object *thread_obj = (thread_object *) self;
THPY_REQUIRE_VALID (thread_obj);
- gdb::byte_vector hv;
-
+ gdb::array_view<const gdb_byte> hv;
+
try
{
hv = target_thread_info_to_thread_handle (thread_obj->thread);
int handle_len,
inferior *inf) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *tp)
- override;
+ gdb::array_view<const gdb_byte> thread_info_to_thread_handle (struct thread_info *tp)
+ override;
void stop (ptid_t) override;
return NULL;
}
-gdb::byte_vector
+gdb::array_view<const gdb_byte>
remote_target::thread_info_to_thread_handle (struct thread_info *tp)
{
remote_thread_info *priv = get_remote_thread_info (tp);
}
static void
-target_debug_print_const_gdb_byte_vector_r (const gdb::byte_vector &vector)
+target_debug_print_gdb_array_view_const_gdb_byte (gdb::array_view<const gdb_byte> vector)
{
gdb_puts ("{", gdb_stdlog);
gdb_puts (" }", gdb_stdlog);
}
+static void
+target_debug_print_const_gdb_byte_vector_r (const gdb::byte_vector &vector)
+{
+ target_debug_print_gdb_array_view_const_gdb_byte (vector);
+}
+
static void
target_debug_print_gdb_byte_vector_r (gdb::byte_vector &vector)
{
const char *extra_thread_info (thread_info *arg0) override;
const char *thread_name (thread_info *arg0) override;
thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *arg0) override;
+ gdb::array_view<const_gdb_byte> thread_info_to_thread_handle (struct thread_info *arg0) override;
void stop (ptid_t arg0) override;
void interrupt () override;
void pass_ctrlc () override;
const char *extra_thread_info (thread_info *arg0) override;
const char *thread_name (thread_info *arg0) override;
thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *arg0) override;
+ gdb::array_view<const_gdb_byte> thread_info_to_thread_handle (struct thread_info *arg0) override;
void stop (ptid_t arg0) override;
void interrupt () override;
void pass_ctrlc () override;
return result;
}
-gdb::byte_vector
+gdb::array_view<const_gdb_byte>
target_ops::thread_info_to_thread_handle (struct thread_info *arg0)
{
return this->beneath ()->thread_info_to_thread_handle (arg0);
}
-gdb::byte_vector
+gdb::array_view<const_gdb_byte>
dummy_target::thread_info_to_thread_handle (struct thread_info *arg0)
{
- return gdb::byte_vector ();
+ return gdb::array_view<const gdb_byte> ();
}
-gdb::byte_vector
+gdb::array_view<const_gdb_byte>
debug_target::thread_info_to_thread_handle (struct thread_info *arg0)
{
gdb_printf (gdb_stdlog, "-> %s->thread_info_to_thread_handle (...)\n", this->beneath ()->shortname ());
- gdb::byte_vector result
+ gdb::array_view<const_gdb_byte> result
= this->beneath ()->thread_info_to_thread_handle (arg0);
gdb_printf (gdb_stdlog, "<- %s->thread_info_to_thread_handle (", this->beneath ()->shortname ());
target_debug_print_struct_thread_info_p (arg0);
gdb_puts (") = ", gdb_stdlog);
- target_debug_print_gdb_byte_vector (result);
+ target_debug_print_gdb_array_view_const_gdb_byte (result);
gdb_puts ("\n", gdb_stdlog);
return result;
}
/* See target.h. */
-gdb::byte_vector
+gdb::array_view<const gdb_byte>
target_thread_info_to_thread_handle (struct thread_info *tip)
{
target_ops *target = current_inferior ()->top_target ();
struct dcache_struct;
struct inferior;
+/* Define const gdb_byte using one identifier, to make it easy for
+ make-target-delegates.py to parse. */
+typedef const gdb_byte const_gdb_byte;
+
#include "infrun.h" /* For enum exec_direction_kind. */
#include "breakpoint.h" /* For enum bptype. */
#include "gdbsupport/scoped_restore.h"
inferior *inf)
TARGET_DEFAULT_RETURN (NULL);
/* See target_thread_info_to_thread_handle. */
- virtual gdb::byte_vector thread_info_to_thread_handle (struct thread_info *)
- TARGET_DEFAULT_RETURN (gdb::byte_vector ());
+ virtual gdb::array_view<const_gdb_byte> thread_info_to_thread_handle (struct thread_info *)
+ TARGET_DEFAULT_RETURN (gdb::array_view<const gdb_byte> ());
virtual void stop (ptid_t)
TARGET_DEFAULT_IGNORE ();
virtual void interrupt ()
/* Given a thread, return the thread handle, a target-specific sequence of
bytes which serves as a thread identifier within the program being
debugged. */
-extern gdb::byte_vector target_thread_info_to_thread_handle
+extern gdb::array_view<const gdb_byte> target_thread_info_to_thread_handle
(struct thread_info *);
/* Attempts to find the pathname of the executable file