return current_inferior ()->arch ();
}
-int
+bool
default_has_shared_address_space (struct gdbarch *gdbarch)
{
/* Simply say no. In most unix-like targets each inferior/process
has its own address space. */
- return 0;
+ return false;
}
int
routines to determine the architecture to execute a command in. */
extern struct gdbarch *get_current_arch (void);
-extern int default_has_shared_address_space (struct gdbarch *);
+extern bool default_has_shared_address_space (struct gdbarch *);
extern int default_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
CORE_ADDR addr, std::string *msg);
gdbarch->has_global_breakpoints = has_global_breakpoints;
}
-int
+bool
gdbarch_has_shared_address_space (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
/* True if inferiors share an address space (e.g., uClinux). */
-typedef int (gdbarch_has_shared_address_space_ftype) (struct gdbarch *gdbarch);
-extern int gdbarch_has_shared_address_space (struct gdbarch *gdbarch);
+typedef bool (gdbarch_has_shared_address_space_ftype) (struct gdbarch *gdbarch);
+extern bool gdbarch_has_shared_address_space (struct gdbarch *gdbarch);
extern void set_gdbarch_has_shared_address_space (struct gdbarch *gdbarch, gdbarch_has_shared_address_space_ftype *has_shared_address_space);
/* True if a fast tracepoint can be set at an address. */
comment="""
True if inferiors share an address space (e.g., uClinux).
""",
- type="int",
+ type="bool",
name="has_shared_address_space",
params=[],
predefault="default_has_shared_address_space",
/* Return true if the target is running on uClinux instead of normal
Linux kernel. */
-int
-linux_is_uclinux (void)
+bool
+linux_is_uclinux ()
{
CORE_ADDR dummy;
&& target_auxv_search (AT_PAGESZ, &dummy) == 0);
}
-static int
+static bool
linux_has_shared_address_space (struct gdbarch *gdbarch)
{
return linux_is_uclinux ();
extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
int num_disp_step_buffers);
-extern int linux_is_uclinux (void);
+extern bool linux_is_uclinux ();
/* Fetch the AT_HWCAP entry from auxv data AUXV. Use TARGET and GDBARCH to
parse auxv entries.
};
/* Nonzero if running on uClinux. */
-static int target_is_uclinux;
+static std::optional<bool> target_is_uclinux;
static void
m68k_linux_inferior_created (inferior *inf)
{
/* Record that we will need to re-evaluate whether we are running on a
uClinux or normal GNU/Linux target (see m68k_linux_get_sigtramp_info). */
- target_is_uclinux = -1;
+ target_is_uclinux = std::nullopt;
}
static struct m68k_linux_sigtramp_info
/* Determine whether we are running on a uClinux or normal GNU/Linux
target so we can use the correct sigcontext layouts. */
- if (target_is_uclinux == -1)
+ if (!target_is_uclinux.has_value ())
target_is_uclinux = linux_is_uclinux ();
sp = get_frame_register_unsigned (this_frame, M68K_SP_REGNUM);
if (m68k_linux_pc_in_sigtramp (this_frame) == 2)
info.sc_reg_offset = m68k_linux_ucontext_reg_offset;
else
- info.sc_reg_offset = (target_is_uclinux
+ info.sc_reg_offset = (target_is_uclinux.value ()
? m68k_uclinux_sigcontext_reg_offset
: m68k_linux_sigcontext_reg_offset);
return info;
address_space_ref_ptr
maybe_new_address_space ()
{
- int shared_aspace
- = gdbarch_has_shared_address_space (current_inferior ()->arch ());
-
- if (shared_aspace)
+ if (gdbarch_has_shared_address_space (current_inferior ()->arch ()))
{
/* Just return the first in the list. */
return program_spaces[0]->aspace;