#include "defs.h"
#include "arch-utils.h"
#include "dwarf2-frame.h"
-#include "floatformat.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
}
static void
-info_adi_command (char *args, int from_tty)
+info_adi_command (const char *args, int from_tty)
{
printf_unfiltered ("\"adi\" must be followed by \"examine\" "
"or \"assign\".\n");
pid_t pid = ptid_get_pid (inferior_ptid);
snprintf (filename, sizeof filename, "/proc/%ld/adi/maps", (long) pid);
- char *data = target_fileio_read_stralloc (NULL, filename);
+ gdb::unique_xmalloc_ptr<char> data
+ = target_fileio_read_stralloc (NULL, filename);
if (data)
{
- struct cleanup *cleanup = make_cleanup (xfree, data);
adi_stat_t adi_stat = get_adi_info (pid);
char *line;
- for (line = strtok (data, "\n"); line; line = strtok (NULL, "\n"))
+ for (line = strtok (data.get (), "\n"); line; line = strtok (NULL, "\n"))
{
ULONGEST addr, endaddr;
&& ((vaddr + i) * adi_stat.blksize) < endaddr)
{
if (++i == cnt)
- {
- do_cleanups (cleanup);
- return true;
- }
+ return true;
}
}
- do_cleanups (cleanup);
}
else
warning (_("unable to open /proc file '%s'"), filename);
for "SIZE" number of bytes. */
static int
-adi_read_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
+adi_read_versions (CORE_ADDR vaddr, size_t size, gdb_byte *tags)
{
int fd = adi_tag_fd ();
if (fd == -1)
at "VADDR" with number of "CNT". */
static void
-adi_print_versions (CORE_ADDR vaddr, size_t cnt, unsigned char *tags)
+adi_print_versions (CORE_ADDR vaddr, size_t cnt, gdb_byte *tags)
{
int v_idx = 0;
const int maxelts = 8; /* # of elements per line */
do_examine (CORE_ADDR start, int bcnt)
{
CORE_ADDR vaddr = adi_normalize_address (start);
- struct cleanup *cleanup;
CORE_ADDR vstart = adi_align_address (vaddr);
int cnt = adi_convert_byte_count (vaddr, bcnt, vstart);
- unsigned char *buf = (unsigned char *) xmalloc (cnt);
- cleanup = make_cleanup (xfree, buf);
- int read_cnt = adi_read_versions (vstart, cnt, buf);
+ gdb::def_vector<gdb_byte> buf (cnt);
+ int read_cnt = adi_read_versions (vstart, cnt, buf.data ());
if (read_cnt == -1)
error (_("No ADI information"));
else if (read_cnt < cnt)
error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr));
- adi_print_versions (vstart, cnt, buf);
-
- do_cleanups (cleanup);
+ adi_print_versions (vstart, cnt, buf.data ());
}
static void
adi (examine|x)/count <addr> */
static void
-adi_examine_command (char *args, int from_tty)
+adi_examine_command (const char *args, int from_tty)
{
/* make sure program is active and adi is available */
if (!target_has_execution)
pid_t pid = ptid_get_pid (inferior_ptid);
sparc64_adi_info *proc = get_adi_info_proc (pid);
int cnt = 1;
- char *p = args;
+ const char *p = args;
if (p && *p == '/')
{
p++;
adi (assign|a)/count <addr> = <version> */
static void
-adi_assign_command (char *args, int from_tty)
+adi_assign_command (const char *args, int from_tty)
{
/* make sure program is active and adi is available */
if (!target_has_execution)
if (!adi_available ())
error (_("No ADI information"));
- char *exp = args;
+ const char *exp = args;
if (exp == 0)
error_no_arg (_("Usage: adi assign|a[/count] <addr> = <version>"));
error (_("Usage: adi assign|a[/count] <addr> = <version>"));
size_t cnt = 1;
- char *p = args;
+ const char *p = args;
if (exp && *exp == '/')
{
p = exp + 1;
{
struct type *type;
- type = arch_flags_type (gdbarch, "builtin_type_sparc64_pstate", 8);
+ type = arch_flags_type (gdbarch, "builtin_type_sparc64_pstate", 64);
append_flags_type_flag (type, 0, "AG");
append_flags_type_flag (type, 1, "IE");
append_flags_type_flag (type, 2, "PRIV");
{
struct type *type;
- type = arch_flags_type (gdbarch, "builtin_type_sparc64_ccr", 8);
+ type = arch_flags_type (gdbarch, "builtin_type_sparc64_ccr", 64);
append_flags_type_flag (type, 0, "icc.c");
append_flags_type_flag (type, 1, "icc.v");
append_flags_type_flag (type, 2, "icc.z");
{
struct type *type;
- type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 8);
+ type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 64);
append_flags_type_flag (type, 0, "NXC");
append_flags_type_flag (type, 1, "DZC");
append_flags_type_flag (type, 2, "UFC");
{
struct type *type;
- type = arch_flags_type (gdbarch, "builtin_type_sparc64_fprs", 8);
+ type = arch_flags_type (gdbarch, "builtin_type_sparc64_fprs", 64);
append_flags_type_flag (type, 0, "DL");
append_flags_type_flag (type, 1, "DU");
append_flags_type_flag (type, 2, "FEF");
sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
const gdb_byte *valbuf, int element, int bitpos)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
int len = TYPE_LENGTH (type);
gdb_assert (element < 16);
sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
gdb_byte *valbuf, int bitpos)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
{
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
struct regcache *regcache,
int regnum, const void *gregs)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
const gdb_byte *regs = (const gdb_byte *) gregs;
const struct regcache *regcache,
int regnum, void *gregs)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
gdb_byte *regs = (gdb_byte *) gregs;
struct regcache *regcache,
int regnum, const void *fpregs)
{
- int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+ int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
const gdb_byte *regs = (const gdb_byte *) fpregs;
int i;
const struct regcache *regcache,
int regnum, void *fpregs)
{
- int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+ int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
gdb_byte *regs = (gdb_byte *) fpregs;
int i;