+2009-07-07 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ * generic/gdbtk-bp.c: Include "arch-utils.h".
+ (set_raw_breakpoint): Update external definition.
+ (gdb_set_bp): Adapt to set_raw_breakpoint change.
+ (gdb_set_bp_addr): Likewise.
+
+ * generic/gdbtk-cmds.c: Include "arch-utils.h.
+ (gdbtk_load_asm): Adapt to paddress and gdb_print_insn changes.
+ (hex2bin): Replace current_gdbarch by get_current_arch call.
+ (gdb_update_mem): Adapt to builtin_type changes.
+ (gdb_CA_to_TAS): Use paddress to replace removed function paddr_nz.
+
+ * generic/gdbtk-register.c: Include "arch-utils.h".
+ (get_register_size): Replace current_gdbarch by get_current_arch call.
+ (get_register_types): Likewise.
+ (get_register): Likewise.
+ (get_register_name): Likewise.
+ (map_arg_registers): Likewise.
+ (register_changed_p): Likewise.
+ (setup_architecture_data): Likewise.
+ (gdb_regformat): Likewise.
+ (gdb_reggrouplist): Likewise.
+ (gdb_reggroup): Likewise.
+
+ * generic/gdbtk-stack.c: Inlcude "arch-utils.h".
+ (gdb_get_blocks): Use paddress instead of removed paddr_nz function.
+ (gdb_selected_block): Likewise.
+ (gdb_selected_frame): Likewise.
+
2009-06-19 Pedro Alves <pedro@codesourcery.com>
* generic/gdbtk-cmds.c (gdb_update_mem): Dispatch
#include "target.h"
#include "valprint.h"
#include "regcache.h"
+#include "arch-utils.h"
/* tcl header files includes varargs.h unless HAS_STDARG is defined,
but gdb uses stdarg.h, so make sure HAS_STDARG is defined. */
for (i = 0; i < 3; i++)
Tcl_SetObjLength (client_data->result_obj[i], 0);
- fputs_filtered (paddress (pc), gdb_stdout);
+ fputs_filtered (paddress (get_current_arch (), pc), gdb_stdout);
gdb_flush (gdb_stdout);
result_ptr->obj_ptr = client_data->result_obj[1];
result_ptr->obj_ptr = client_data->result_obj[2];
/* FIXME: cagney/2003-09-08: This should use gdb_disassembly. */
- insn = gdb_print_insn (pc, gdb_stdout, NULL);
+ insn = gdb_print_insn (get_current_arch (), pc, gdb_stdout, NULL);
gdb_flush (gdb_stdout);
client_data->widget_line_no++;
int incr = 2;
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_LITTLE)
{
/* need to read string in reverse */
hex += count - 2;
switch (size)
{
case 1:
- val_type = builtin_type_int8;
+ val_type = builtin_type (get_current_arch ())->builtin_int8;
asize = 'b';
break;
case 2:
- val_type = builtin_type_int16;
+ val_type = builtin_type (get_current_arch ())->builtin_int16;
asize = 'h';
break;
case 4:
- val_type = builtin_type_int32;
+ val_type = builtin_type (get_current_arch ())->builtin_int32;
asize = 'w';
break;
case 8:
- val_type = builtin_type_int64;
+ val_type = builtin_type (get_current_arch ())->builtin_int64;
asize = 'g';
break;
default:
- val_type = builtin_type_int8;
+ val_type = builtin_type (get_current_arch ())->builtin_int8;
asize = 'b';
}
/* This is not really correct. Using paddr_nz() will convert to hex and truncate
to 32-bits when required but will otherwise not do what we really want. */
- Tcl_SetStringObj (result_ptr->obj_ptr, paddr_nz (address), -1);
+
+ Tcl_SetStringObj (result_ptr->obj_ptr,
+ paddress (get_current_arch (), address),
+ -1);
return TCL_OK;
}
#include "gdb_string.h"
#include "language.h"
#include "valprint.h"
+#include "arch-utils.h"
#include <tcl.h>
#include "gdbtk.h"
get_register_size (int regnum, map_arg arg)
{
Tcl_ListObjAppendElement (gdbtk_interp, result_ptr->obj_ptr,
- Tcl_NewIntObj (register_size (current_gdbarch, regnum)));
+ Tcl_NewIntObj (register_size (get_current_arch (),
+ regnum)));
}
/* returns a list of valid types for a register */
struct type *reg_vtype;
int i,n;
- reg_vtype = register_type (current_gdbarch, regnum);
+ reg_vtype = register_type (get_current_arch (), regnum);
if (TYPE_CODE (reg_vtype) == TYPE_CODE_UNION)
{
reg_vtype = regtype[regnum];
if (reg_vtype == NULL)
- reg_vtype = register_type (current_gdbarch, regnum);
+ reg_vtype = register_type (get_current_arch (), regnum);
if (!target_has_registers)
{
strcpy (buf, "0x");
ptr = buf + 2;
- for (j = 0; j < register_size (current_gdbarch, regnum); j++)
+ for (j = 0; j < register_size (get_current_arch (), regnum); j++)
{
- int idx = ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
- ? j : register_size (current_gdbarch, regnum) - 1 - j);
+ int idx = ((gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
+ ? j : register_size (get_current_arch (), regnum) - 1 - j);
sprintf (ptr, "%02x", (unsigned char) buffer[idx]);
ptr += 2;
}
if ((TYPE_CODE (reg_vtype) == TYPE_CODE_UNION)
&& (strcmp (FIELD_NAME (TYPE_FIELD (reg_vtype, 0)),
- gdbarch_register_name (current_gdbarch, regnum)) == 0))
+ gdbarch_register_name (get_current_arch (), regnum)) == 0))
{
val_print (FIELD_TYPE (TYPE_FIELD (reg_vtype, 0)), buffer, 0, 0,
stb, 0, &opts, current_language);
/* Non-zero if the caller wants the register numbers, too. */
int numbers = arg.integer;
Tcl_Obj *name
- = Tcl_NewStringObj (gdbarch_register_name (current_gdbarch, regnum), -1);
+ = Tcl_NewStringObj (gdbarch_register_name (get_current_arch (), regnum), -1);
Tcl_Obj *elt;
if (numbers)
In this case, some entries of gdbarch_register_name will change
depending upon the particular processor being debugged. */
- numregs = (gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch));
+ numregs = (gdbarch_num_regs (get_current_arch ())
+ + gdbarch_num_pseudo_regs (get_current_arch ()));
if (objc == 0) /* No args, just do all the regs */
{
result_ptr->flags |= GDBTK_MAKES_LIST;
for (regnum = 0; regnum < numregs; regnum++)
{
- if (gdbarch_register_name (current_gdbarch, regnum) == NULL
- || *(gdbarch_register_name (current_gdbarch, regnum)) == '\0')
+ if (gdbarch_register_name (get_current_arch (), regnum) == NULL
+ || *(gdbarch_register_name (get_current_arch (), regnum)) == '\0')
continue;
func (regnum, arg);
}
return;
if (memcmp (&old_regs[regnum * MAX_REGISTER_SIZE], raw_buffer,
- register_size (current_gdbarch, regnum)) == 0)
+ register_size (get_current_arch (), regnum)) == 0)
return;
/* Found a changed register. Save new value and return its number. */
memcpy (&old_regs[regnum * MAX_REGISTER_SIZE], raw_buffer,
- register_size (current_gdbarch, regnum));
+ register_size (get_current_arch (), regnum));
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj (regnum));
}
xfree (regformat);
xfree (regtype);
- numregs = (gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch));
+ numregs = (gdbarch_num_regs (get_current_arch ())
+ + gdbarch_num_pseudo_regs (get_current_arch ()));
old_regs = xcalloc (1, numregs * MAX_REGISTER_SIZE + 1);
regformat = (int *)xcalloc (numregs, sizeof(int));
regtype = (struct type **)xcalloc (numregs, sizeof(struct type **));
type = (struct type *)strtol (Tcl_GetStringFromObj (objv[1], NULL), NULL, 16);
fm = (int)*(Tcl_GetStringFromObj (objv[2], NULL));
- numregs = (gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch));
+ numregs = (gdbarch_num_regs (get_current_arch ())
+ + gdbarch_num_pseudo_regs (get_current_arch ()));
if (regno >= numregs)
{
gdbtk_set_result (interp, "Register number %d too large", regno);
return TCL_ERROR;
}
- for (group = reggroup_next (current_gdbarch, NULL);
+ for (group = reggroup_next (get_current_arch (), NULL);
group != NULL;
- group = reggroup_next (current_gdbarch, group))
+ group = reggroup_next (get_current_arch (), group))
{
if (reggroup_type (group) == USER_REGGROUP)
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewStringObj (reggroup_name (group), -1));
return TCL_ERROR;
}
- for (group = reggroup_next (current_gdbarch, NULL);
+ for (group = reggroup_next (get_current_arch (), NULL);
group != NULL;
- group = reggroup_next (current_gdbarch, group))
+ group = reggroup_next (get_current_arch (), group))
{
if (strcmp (groupname, reggroup_name (group)) == 0)
break;
if (group == NULL)
return TCL_ERROR;
- num = (gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch));
+ num = (gdbarch_num_regs (get_current_arch ())
+ + gdbarch_num_pseudo_regs (get_current_arch ()));
for (regnum = 0; regnum < num; regnum++)
{
- if (gdbarch_register_reggroup_p (current_gdbarch, regnum, group))
+ if (gdbarch_register_reggroup_p (get_current_arch (), regnum, group))
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj (regnum));
}
return TCL_OK;
#include "block.h"
#include "dictionary.h"
#include "varobj.h"
+#include "arch-utils.h"
#include <tcl.h>
#include "gdbtk.h"
char *addr;
Tcl_Obj *elt = Tcl_NewListObj (0, NULL);
- addr = xstrprintf ("0x%s", paddr_nz (BLOCK_START (block)));
+ addr = xstrprintf ("%s", paddress (get_current_arch (),
+ BLOCK_START (block)));
Tcl_ListObjAppendElement (interp, elt,
Tcl_NewStringObj (addr, -1));
free(addr);
- addr = xstrprintf ("0x%s", paddr_nz (BLOCK_END (block)));
+ addr = xstrprintf ("%s", paddress (get_current_arch (),
+ BLOCK_END (block)));
Tcl_ListObjAppendElement (interp, elt,
Tcl_NewStringObj (addr, -1));
Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, elt);
{
struct block *block;
block = get_frame_block (get_selected_frame (NULL), 0);
- start = xstrprintf ("0x%s", paddr_nz (BLOCK_START (block)));
- end = xstrprintf ("0x%s", paddr_nz (BLOCK_END (block)));
+ start = xstrprintf ("%s", paddress (get_current_arch (),
+ BLOCK_START (block)));
+ end = xstrprintf ("%s", paddress (get_current_arch (),
+ BLOCK_END (block)));
}
Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
else
/* FIXME: cagney/2002-11-19: This should be using get_frame_id()
to identify the frame and *NOT* get_frame_base(). */
- frame = xstrprintf ("0x%s",
- paddr_nz (get_frame_base (get_selected_frame (NULL))));
+ frame = xstrprintf ("%s",paddress (get_current_arch (),
+ get_frame_base (get_selected_frame (NULL))));
Tcl_SetStringObj (result_ptr->obj_ptr, frame, -1);