/* PPC GNU/Linux native support.
- Copyright (C) 1988-2022 Free Software Foundation, Inc.
+ Copyright (C) 1988-2023 Free Software Foundation, Inc.
This file is part of GDB.
The layout is like this (where x is the actual value of the vscr reg): */
-/* *INDENT-OFF* */
/*
Big-Endian:
|.|.|.|.|.....|.|.|.|.||.|.|.|x||.|
<-------> <-------><-------><->
VR0 VR31 VSCR VRSAVE
*/
-/* *INDENT-ON* */
typedef char gdb_vrregset_t[PPC_LINUX_SIZEOF_VRREGSET];
/* One and only one of these three functions returns true, indicating
whether the corresponding interface is the one we detected. The
- interface must already have been detected as a precontidion. */
+ interface must already have been detected as a precondition. */
bool hwdebug_p ()
{
UNAVAILABLE can indicate that the kernel doesn't support any of the
two sets of requests or that there was an error when we tried to
- detect wich interface is available. */
+ detect which interface is available. */
enum debug_reg_interface
{
static ppc_linux_nat_target the_ppc_linux_nat_target;
-/* *INDENT-OFF* */
/* registers layout, as presented by the ptrace interface:
PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7,
PT_R8, PT_R9, PT_R10, PT_R11, PT_R12, PT_R13, PT_R14, PT_R15,
PT_FPR0 + 48, PT_FPR0 + 50, PT_FPR0 + 52, PT_FPR0 + 54,
PT_FPR0 + 56, PT_FPR0 + 58, PT_FPR0 + 60, PT_FPR0 + 62,
PT_NIP, PT_MSR, PT_CCR, PT_LNK, PT_CTR, PT_XER, PT_MQ */
-/* *INDENT_ON * */
static int
ppc_register_u_addr (struct gdbarch *gdbarch, int regno)
regcache->raw_supply (regno, buf + padding);
}
else
- internal_error (__FILE__, __LINE__,
- _("fetch_register: unexpected byte order: %d"),
+ internal_error (_("fetch_register: unexpected byte order: %d"),
gdbarch_byte_order (gdbarch));
}
const struct target_desc *
ppc_linux_nat_target::read_description ()
{
+ if (inferior_ptid == null_ptid)
+ return this->beneath ()->read_description ();
+
int tid = inferior_ptid.pid ();
if (have_ptrace_getsetevrregs)
features.wordsize = ppc_linux_target_wordsize (tid);
- CORE_ADDR hwcap = linux_get_hwcap (current_inferior ()->top_target ());
- CORE_ADDR hwcap2 = linux_get_hwcap2 (current_inferior ()->top_target ());
+ CORE_ADDR hwcap = linux_get_hwcap ();
+ CORE_ADDR hwcap2 = linux_get_hwcap2 ();
if (have_ptrace_getsetvsxregs
&& (hwcap & PPC_FEATURE_HAS_VSX))
takes two hardware watchpoints though. */
if (len > 1
&& hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
- && (linux_get_hwcap (current_inferior ()->top_target ())
- & PPC_FEATURE_BOOKE))
+ && (linux_get_hwcap () & PPC_FEATURE_BOOKE))
return 2;
/* Check if the processor provides DAWR interface. */
if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
/* DAWR interface allows to watch up to 512 byte wide ranges. */
region_size = 512;
/* DAWR interface allows to watch up to 512 byte wide ranges which
- can't cross a 512 byte bondary on machines that doesn't have a
+ can't cross a 512 byte boundary on machines that don't have a
second DAWR (P9 or less). */
if (!(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_ARCH_31))
region_align = 512;
{
gdb_assert (m_dreg_interface.debugreg_p ());
- if (((linux_get_hwcap (current_inferior ()->top_target ())
- & PPC_FEATURE_BOOKE)
+ if (((linux_get_hwcap () & PPC_FEATURE_BOOKE)
&& (addr + len) > (addr & ~3) + 4)
|| (addr + len) > (addr & ~7) + 8)
return 0;
struct value *v = iter.get ();
/* Constants and values from the history are fine. */
- if (VALUE_LVAL (v) == not_lval || deprecated_value_modifiable (v) == 0)
+ if (v->lval () == not_lval || !v->deprecated_modifiable ())
continue;
- else if (VALUE_LVAL (v) == lval_memory)
+ else if (v->lval () == lval_memory)
{
/* A lazy memory lvalue is one that GDB never needed to fetch;
we either just used its address (e.g., `a' in `a.b') or
we never needed it at all (e.g., `a' in `a,b'). */
- if (!value_lazy (v))
+ if (!v->lazy ())
found_memory_cnt++;
}
/* Other kinds of values are not fine. */
return 0;
if (num_accesses_left == 1 && num_accesses_right == 0
- && VALUE_LVAL (left_val) == lval_memory
- && value_address (left_val) == watch_addr)
+ && left_val->lval () == lval_memory
+ && left_val->address () == watch_addr)
{
*data_value = value_as_long (right_val);
/* DATA_VALUE is the constant in RIGHT_VAL, but actually has
the same type as the memory region referenced by LEFT_VAL. */
- *len = check_typedef (value_type (left_val))->length ();
+ *len = check_typedef (left_val->type ())->length ();
}
else if (num_accesses_left == 0 && num_accesses_right == 1
- && VALUE_LVAL (right_val) == lval_memory
- && value_address (right_val) == watch_addr)
+ && right_val->lval () == lval_memory
+ && right_val->address () == watch_addr)
{
*data_value = value_as_long (left_val);
/* DATA_VALUE is the constant in LEFT_VAL, but actually has
the same type as the memory region referenced by RIGHT_VAL. */
- *len = check_typedef (value_type (right_val))->length ();
+ *len = check_typedef (right_val->type ())->length ();
}
else
return 0;
long wp_value;
long read_mode, write_mode;
- if (linux_get_hwcap (current_inferior ()->top_target ())
- & PPC_FEATURE_BOOKE)
+ if (linux_get_hwcap () & PPC_FEATURE_BOOKE)
{
/* PowerPC 440 requires only the read/write flags to be passed
to the kernel. */
}
/* Copy the per-process state associated with the pid of PARENT to the
- sate of CHILD_PID. GDB expects that a forked process will have the
+ state of CHILD_PID. GDB expects that a forked process will have the
same hardware breakpoints and watchpoints as the parent.
If we're using the HWDEBUG interface, also copy the thread debug
perror_with_name (_("Error deleting hardware "
"breakpoint or watchpoint"));
- /* We erase the entries one at a time after successfuly
+ /* We erase the entries one at a time after successfully
removing the corresponding slot form the thread so that
if we throw an exception above in a future iteration the
map remains consistent. */
int mask;
if (m_dreg_interface.hwdebug_p ()
- && (linux_get_hwcap (current_inferior ()->top_target ())
- & PPC_FEATURE_BOOKE))
+ && (linux_get_hwcap () & PPC_FEATURE_BOOKE))
return start <= addr && start + length >= addr;
- else if (linux_get_hwcap (current_inferior ()->top_target ())
- & PPC_FEATURE_BOOKE)
+ else if (linux_get_hwcap () & PPC_FEATURE_BOOKE)
mask = 3;
else
mask = 7;