2003-05-05 21:57:21 +08:00
|
|
|
/* nto-tdep.h - QNX Neutrino target header.
|
|
|
|
|
2023-01-01 20:49:04 +08:00
|
|
|
Copyright (C) 2003-2023 Free Software Foundation, Inc.
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
Contributed by QNX Software Systems Ltd.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-24 02:08:50 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2003-05-05 21:57:21 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-24 02:08:50 +08:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2003-05-05 21:57:21 +08:00
|
|
|
|
2019-01-28 03:51:36 +08:00
|
|
|
#ifndef NTO_TDEP_H
|
|
|
|
#define NTO_TDEP_H
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
#include "solist.h"
|
2004-12-10 21:38:23 +08:00
|
|
|
#include "osabi.h"
|
|
|
|
#include "regset.h"
|
2009-07-28 21:20:26 +08:00
|
|
|
#include "gdbthread.h"
|
2022-09-25 03:34:09 +08:00
|
|
|
#include "gdbsupport/gdb-checked-static-cast.h"
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
/* Target operations defined for Neutrino targets (<target>-nto-tdep.c). */
|
|
|
|
|
|
|
|
struct nto_target_ops
|
|
|
|
{
|
|
|
|
/* The CPUINFO flags from the remote. Currently used by
|
|
|
|
i386 for fxsave but future proofing other hosts.
|
|
|
|
This is initialized in procfs_attach or nto_start_remote
|
|
|
|
depending on our host/target. It would only be invalid
|
|
|
|
if we were talking to an older pdebug which didn't support
|
|
|
|
the cpuinfo message. */
|
2004-12-10 21:38:23 +08:00
|
|
|
unsigned cpuinfo_flags;
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
/* True if successfully retrieved cpuinfo from remote. */
|
2004-12-10 21:38:23 +08:00
|
|
|
int cpuinfo_valid;
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
/* Given a register, return an id that represents the Neutrino
|
|
|
|
regset it came from. If reg == -1 update all regsets. */
|
2004-12-10 21:38:23 +08:00
|
|
|
int (*regset_id) (int);
|
2003-05-05 21:57:21 +08:00
|
|
|
|
2007-05-06 22:30:45 +08:00
|
|
|
void (*supply_gregset) (struct regcache *, char *);
|
2003-05-05 21:57:21 +08:00
|
|
|
|
2007-05-06 22:30:45 +08:00
|
|
|
void (*supply_fpregset) (struct regcache *, char *);
|
2003-05-05 21:57:21 +08:00
|
|
|
|
2007-05-06 22:30:45 +08:00
|
|
|
void (*supply_altregset) (struct regcache *, char *);
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
/* Given a regset, tell gdb about registers stored in data. */
|
2007-05-06 22:30:45 +08:00
|
|
|
void (*supply_regset) (struct regcache *, int, char *);
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
/* Given a register and regset, calculate the offset into the regset
|
|
|
|
and stuff it into the last argument. If regno is -1, calculate the
|
|
|
|
size of the entire regset. Returns length of data, -1 if unknown
|
|
|
|
regset, 0 if unknown register. */
|
2008-09-05 19:46:46 +08:00
|
|
|
int (*register_area) (struct gdbarch *, int, int, unsigned *);
|
2003-05-05 21:57:21 +08:00
|
|
|
|
2011-01-11 04:38:51 +08:00
|
|
|
/* Build the Neutrino register set info into the data buffer.
|
2003-05-05 21:57:21 +08:00
|
|
|
Return -1 if unknown regset, 0 otherwise. */
|
2007-05-06 22:30:45 +08:00
|
|
|
int (*regset_fill) (const struct regcache *, int, char *);
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
/* Gives the fetch_link_map_offsets function exposure outside of
|
|
|
|
solib-svr4.c so that we can override relocate_section_addresses(). */
|
2004-12-10 21:38:23 +08:00
|
|
|
struct link_map_offsets *(*fetch_link_map_offsets) (void);
|
|
|
|
|
|
|
|
/* Used by nto_elf_osabi_sniffer to determine if we're connected to an
|
|
|
|
Neutrino target. */
|
|
|
|
enum gdb_osabi (*is_nto_target) (bfd *abfd);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct nto_target_ops current_nto_target;
|
|
|
|
|
|
|
|
#define nto_cpuinfo_flags (current_nto_target.cpuinfo_flags)
|
|
|
|
|
|
|
|
#define nto_cpuinfo_valid (current_nto_target.cpuinfo_valid)
|
|
|
|
|
|
|
|
#define nto_regset_id (current_nto_target.regset_id)
|
|
|
|
|
|
|
|
#define nto_supply_gregset (current_nto_target.supply_gregset)
|
|
|
|
|
|
|
|
#define nto_supply_fpregset (current_nto_target.supply_fpregset)
|
|
|
|
|
|
|
|
#define nto_supply_altregset (current_nto_target.supply_altregset)
|
|
|
|
|
|
|
|
#define nto_supply_regset (current_nto_target.supply_regset)
|
|
|
|
|
|
|
|
#define nto_register_area (current_nto_target.register_area)
|
|
|
|
|
|
|
|
#define nto_regset_fill (current_nto_target.regset_fill)
|
|
|
|
|
|
|
|
#define nto_fetch_link_map_offsets \
|
|
|
|
(current_nto_target.fetch_link_map_offsets)
|
|
|
|
|
|
|
|
#define nto_is_nto_target (current_nto_target.is_nto_target)
|
2003-05-05 21:57:21 +08:00
|
|
|
|
|
|
|
/* Keep this consistant with neutrino syspage.h. */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CPUTYPE_X86,
|
|
|
|
CPUTYPE_PPC,
|
|
|
|
CPUTYPE_MIPS,
|
|
|
|
CPUTYPE_SPARE,
|
|
|
|
CPUTYPE_ARM,
|
|
|
|
CPUTYPE_SH,
|
|
|
|
CPUTYPE_UNKNOWN
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
OSTYPE_QNX4,
|
|
|
|
OSTYPE_NTO
|
|
|
|
};
|
|
|
|
|
2011-01-11 04:38:51 +08:00
|
|
|
/* These correspond to the DSMSG_* versions in dsmsgs.h. */
|
2003-05-05 21:57:21 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
NTO_REG_GENERAL,
|
|
|
|
NTO_REG_FLOAT,
|
|
|
|
NTO_REG_SYSTEM,
|
|
|
|
NTO_REG_ALT,
|
|
|
|
NTO_REG_END
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef char qnx_reg64[8];
|
|
|
|
|
|
|
|
typedef struct _debug_regs
|
|
|
|
{
|
|
|
|
qnx_reg64 padding[1024];
|
|
|
|
} nto_regset_t;
|
|
|
|
|
Create private_thread_info hierarchy
There are multiple definitions of the private_thread_info structure
compiled in the same GDB build. Because of the one definition rule, we
need to change this if we want to be able to make them non-POD (e.g. use
std::vector fields). This patch creates a class hierarchy, with
private_thread_info being an abstract base class, and all the specific
implementations inheriting from it.
In order to poison XNEW/xfree for non-POD types, it is also needed to
get rid of the xfree in thread_info::~thread_info, which operates on an
opaque type. This is replaced by thread_info::priv now being a
unique_ptr, which calls the destructor of the private_thread_info
subclass when the thread is being destroyed.
Including gdbthread.h from darwin-nat.h gave these errors:
/Users/simark/src/binutils-gdb/gdb/gdbthread.h:609:3: error: must use 'class' tag to refer to type 'thread_info' in this scope
thread_info *m_thread;
^
class
/usr/include/mach/thread_act.h:240:15: note: class 'thread_info' is hidden by a non-type declaration of 'thread_info' here
kern_return_t thread_info
^
It turns out that there is a thread_info function in the Darwin/XNU/mach API:
http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html
Therefore, I had to add the class keyword at a couple of places in gdbthread.h,
I don't really see a way around it.
gdb/ChangeLog:
* gdbthread.h (private_thread_info): Define structure type, add
virtual pure destructor.
(thread_info) <priv>: Change type to unique_ptr.
<private_dtor>: Remove.
* thread.c (add_thread_with_info): Adjust to use of unique_ptr.
(private_thread_info::~private_thread_info): Provide default
implementation.
(thread_info::~thread_info): Don't call private_dtor nor
manually free priv.
* aix-thread.c (private_thread_info): Rename to ...
(aix_thread_info): ... this.
(get_aix_thread_info): New.
(sync_threadlists): Adjust.
(iter_tid): Adjust.
(aix_thread_resume): Adjust.
(aix_thread_fetch_registers): Adjust.
(aix_thread_store_registers): Adjust.
(aix_thread_extra_thread_info): Adjust.
* darwin-nat.h (private_thread_info): Rename to ...
(darwin_thread_info): ... this.
(get_darwin_thread_info): New.
* darwin-nat.c (darwin_init_thread_list): Adjust.
(darwin_check_new_threads): Adjust.
(thread_info_from_private_thread_info): Adjust.
* linux-thread-db.c (private_thread_info): Rename to ...
(thread_db_thread_info): ... this, initialize fields.
(get_thread_db_thread_info): New.
<dying>: Change type to bool.
(update_thread_state): Adjust to type rename.
(record_thread): Adjust to type rename an use of unique_ptr.
(thread_db_pid_to_str): Likewise.
(thread_db_extra_thread_info): Likewise.
(thread_db_thread_handle_to_thread_info): Likewise.
(thread_db_get_thread_local_address): Likewise.
* nto-tdep.h (private_thread_info): Rename to ...
(nto_thread_info): ... this, initialize fields.
(get_nto_thread_info): New.
<name>: Change type to std::string.
* nto-tdep.c (nto_extra_thread_info): Adjust to type rename and
use of unique_ptr.
* nto-procfs.c (update_thread_private_data_name): Adjust to
std::string change, allocate nto_private_thread_info with new.
(update_thread_private_data): Adjust to unique_ptr.
* remote.c (private_thread_info): Rename to ...
(remote_thread_info): ... this, initialize data members with
default values.
<extra, name>: Change type to std::string.
<thread_handle>: Change type to non-pointer.
(free_private_thread_info): Remove.
(get_private_info_thread): Rename to...
(get_remote_thread_info): ... this, change return type, adjust to
use of unique_ptr, use remote_thread_info constructor.
(remote_add_thread): Adjust.
(get_private_info_ptid): Rename to...
(get_remote_thread_info): ...this, change return type.
(remote_thread_name): Use get_remote_thread_info, adjust to
change to std::string.
(struct thread_item) <~thread_item>: Remove.
<thread_handle>: Make non pointer.
(start_thread): Adjust to thread_item::thread_handle type
change.
(remote_update_thread_list): Adjust to type name change, move
strings from temporary to long-lived object instead of
duplicating.
(remote_threads_extra_info): Use get_remote_thread_info.
(process_initial_stop_replies): Likewise.
(resume_clear_thread_private_info): Likewise.
(remote_resume): Adjust to type name change.
(remote_commit_resume): Use get_remote_thread_info.
(process_stop_reply): Adjust to type name change.
(remote_stopped_by_sw_breakpoint): Use get_remote_thread_info.
(remote_stopped_by_hw_breakpoint): Likewise.
(remote_stopped_by_watchpoint): Likewise.
(remote_stopped_data_address): Likewise.
(remote_core_of_thread): Likewise.
(remote_thread_handle_to_thread_info): Use
get_private_info_thread, adjust to thread_handle field type
change.
2017-11-24 23:40:31 +08:00
|
|
|
struct nto_thread_info : public private_thread_info
|
2009-07-28 21:20:26 +08:00
|
|
|
{
|
Create private_thread_info hierarchy
There are multiple definitions of the private_thread_info structure
compiled in the same GDB build. Because of the one definition rule, we
need to change this if we want to be able to make them non-POD (e.g. use
std::vector fields). This patch creates a class hierarchy, with
private_thread_info being an abstract base class, and all the specific
implementations inheriting from it.
In order to poison XNEW/xfree for non-POD types, it is also needed to
get rid of the xfree in thread_info::~thread_info, which operates on an
opaque type. This is replaced by thread_info::priv now being a
unique_ptr, which calls the destructor of the private_thread_info
subclass when the thread is being destroyed.
Including gdbthread.h from darwin-nat.h gave these errors:
/Users/simark/src/binutils-gdb/gdb/gdbthread.h:609:3: error: must use 'class' tag to refer to type 'thread_info' in this scope
thread_info *m_thread;
^
class
/usr/include/mach/thread_act.h:240:15: note: class 'thread_info' is hidden by a non-type declaration of 'thread_info' here
kern_return_t thread_info
^
It turns out that there is a thread_info function in the Darwin/XNU/mach API:
http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html
Therefore, I had to add the class keyword at a couple of places in gdbthread.h,
I don't really see a way around it.
gdb/ChangeLog:
* gdbthread.h (private_thread_info): Define structure type, add
virtual pure destructor.
(thread_info) <priv>: Change type to unique_ptr.
<private_dtor>: Remove.
* thread.c (add_thread_with_info): Adjust to use of unique_ptr.
(private_thread_info::~private_thread_info): Provide default
implementation.
(thread_info::~thread_info): Don't call private_dtor nor
manually free priv.
* aix-thread.c (private_thread_info): Rename to ...
(aix_thread_info): ... this.
(get_aix_thread_info): New.
(sync_threadlists): Adjust.
(iter_tid): Adjust.
(aix_thread_resume): Adjust.
(aix_thread_fetch_registers): Adjust.
(aix_thread_store_registers): Adjust.
(aix_thread_extra_thread_info): Adjust.
* darwin-nat.h (private_thread_info): Rename to ...
(darwin_thread_info): ... this.
(get_darwin_thread_info): New.
* darwin-nat.c (darwin_init_thread_list): Adjust.
(darwin_check_new_threads): Adjust.
(thread_info_from_private_thread_info): Adjust.
* linux-thread-db.c (private_thread_info): Rename to ...
(thread_db_thread_info): ... this, initialize fields.
(get_thread_db_thread_info): New.
<dying>: Change type to bool.
(update_thread_state): Adjust to type rename.
(record_thread): Adjust to type rename an use of unique_ptr.
(thread_db_pid_to_str): Likewise.
(thread_db_extra_thread_info): Likewise.
(thread_db_thread_handle_to_thread_info): Likewise.
(thread_db_get_thread_local_address): Likewise.
* nto-tdep.h (private_thread_info): Rename to ...
(nto_thread_info): ... this, initialize fields.
(get_nto_thread_info): New.
<name>: Change type to std::string.
* nto-tdep.c (nto_extra_thread_info): Adjust to type rename and
use of unique_ptr.
* nto-procfs.c (update_thread_private_data_name): Adjust to
std::string change, allocate nto_private_thread_info with new.
(update_thread_private_data): Adjust to unique_ptr.
* remote.c (private_thread_info): Rename to ...
(remote_thread_info): ... this, initialize data members with
default values.
<extra, name>: Change type to std::string.
<thread_handle>: Change type to non-pointer.
(free_private_thread_info): Remove.
(get_private_info_thread): Rename to...
(get_remote_thread_info): ... this, change return type, adjust to
use of unique_ptr, use remote_thread_info constructor.
(remote_add_thread): Adjust.
(get_private_info_ptid): Rename to...
(get_remote_thread_info): ...this, change return type.
(remote_thread_name): Use get_remote_thread_info, adjust to
change to std::string.
(struct thread_item) <~thread_item>: Remove.
<thread_handle>: Make non pointer.
(start_thread): Adjust to thread_item::thread_handle type
change.
(remote_update_thread_list): Adjust to type name change, move
strings from temporary to long-lived object instead of
duplicating.
(remote_threads_extra_info): Use get_remote_thread_info.
(process_initial_stop_replies): Likewise.
(resume_clear_thread_private_info): Likewise.
(remote_resume): Adjust to type name change.
(remote_commit_resume): Use get_remote_thread_info.
(process_stop_reply): Adjust to type name change.
(remote_stopped_by_sw_breakpoint): Use get_remote_thread_info.
(remote_stopped_by_hw_breakpoint): Likewise.
(remote_stopped_by_watchpoint): Likewise.
(remote_stopped_data_address): Likewise.
(remote_core_of_thread): Likewise.
(remote_thread_handle_to_thread_info): Use
get_private_info_thread, adjust to thread_handle field type
change.
2017-11-24 23:40:31 +08:00
|
|
|
short tid = 0;
|
|
|
|
unsigned char state = 0;
|
|
|
|
unsigned char flags = 0;
|
|
|
|
std::string name;
|
2009-07-28 21:20:26 +08:00
|
|
|
};
|
|
|
|
|
Create private_thread_info hierarchy
There are multiple definitions of the private_thread_info structure
compiled in the same GDB build. Because of the one definition rule, we
need to change this if we want to be able to make them non-POD (e.g. use
std::vector fields). This patch creates a class hierarchy, with
private_thread_info being an abstract base class, and all the specific
implementations inheriting from it.
In order to poison XNEW/xfree for non-POD types, it is also needed to
get rid of the xfree in thread_info::~thread_info, which operates on an
opaque type. This is replaced by thread_info::priv now being a
unique_ptr, which calls the destructor of the private_thread_info
subclass when the thread is being destroyed.
Including gdbthread.h from darwin-nat.h gave these errors:
/Users/simark/src/binutils-gdb/gdb/gdbthread.h:609:3: error: must use 'class' tag to refer to type 'thread_info' in this scope
thread_info *m_thread;
^
class
/usr/include/mach/thread_act.h:240:15: note: class 'thread_info' is hidden by a non-type declaration of 'thread_info' here
kern_return_t thread_info
^
It turns out that there is a thread_info function in the Darwin/XNU/mach API:
http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html
Therefore, I had to add the class keyword at a couple of places in gdbthread.h,
I don't really see a way around it.
gdb/ChangeLog:
* gdbthread.h (private_thread_info): Define structure type, add
virtual pure destructor.
(thread_info) <priv>: Change type to unique_ptr.
<private_dtor>: Remove.
* thread.c (add_thread_with_info): Adjust to use of unique_ptr.
(private_thread_info::~private_thread_info): Provide default
implementation.
(thread_info::~thread_info): Don't call private_dtor nor
manually free priv.
* aix-thread.c (private_thread_info): Rename to ...
(aix_thread_info): ... this.
(get_aix_thread_info): New.
(sync_threadlists): Adjust.
(iter_tid): Adjust.
(aix_thread_resume): Adjust.
(aix_thread_fetch_registers): Adjust.
(aix_thread_store_registers): Adjust.
(aix_thread_extra_thread_info): Adjust.
* darwin-nat.h (private_thread_info): Rename to ...
(darwin_thread_info): ... this.
(get_darwin_thread_info): New.
* darwin-nat.c (darwin_init_thread_list): Adjust.
(darwin_check_new_threads): Adjust.
(thread_info_from_private_thread_info): Adjust.
* linux-thread-db.c (private_thread_info): Rename to ...
(thread_db_thread_info): ... this, initialize fields.
(get_thread_db_thread_info): New.
<dying>: Change type to bool.
(update_thread_state): Adjust to type rename.
(record_thread): Adjust to type rename an use of unique_ptr.
(thread_db_pid_to_str): Likewise.
(thread_db_extra_thread_info): Likewise.
(thread_db_thread_handle_to_thread_info): Likewise.
(thread_db_get_thread_local_address): Likewise.
* nto-tdep.h (private_thread_info): Rename to ...
(nto_thread_info): ... this, initialize fields.
(get_nto_thread_info): New.
<name>: Change type to std::string.
* nto-tdep.c (nto_extra_thread_info): Adjust to type rename and
use of unique_ptr.
* nto-procfs.c (update_thread_private_data_name): Adjust to
std::string change, allocate nto_private_thread_info with new.
(update_thread_private_data): Adjust to unique_ptr.
* remote.c (private_thread_info): Rename to ...
(remote_thread_info): ... this, initialize data members with
default values.
<extra, name>: Change type to std::string.
<thread_handle>: Change type to non-pointer.
(free_private_thread_info): Remove.
(get_private_info_thread): Rename to...
(get_remote_thread_info): ... this, change return type, adjust to
use of unique_ptr, use remote_thread_info constructor.
(remote_add_thread): Adjust.
(get_private_info_ptid): Rename to...
(get_remote_thread_info): ...this, change return type.
(remote_thread_name): Use get_remote_thread_info, adjust to
change to std::string.
(struct thread_item) <~thread_item>: Remove.
<thread_handle>: Make non pointer.
(start_thread): Adjust to thread_item::thread_handle type
change.
(remote_update_thread_list): Adjust to type name change, move
strings from temporary to long-lived object instead of
duplicating.
(remote_threads_extra_info): Use get_remote_thread_info.
(process_initial_stop_replies): Likewise.
(resume_clear_thread_private_info): Likewise.
(remote_resume): Adjust to type name change.
(remote_commit_resume): Use get_remote_thread_info.
(process_stop_reply): Adjust to type name change.
(remote_stopped_by_sw_breakpoint): Use get_remote_thread_info.
(remote_stopped_by_hw_breakpoint): Likewise.
(remote_stopped_by_watchpoint): Likewise.
(remote_stopped_data_address): Likewise.
(remote_core_of_thread): Likewise.
(remote_thread_handle_to_thread_info): Use
get_private_info_thread, adjust to thread_handle field type
change.
2017-11-24 23:40:31 +08:00
|
|
|
static inline nto_thread_info *
|
|
|
|
get_nto_thread_info (thread_info *thread)
|
|
|
|
{
|
2022-09-25 03:34:09 +08:00
|
|
|
return gdb::checked_static_cast<nto_thread_info *> (thread->priv.get ());
|
Create private_thread_info hierarchy
There are multiple definitions of the private_thread_info structure
compiled in the same GDB build. Because of the one definition rule, we
need to change this if we want to be able to make them non-POD (e.g. use
std::vector fields). This patch creates a class hierarchy, with
private_thread_info being an abstract base class, and all the specific
implementations inheriting from it.
In order to poison XNEW/xfree for non-POD types, it is also needed to
get rid of the xfree in thread_info::~thread_info, which operates on an
opaque type. This is replaced by thread_info::priv now being a
unique_ptr, which calls the destructor of the private_thread_info
subclass when the thread is being destroyed.
Including gdbthread.h from darwin-nat.h gave these errors:
/Users/simark/src/binutils-gdb/gdb/gdbthread.h:609:3: error: must use 'class' tag to refer to type 'thread_info' in this scope
thread_info *m_thread;
^
class
/usr/include/mach/thread_act.h:240:15: note: class 'thread_info' is hidden by a non-type declaration of 'thread_info' here
kern_return_t thread_info
^
It turns out that there is a thread_info function in the Darwin/XNU/mach API:
http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_info.html
Therefore, I had to add the class keyword at a couple of places in gdbthread.h,
I don't really see a way around it.
gdb/ChangeLog:
* gdbthread.h (private_thread_info): Define structure type, add
virtual pure destructor.
(thread_info) <priv>: Change type to unique_ptr.
<private_dtor>: Remove.
* thread.c (add_thread_with_info): Adjust to use of unique_ptr.
(private_thread_info::~private_thread_info): Provide default
implementation.
(thread_info::~thread_info): Don't call private_dtor nor
manually free priv.
* aix-thread.c (private_thread_info): Rename to ...
(aix_thread_info): ... this.
(get_aix_thread_info): New.
(sync_threadlists): Adjust.
(iter_tid): Adjust.
(aix_thread_resume): Adjust.
(aix_thread_fetch_registers): Adjust.
(aix_thread_store_registers): Adjust.
(aix_thread_extra_thread_info): Adjust.
* darwin-nat.h (private_thread_info): Rename to ...
(darwin_thread_info): ... this.
(get_darwin_thread_info): New.
* darwin-nat.c (darwin_init_thread_list): Adjust.
(darwin_check_new_threads): Adjust.
(thread_info_from_private_thread_info): Adjust.
* linux-thread-db.c (private_thread_info): Rename to ...
(thread_db_thread_info): ... this, initialize fields.
(get_thread_db_thread_info): New.
<dying>: Change type to bool.
(update_thread_state): Adjust to type rename.
(record_thread): Adjust to type rename an use of unique_ptr.
(thread_db_pid_to_str): Likewise.
(thread_db_extra_thread_info): Likewise.
(thread_db_thread_handle_to_thread_info): Likewise.
(thread_db_get_thread_local_address): Likewise.
* nto-tdep.h (private_thread_info): Rename to ...
(nto_thread_info): ... this, initialize fields.
(get_nto_thread_info): New.
<name>: Change type to std::string.
* nto-tdep.c (nto_extra_thread_info): Adjust to type rename and
use of unique_ptr.
* nto-procfs.c (update_thread_private_data_name): Adjust to
std::string change, allocate nto_private_thread_info with new.
(update_thread_private_data): Adjust to unique_ptr.
* remote.c (private_thread_info): Rename to ...
(remote_thread_info): ... this, initialize data members with
default values.
<extra, name>: Change type to std::string.
<thread_handle>: Change type to non-pointer.
(free_private_thread_info): Remove.
(get_private_info_thread): Rename to...
(get_remote_thread_info): ... this, change return type, adjust to
use of unique_ptr, use remote_thread_info constructor.
(remote_add_thread): Adjust.
(get_private_info_ptid): Rename to...
(get_remote_thread_info): ...this, change return type.
(remote_thread_name): Use get_remote_thread_info, adjust to
change to std::string.
(struct thread_item) <~thread_item>: Remove.
<thread_handle>: Make non pointer.
(start_thread): Adjust to thread_item::thread_handle type
change.
(remote_update_thread_list): Adjust to type name change, move
strings from temporary to long-lived object instead of
duplicating.
(remote_threads_extra_info): Use get_remote_thread_info.
(process_initial_stop_replies): Likewise.
(resume_clear_thread_private_info): Likewise.
(remote_resume): Adjust to type name change.
(remote_commit_resume): Use get_remote_thread_info.
(process_stop_reply): Adjust to type name change.
(remote_stopped_by_sw_breakpoint): Use get_remote_thread_info.
(remote_stopped_by_hw_breakpoint): Likewise.
(remote_stopped_by_watchpoint): Likewise.
(remote_stopped_data_address): Likewise.
(remote_core_of_thread): Likewise.
(remote_thread_handle_to_thread_info): Use
get_private_info_thread, adjust to thread_handle field type
change.
2017-11-24 23:40:31 +08:00
|
|
|
}
|
|
|
|
|
2015-10-21 22:37:33 +08:00
|
|
|
/* Per-inferior data, common for both procfs and remote. */
|
|
|
|
struct nto_inferior_data
|
|
|
|
{
|
|
|
|
/* Last stopped flags result from wait function */
|
2019-05-02 05:21:36 +08:00
|
|
|
unsigned int stopped_flags = 0;
|
2015-10-21 22:37:33 +08:00
|
|
|
|
|
|
|
/* Last known stopped PC */
|
2019-05-02 05:21:36 +08:00
|
|
|
CORE_ADDR stopped_pc = 0;
|
2015-10-21 22:37:33 +08:00
|
|
|
};
|
|
|
|
|
2004-12-10 21:38:23 +08:00
|
|
|
/* Generic functions in nto-tdep.c. */
|
|
|
|
|
|
|
|
void nto_init_solib_absolute_prefix (void);
|
|
|
|
|
2008-07-23 21:36:00 +08:00
|
|
|
char **nto_parse_redirection (char *start_argv[], const char **in,
|
|
|
|
const char **out, const char **err);
|
2004-12-10 21:38:23 +08:00
|
|
|
|
2023-10-18 03:37:58 +08:00
|
|
|
void nto_relocate_section_addresses (shobj &, target_section *);
|
2004-12-10 21:38:23 +08:00
|
|
|
|
|
|
|
int nto_map_arch_to_cputype (const char *);
|
|
|
|
|
Change openp et al to use a unique_xmalloc_ptr
This changes openp, source_full_path_of, and find_and_open_source to
take a unique_xmalloc_ptr, rather than a char*, as an outgoing
argument type. This simplifies the API, ownership-wise, and allows
for the removal of some cleanups.
gdb/ChangeLog
2018-02-14 Tom Tromey <tom@tromey.com>
* symfile.c (symfile_bfd_open): Update.
* source.h (openp, source_full_path_of, find_and_open_source):
Change argument type to unique_xmalloc_ptr.
* source.c (openp): Take a unique_xmalloc_ptr.
(source_full_path_of, find_and_open_source): Likewise.
(open_source_file, symtab_to_fullname): Update.
* solist.h (struct target_so_ops) <find_and_open_solib>: Take a
unique_xmalloc_ptr.
* solib.c (solib_find_1): Use unique_xmalloc_ptr.
(exec_file_find): Update.
* psymtab.c (psymtab_to_fullname): Update.
* nto-tdep.h (nto_find_and_open_solib): Update.
* nto-tdep.c (nto_find_and_open_solib): Change temp_path to a
unique_xmalloc_ptr.
* exec.c (exec_file_attach): Update.
* dwarf2read.c (try_open_dwop_file): Use unique_xmalloc_ptr.
* cli/cli-cmds.c (find_and_open_script): Use unique_xmalloc_ptr.
2017-11-11 04:47:05 +08:00
|
|
|
int nto_find_and_open_solib (const char *, unsigned,
|
|
|
|
gdb::unique_xmalloc_ptr<char> *);
|
2004-12-10 21:38:23 +08:00
|
|
|
|
|
|
|
enum gdb_osabi nto_elf_osabi_sniffer (bfd *abfd);
|
|
|
|
|
|
|
|
void nto_initialize_signals (void);
|
|
|
|
|
|
|
|
/* Dummy function for initializing nto_target_ops on targets which do
|
|
|
|
not define a particular regset. */
|
2007-05-06 22:30:45 +08:00
|
|
|
void nto_dummy_supply_regset (struct regcache *regcache, char *regs);
|
2004-12-10 21:38:23 +08:00
|
|
|
|
|
|
|
int nto_in_dynsym_resolve_code (CORE_ADDR pc);
|
|
|
|
|
2017-04-06 02:21:34 +08:00
|
|
|
const char *nto_extra_thread_info (struct target_ops *self, struct thread_info *);
|
2009-07-28 21:20:26 +08:00
|
|
|
|
2023-06-09 15:20:14 +08:00
|
|
|
LONGEST nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack,
|
2015-10-21 00:58:47 +08:00
|
|
|
gdb_byte *readbuf,
|
|
|
|
LONGEST len, size_t sizeof_auxv_t);
|
2015-10-21 22:37:33 +08:00
|
|
|
|
|
|
|
struct nto_inferior_data *nto_inferior_data (struct inferior *inf);
|
|
|
|
|
2019-01-28 03:51:36 +08:00
|
|
|
#endif /* NTO_TDEP_H */
|