2011-01-11 Michael Snyder <msnyder@vmware.com>

* ui-file.c: Comment cleanup, mostly periods and spaces.
	* ui-file.h: Ditto.
	* ui-out.c: Ditto.
	* ui-out.h: Ditto.
	* utils.c: Ditto.
	* v850-tdep.c: Ditto.
	* valarith.c: Ditto.
	* valops.c: Ditto.
	* valprint.c: Ditto.
	* valprint.h: Ditto.
	* value.c: Ditto.
	* value.h: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	* vax-tdep.c: Ditto.
	* vec.c: Ditto.
	* vec.h: Ditto.
	* version.h: Ditto.
	* windows-nat.c: Ditto.
	* windows-tdep.c: Ditto.
	* xcoffread.c: Ditto.
	* xcoffsolib.c: Ditto.
	* xml-support.c: Ditto.
	* xstormy16-tdep.c: Ditto.
	* xtensa-tdep.c: Ditto.
	* xtensa-tdep.h: Ditto.
This commit is contained in:
Michael Snyder 2011-01-12 01:23:29 +00:00
parent d2a0f03272
commit 581e13c188
27 changed files with 811 additions and 726 deletions

View file

@ -61,6 +61,35 @@
* trad-frame.h: Ditto. * trad-frame.h: Ditto.
* typeprint.c: Ditto. * typeprint.c: Ditto.
2011-01-11 Michael Snyder <msnyder@vmware.com>
* ui-file.c: Comment cleanup, mostly periods and spaces.
* ui-file.h: Ditto.
* ui-out.c: Ditto.
* ui-out.h: Ditto.
* utils.c: Ditto.
* v850-tdep.c: Ditto.
* valarith.c: Ditto.
* valops.c: Ditto.
* valprint.c: Ditto.
* valprint.h: Ditto.
* value.c: Ditto.
* value.h: Ditto.
* varobj.c: Ditto.
* varobj.h: Ditto.
* vax-tdep.c: Ditto.
* vec.c: Ditto.
* vec.h: Ditto.
* version.h: Ditto.
* windows-nat.c: Ditto.
* windows-tdep.c: Ditto.
* xcoffread.c: Ditto.
* xcoffsolib.c: Ditto.
* xml-support.c: Ditto.
* xstormy16-tdep.c: Ditto.
* xtensa-tdep.c: Ditto.
* xtensa-tdep.h: Ditto.
2011-01-11 Thiago Jung Bauermann <bauerman@br.ibm.com> 2011-01-11 Thiago Jung Bauermann <bauerman@br.ibm.com>
* breakpoint.c (resources_needed_watchpoint): Fix indentation. * breakpoint.c (resources_needed_watchpoint): Fix indentation.

View file

@ -83,7 +83,7 @@ extern int ui_file_isatty (struct ui_file *);
extern void ui_file_write (struct ui_file *file, const char *buf, extern void ui_file_write (struct ui_file *file, const char *buf,
long length_buf); long length_buf);
/* NOTE: copies left to right */ /* NOTE: copies left to right. */
extern void ui_file_put (struct ui_file *src, extern void ui_file_put (struct ui_file *src,
ui_file_put_method_ftype *write, void *dest); ui_file_put_method_ftype *write, void *dest);

View file

@ -48,7 +48,7 @@ enum { MAX_UI_OUT_LEVELS = 8 };
struct ui_out_level struct ui_out_level
{ {
/* Count each field; the first element is for non-list fields */ /* Count each field; the first element is for non-list fields. */
int field_count; int field_count;
/* The type of this level. */ /* The type of this level. */
enum ui_out_type type; enum ui_out_type type;
@ -93,12 +93,12 @@ struct ui_out_table
/* The ui_out structure */ /* The ui_out structure */
/* Any change here requires a corresponding one in the initialization /* Any change here requires a corresponding one in the initialization
of the default uiout, which is statically initialized */ of the default uiout, which is statically initialized. */
struct ui_out struct ui_out
{ {
int flags; int flags;
/* specific implementation of ui-out */ /* Specific implementation of ui-out. */
struct ui_out_impl *impl; struct ui_out_impl *impl;
void *data; void *data;
@ -148,7 +148,7 @@ pop_level (struct ui_out *uiout,
} }
/* These are the default implementation functions */ /* These are the default implementation functions. */
static void default_table_begin (struct ui_out *uiout, int nbrofcols, static void default_table_begin (struct ui_out *uiout, int nbrofcols,
int nr_rows, const char *tblid); int nr_rows, const char *tblid);
@ -187,7 +187,7 @@ static void default_message (struct ui_out *uiout, int verbosity,
static void default_wrap_hint (struct ui_out *uiout, char *identstring); static void default_wrap_hint (struct ui_out *uiout, char *identstring);
static void default_flush (struct ui_out *uiout); static void default_flush (struct ui_out *uiout);
/* This is the default ui-out implementation functions vector */ /* This is the default ui-out implementation functions vector. */
struct ui_out_impl default_ui_out_impl = struct ui_out_impl default_ui_out_impl =
{ {
@ -220,11 +220,11 @@ struct ui_out def_uiout =
/* Pointer to current ui_out */ /* Pointer to current ui_out */
/* FIXME: This should not be a global, but something passed down from main.c /* FIXME: This should not be a global, but something passed down from main.c
or top.c */ or top.c. */
struct ui_out *uiout = &def_uiout; struct ui_out *uiout = &def_uiout;
/* These are the interfaces to implementation functions */ /* These are the interfaces to implementation functions. */
static void uo_table_begin (struct ui_out *uiout, int nbrofcols, static void uo_table_begin (struct ui_out *uiout, int nbrofcols,
int nr_rows, const char *tblid); int nr_rows, const char *tblid);
@ -270,7 +270,7 @@ static void verify_field (struct ui_out *uiout, int *fldno, int *width,
/* exported functions (ui_out API) */ /* exported functions (ui_out API) */
/* Mark beginning of a table */ /* Mark beginning of a table. */
static void static void
ui_out_table_begin (struct ui_out *uiout, int nbrofcols, ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
@ -526,7 +526,7 @@ ui_out_field_stream (struct ui_out *uiout,
do_cleanups (old_cleanup); do_cleanups (old_cleanup);
} }
/* used to ommit a field */ /* Used to omit a field. */
void void
ui_out_field_skip (struct ui_out *uiout, ui_out_field_skip (struct ui_out *uiout,
@ -566,7 +566,7 @@ ui_out_field_fmt (struct ui_out *uiout,
int width; int width;
int align; int align;
/* will not align, but has to call anyway */ /* Will not align, but has to call anyway. */
verify_field (uiout, &fldno, &width, &align); verify_field (uiout, &fldno, &width, &align);
va_start (args, format); va_start (args, format);
@ -649,7 +649,7 @@ ui_out_redirect (struct ui_out *uiout, struct ui_file *outstream)
return uo_redirect (uiout, outstream); return uo_redirect (uiout, outstream);
} }
/* set the flags specified by the mask given */ /* Set the flags specified by the mask given. */
int int
ui_out_set_flags (struct ui_out *uiout, int mask) ui_out_set_flags (struct ui_out *uiout, int mask)
{ {
@ -659,7 +659,7 @@ ui_out_set_flags (struct ui_out *uiout, int mask)
return oldflags; return oldflags;
} }
/* clear the flags specified by the mask given */ /* Clear the flags specified by the mask given. */
int int
ui_out_clear_flags (struct ui_out *uiout, int mask) ui_out_clear_flags (struct ui_out *uiout, int mask)
{ {
@ -669,20 +669,20 @@ ui_out_clear_flags (struct ui_out *uiout, int mask)
return oldflags; return oldflags;
} }
/* test the flags against the mask given */ /* Test the flags against the mask given. */
int int
ui_out_test_flags (struct ui_out *uiout, int mask) ui_out_test_flags (struct ui_out *uiout, int mask)
{ {
return (uiout->flags & mask); return (uiout->flags & mask);
} }
/* obtain the current verbosity level (as stablished by the /* Obtain the current verbosity level (as stablished by the
'set verbositylevel' command */ 'set verbositylevel' command. */
int int
ui_out_get_verblvl (struct ui_out *uiout) ui_out_get_verblvl (struct ui_out *uiout)
{ {
/* FIXME: not implemented yet */ /* FIXME: not implemented yet. */
return 0; return 0;
} }
@ -747,7 +747,7 @@ ui_out_is_mi_like_p (struct ui_out *uiout)
return uiout->impl->is_mi_like_p; return uiout->impl->is_mi_like_p;
} }
/* default gdb-out hook functions */ /* Default gdb-out hook functions. */
static void static void
default_table_begin (struct ui_out *uiout, int nbrofcols, default_table_begin (struct ui_out *uiout, int nbrofcols,
@ -847,7 +847,7 @@ default_flush (struct ui_out *uiout)
{ {
} }
/* Interface to the implementation functions */ /* Interface to the implementation functions. */
void void
uo_table_begin (struct ui_out *uiout, int nbrofcols, uo_table_begin (struct ui_out *uiout, int nbrofcols,
@ -1001,7 +1001,7 @@ uo_redirect (struct ui_out *uiout, struct ui_file *outstream)
/* local functions */ /* local functions */
/* list of column headers manipulation routines */ /* List of column headers manipulation routines. */
static void static void
clear_header_list (struct ui_out *uiout) clear_header_list (struct ui_out *uiout)
@ -1126,14 +1126,14 @@ specified after table_body and inside a list."));
} }
/* access to ui_out format private members */ /* Access to ui_out format private members. */
void void
ui_out_get_field_separator (struct ui_out *uiout) ui_out_get_field_separator (struct ui_out *uiout)
{ {
} }
/* Access to ui-out members data */ /* Access to ui-out members data. */
void * void *
ui_out_data (struct ui_out *uiout) ui_out_data (struct ui_out *uiout)
@ -1141,7 +1141,7 @@ ui_out_data (struct ui_out *uiout)
return uiout->data; return uiout->data;
} }
/* initalize private members at startup */ /* Initalize private members at startup. */
struct ui_out * struct ui_out *
ui_out_new (struct ui_out_impl *impl, void *data, ui_out_new (struct ui_out_impl *impl, void *data,
@ -1162,7 +1162,7 @@ ui_out_new (struct ui_out_impl *impl, void *data,
return uiout; return uiout;
} }
/* standard gdb initialization hook */ /* Standard gdb initialization hook. */
void void
_initialize_ui_out (void) _initialize_ui_out (void)

View file

@ -32,7 +32,7 @@ struct ui_file;
/* the current ui_out */ /* the current ui_out */
/* FIXME: This should not be a global but something passed down from main.c /* FIXME: This should not be a global but something passed down from main.c
or top.c */ or top.c. */
extern struct ui_out *uiout; extern struct ui_out *uiout;
/* alignment enum */ /* alignment enum */
@ -189,7 +189,7 @@ extern int ui_out_is_mi_like_p (struct ui_out *uiout);
/* From here on we have things that are only needed by implementation /* From here on we have things that are only needed by implementation
routines and main.c. We should pehaps have a separate file for that, routines and main.c. We should pehaps have a separate file for that,
like a ui-out-impl.h file */ like a ui-out-impl.h file. */
/* User Interface Output Implementation Function Table */ /* User Interface Output Implementation Function Table */
@ -240,7 +240,7 @@ typedef int (redirect_ftype) (struct ui_out * uiout,
/* ui-out-impl */ /* ui-out-impl */
/* IMPORTANT: If you change this structure, make sure to change the default /* IMPORTANT: If you change this structure, make sure to change the default
initialization in ui-out.c */ initialization in ui-out.c. */
struct ui_out_impl struct ui_out_impl
{ {

View file

@ -895,7 +895,7 @@ add_intermediate_continuation (struct thread_info *thread,
before we have a chance of exhausting those that were already before we have a chance of exhausting those that were already
there. We need to then save the beginning of the list in a pointer there. We need to then save the beginning of the list in a pointer
and do the continuations from there on, instead of using the and do the continuations from there on, instead of using the
global beginning of list as our iteration pointer.*/ global beginning of list as our iteration pointer. */
static int static int
do_all_intermediate_continuations_thread_callback (struct thread_info *thread, do_all_intermediate_continuations_thread_callback (struct thread_info *thread,
void *data) void *data)
@ -963,7 +963,7 @@ vwarning (const char *string, va_list args)
else else
{ {
target_terminal_ours (); target_terminal_ours ();
wrap_here (""); /* Force out any buffered output */ wrap_here (""); /* Force out any buffered output. */
gdb_flush (gdb_stdout); gdb_flush (gdb_stdout);
if (warning_pre_print) if (warning_pre_print)
fputs_unfiltered (warning_pre_print, gdb_stderr); fputs_unfiltered (warning_pre_print, gdb_stderr);
@ -1721,7 +1721,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
while (1) while (1)
{ {
wrap_here (""); /* Flush any buffered output */ wrap_here (""); /* Flush any buffered output. */
gdb_flush (gdb_stdout); gdb_flush (gdb_stdout);
if (annotation_level > 1) if (annotation_level > 1)
@ -1763,7 +1763,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
retval = def_value; retval = def_value;
break; break;
} }
/* Eat rest of input line, to EOF or newline */ /* Eat rest of input line, to EOF or newline. */
if (answer != '\n') if (answer != '\n')
do do
{ {
@ -1897,7 +1897,7 @@ host_char_to_target (struct gdbarch *gdbarch, int c, int *target_c)
int int
parse_escape (struct gdbarch *gdbarch, char **string_ptr) parse_escape (struct gdbarch *gdbarch, char **string_ptr)
{ {
int target_char = -2; /* initialize to avoid GCC warnings */ int target_char = -2; /* Initialize to avoid GCC warnings. */
int c = *(*string_ptr)++; int c = *(*string_ptr)++;
switch (c) switch (c)
@ -2384,7 +2384,7 @@ wrap_here (char *indent)
right or left justified in the column. Never prints right or left justified in the column. Never prints
trailing spaces. String should never be longer than trailing spaces. String should never be longer than
width. FIXME: this could be useful for the EXAMINE width. FIXME: this could be useful for the EXAMINE
command, which currently doesn't tabulate very well */ command, which currently doesn't tabulate very well. */
void void
puts_filtered_tabular (char *string, int width, int right) puts_filtered_tabular (char *string, int width, int right)
@ -2425,7 +2425,7 @@ puts_filtered_tabular (char *string, int width, int right)
/* Ensure that whatever gets printed next, using the filtered output /* Ensure that whatever gets printed next, using the filtered output
commands, starts at the beginning of the line. I.E. if there is commands, starts at the beginning of the line. I.e. if there is
any pending output for the current line, flush it and start a new any pending output for the current line, flush it and start a new
line. Otherwise do nothing. */ line. Otherwise do nothing. */
@ -2525,12 +2525,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
if (lines_printed >= lines_per_page - 1) if (lines_printed >= lines_per_page - 1)
prompt_for_continue (); prompt_for_continue ();
/* Now output indentation and wrapped string */ /* Now output indentation and wrapped string. */
if (wrap_column) if (wrap_column)
{ {
fputs_unfiltered (wrap_indent, stream); fputs_unfiltered (wrap_indent, stream);
*wrap_pointer = '\0'; /* Null-terminate saved stuff */ *wrap_pointer = '\0'; /* Null-terminate saved stuff, */
fputs_unfiltered (wrap_buffer, stream); /* and eject it */ fputs_unfiltered (wrap_buffer, stream); /* and eject it. */
/* FIXME, this strlen is what prevents wrap_indent from /* FIXME, this strlen is what prevents wrap_indent from
containing tabs. However, if we recurse to print it containing tabs. However, if we recurse to print it
and count its chars, we risk trouble if wrap_indent is and count its chars, we risk trouble if wrap_indent is
@ -3153,8 +3153,8 @@ When set, debugging messages will be marked with seconds and microseconds."),
#ifdef SIGWINCH_HANDLER_BODY #ifdef SIGWINCH_HANDLER_BODY
SIGWINCH_HANDLER_BODY SIGWINCH_HANDLER_BODY
#endif #endif
/* print routines to handle variable size regs, etc. */ /* Print routines to handle variable size regs, etc. */
/* temporary storage using circular buffer */ /* Temporary storage using circular buffer. */
#define NUMCELLS 16 #define NUMCELLS 16
#define CELLSIZE 50 #define CELLSIZE 50
static char * static char *
@ -3601,7 +3601,7 @@ xfullpath (const char *filename)
dir_name = alloca ((size_t) (base_name - filename + 2)); dir_name = alloca ((size_t) (base_name - filename + 2));
/* Allocate enough space to store the dir_name + plus one extra /* Allocate enough space to store the dir_name + plus one extra
character sometimes needed under Windows (see below), and character sometimes needed under Windows (see below), and
then the closing \000 character */ then the closing \000 character. */
strncpy (dir_name, filename, base_name - filename); strncpy (dir_name, filename, base_name - filename);
dir_name[base_name - filename] = '\000'; dir_name[base_name - filename] = '\000';

View file

@ -250,8 +250,9 @@ v850_use_struct_convention (struct type *type)
return 0; return 0;
} }
/* The value is a union which contains at least one field which would be /* The value is a union which contains at least one field which
returned in registers according to these rules -> returned in register. */ would be returned in registers according to these rules ->
returned in register. */
if (TYPE_CODE (type) == TYPE_CODE_UNION) if (TYPE_CODE (type) == TYPE_CODE_UNION)
{ {
for (i = 0; i < TYPE_NFIELDS (type); ++i) for (i = 0; i < TYPE_NFIELDS (type); ++i)
@ -558,7 +559,7 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
|| (insn & 0xffe0) == 0x0060 /* jmp */ || (insn & 0xffe0) == 0x0060 /* jmp */
|| (insn & 0x0780) == 0x0580) /* branch */ || (insn & 0x0780) == 0x0580) /* branch */
{ {
break; /* Ran into end of prologue */ break; /* Ran into end of prologue. */
} }
else if ((insn & 0xffe0) == ((E_SP_REGNUM << 11) | 0x0240)) else if ((insn & 0xffe0) == ((E_SP_REGNUM << 11) | 0x0240))
@ -628,7 +629,7 @@ v850_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
CORE_ADDR func_addr, func_end; CORE_ADDR func_addr, func_end;
/* See what the symbol table says */ /* See what the symbol table says. */
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end)) if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{ {
@ -644,7 +645,8 @@ v850_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return pc; return pc;
} }
/* We can't find the start of this function, so there's nothing we can do. */ /* We can't find the start of this function, so there's nothing we
can do. */
return pc; return pc;
} }

View file

@ -47,8 +47,7 @@ void _initialize_valarith (void);
If the pointer type is void *, then return 1. If the pointer type is void *, then return 1.
If the target type is incomplete, then error out. If the target type is incomplete, then error out.
This isn't a general purpose function, but just a This isn't a general purpose function, but just a
helper for value_ptradd. helper for value_ptradd. */
*/
static LONGEST static LONGEST
find_size_for_pointer_math (struct type *ptr_type) find_size_for_pointer_math (struct type *ptr_type)
@ -343,7 +342,7 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
int i; int i;
arg_types = (struct type **) alloca (nargs * (sizeof (struct type *))); arg_types = (struct type **) alloca (nargs * (sizeof (struct type *)));
/* Prepare list of argument types for overload resolution */ /* Prepare list of argument types for overload resolution. */
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
arg_types[i] = value_type (args[i]); arg_types[i] = value_type (args[i]);
@ -417,7 +416,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
argvec[2] = arg2; argvec[2] = arg2;
argvec[3] = 0; argvec[3] = 0;
/* make the right function name up */ /* Make the right function name up. */
strcpy (tstr, "operator__"); strcpy (tstr, "operator__");
ptr = tstr + 8; ptr = tstr + 8;
switch (op) switch (op)
@ -582,7 +581,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
nargs = 1; nargs = 1;
/* make the right function name up */ /* Make the right function name up. */
strcpy (tstr, "operator__"); strcpy (tstr, "operator__");
ptr = tstr + 8; ptr = tstr + 8;
strcpy (mangle_tstr, "__"); strcpy (mangle_tstr, "__");
@ -675,8 +674,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
values of length 1. values of length 1.
(3) Character values are also allowed and are treated as character (3) Character values are also allowed and are treated as character
string values of length 1. string values of length 1. */
*/
struct value * struct value *
value_concat (struct value *arg1, struct value *arg2) value_concat (struct value *arg1, struct value *arg2)
@ -815,6 +813,7 @@ value_concat (struct value *arg1, struct value *arg2)
/* Integer exponentiation: V1**V2, where both arguments are /* Integer exponentiation: V1**V2, where both arguments are
integers. Requires V1 != 0 if V2 < 0. Returns 1 for 0 ** 0. */ integers. Requires V1 != 0 if V2 < 0. Returns 1 for 0 ** 0. */
static LONGEST static LONGEST
integer_pow (LONGEST v1, LONGEST v2) integer_pow (LONGEST v1, LONGEST v2)
{ {
@ -827,7 +826,7 @@ integer_pow (LONGEST v1, LONGEST v2)
} }
else else
{ {
/* The Russian Peasant's Algorithm */ /* The Russian Peasant's Algorithm. */
LONGEST v; LONGEST v;
v = 1; v = 1;
@ -845,6 +844,7 @@ integer_pow (LONGEST v1, LONGEST v2)
/* Integer exponentiation: V1**V2, where both arguments are /* Integer exponentiation: V1**V2, where both arguments are
integers. Requires V1 != 0 if V2 < 0. Returns 1 for 0 ** 0. */ integers. Requires V1 != 0 if V2 < 0. Returns 1 for 0 ** 0. */
static ULONGEST static ULONGEST
uinteger_pow (ULONGEST v1, LONGEST v2) uinteger_pow (ULONGEST v1, LONGEST v2)
{ {
@ -857,7 +857,7 @@ uinteger_pow (ULONGEST v1, LONGEST v2)
} }
else else
{ {
/* The Russian Peasant's Algorithm */ /* The Russian Peasant's Algorithm. */
ULONGEST v; ULONGEST v;
v = 1; v = 1;
@ -1511,7 +1511,7 @@ value_logical_not (struct value *arg1)
} }
/* Perform a comparison on two string values (whose content are not /* Perform a comparison on two string values (whose content are not
necessarily null terminated) based on their length */ necessarily null terminated) based on their length. */
static int static int
value_strcmp (struct value *arg1, struct value *arg2) value_strcmp (struct value *arg1, struct value *arg2)
@ -1617,7 +1617,7 @@ value_equal (struct value *arg1, struct value *arg2)
else else
{ {
error (_("Invalid type combination in equality test.")); error (_("Invalid type combination in equality test."));
return 0; /* For lint -- never reached */ return 0; /* For lint -- never reached. */
} }
} }
@ -1732,7 +1732,7 @@ value_pos (struct value *arg1)
else else
{ {
error (_("Argument to positive operation not a number.")); error (_("Argument to positive operation not a number."));
return 0; /* For lint -- never reached */ return 0; /* For lint -- never reached. */
} }
} }
@ -1748,7 +1748,7 @@ value_neg (struct value *arg1)
{ {
struct value *val = allocate_value (type); struct value *val = allocate_value (type);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
gdb_byte decbytes[16]; /* a decfloat is at most 128 bits long */ gdb_byte decbytes[16]; /* a decfloat is at most 128 bits long. */
memcpy (decbytes, value_contents (arg1), len); memcpy (decbytes, value_contents (arg1), len);
@ -1787,7 +1787,7 @@ value_neg (struct value *arg1)
else else
{ {
error (_("Argument to negate operation not a number.")); error (_("Argument to negate operation not a number."));
return 0; /* For lint -- never reached */ return 0; /* For lint -- never reached. */
} }
} }

View file

@ -1528,8 +1528,7 @@ value_coerce_to_target (struct value *val)
other than array subscripting, where the caller would get back a other than array subscripting, where the caller would get back a
value that had an address somewhere before the actual first element value that had an address somewhere before the actual first element
of the array, and the information about the lower bound would be of the array, and the information about the lower bound would be
lost because of the coercion to pointer type. lost because of the coercion to pointer type. */
*/
struct value * struct value *
value_coerce_array (struct value *arg1) value_coerce_array (struct value *arg1)
@ -1593,7 +1592,7 @@ value_addr (struct value *arg1)
if (VALUE_LVAL (arg1) != lval_memory) if (VALUE_LVAL (arg1) != lval_memory)
error (_("Attempt to take address of value not located in memory.")); error (_("Attempt to take address of value not located in memory."));
/* Get target memory address */ /* Get target memory address. */
arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)), arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
(value_address (arg1) (value_address (arg1)
+ value_embedded_offset (arg1))); + value_embedded_offset (arg1)));
@ -1667,7 +1666,7 @@ value_ind (struct value *arg1)
arg2 = value_at_lazy (enc_type, arg2 = value_at_lazy (enc_type,
find_function_addr (arg1, NULL)); find_function_addr (arg1, NULL));
else else
/* Retrieve the enclosing object pointed to */ /* Retrieve the enclosing object pointed to. */
arg2 = value_at_lazy (enc_type, arg2 = value_at_lazy (enc_type,
(value_as_address (arg1) (value_as_address (arg1)
- value_pointed_to_offset (arg1))); - value_pointed_to_offset (arg1)));
@ -2073,7 +2072,7 @@ search_struct_method (const char *name, struct value **arg1p,
{ {
char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i); char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
/* FIXME! May need to check for ARM demangling here */ /* FIXME! May need to check for ARM demangling here. */
if (strncmp (t_field_name, "__", 2) == 0 || if (strncmp (t_field_name, "__", 2) == 0 ||
strncmp (t_field_name, "op", 2) == 0 || strncmp (t_field_name, "op", 2) == 0 ||
strncmp (t_field_name, "type", 4) == 0) strncmp (t_field_name, "type", 4) == 0)
@ -2286,8 +2285,7 @@ value_struct_elt (struct value **argp, struct value **args,
NUM_FNS is the number of overloaded instances. NUM_FNS is the number of overloaded instances.
BASETYPE is set to the actual type of the subobject where the BASETYPE is set to the actual type of the subobject where the
method is found. method is found.
BOFFSET is the offset of the base subobject where the method is found. BOFFSET is the offset of the base subobject where the method is found. */
*/
static struct fn_field * static struct fn_field *
find_method_list (struct value **argp, const char *method, find_method_list (struct value **argp, const char *method,
@ -2358,8 +2356,7 @@ find_method_list (struct value **argp, const char *method,
NUM_FNS is the number of overloaded instances. NUM_FNS is the number of overloaded instances.
BASETYPE is set to the type of the base subobject that defines the BASETYPE is set to the type of the base subobject that defines the
method. method.
BOFFSET is the offset of the base subobject which defines the method. BOFFSET is the offset of the base subobject which defines the method. */
*/
struct fn_field * struct fn_field *
value_find_oload_method_list (struct value **argp, const char *method, value_find_oload_method_list (struct value **argp, const char *method,
@ -2429,8 +2426,7 @@ value_find_oload_method_list (struct value **argp, const char *method,
Note: This function does *not* check the value of Note: This function does *not* check the value of
overload_resolution. Caller must check it to see whether overload overload_resolution. Caller must check it to see whether overload
resolution is permitted. resolution is permitted. */
*/
int int
find_overload_match (struct type **arg_types, int nargs, find_overload_match (struct type **arg_types, int nargs,
@ -3111,7 +3107,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
++start; ++start;
} }
/* Now compare parameters */ /* Now compare parameters. */
/* Special case: a method taking void. T1 will contain no /* Special case: a method taking void. T1 will contain no
non-artificial fields, and T2 will contain TYPE_CODE_VOID. */ non-artificial fields, and T2 will contain TYPE_CODE_VOID. */
@ -3464,7 +3460,7 @@ value_full_object (struct value *argp,
return argp; return argp;
} }
/* Check if object is in memory */ /* Check if object is in memory. */
if (VALUE_LVAL (argp) != lval_memory) if (VALUE_LVAL (argp) != lval_memory)
{ {
warning (_("Couldn't retrieve complete object of RTTI " warning (_("Couldn't retrieve complete object of RTTI "

View file

@ -570,10 +570,10 @@ print_longest (struct ui_file *stream, int format, int use_c_format,
int int
longest_to_int (LONGEST arg) longest_to_int (LONGEST arg)
{ {
/* Let the compiler do the work */ /* Let the compiler do the work. */
int rtnval = (int) arg; int rtnval = (int) arg;
/* Check for overflows or underflows */ /* Check for overflows or underflows. */
if (sizeof (LONGEST) > sizeof (int)) if (sizeof (LONGEST) > sizeof (int))
{ {
if (rtnval != arg) if (rtnval != arg)
@ -685,8 +685,8 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
int b; int b;
/* Declared "int" so it will be signed. /* Declared "int" so it will be signed.
* This ensures that right shift will shift in zeros. This ensures that right shift will shift in zeros. */
*/
const int mask = 0x080; const int mask = 0x080;
/* FIXME: We should be not printing leading zeroes in most cases. */ /* FIXME: We should be not printing leading zeroes in most cases. */
@ -698,8 +698,8 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
p++) p++)
{ {
/* Every byte has 8 binary characters; peel off /* Every byte has 8 binary characters; peel off
* and print from the MSB end. and print from the MSB end. */
*/
for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++) for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
{ {
if (*p & (mask >> i)) if (*p & (mask >> i))
@ -731,8 +731,8 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
} }
/* VALADDR points to an integer of LEN bytes. /* VALADDR points to an integer of LEN bytes.
* Print it in octal on stream or format it in buf. Print it in octal on stream or format it in buf. */
*/
void void
print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr, print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
unsigned len, enum bfd_endian byte_order) unsigned len, enum bfd_endian byte_order)
@ -772,8 +772,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
#define LOW_TWO 0007 #define LOW_TWO 0007
/* For 32 we start in cycle 2, with two bits and one bit carry; /* For 32 we start in cycle 2, with two bits and one bit carry;
* for 64 in cycle in cycle 1, with one bit and a two bit carry. for 64 in cycle in cycle 1, with one bit and a two bit carry. */
*/
cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL; cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL;
carry = 0; carry = 0;
@ -787,8 +787,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
switch (cycle) switch (cycle)
{ {
case 0: case 0:
/* No carry in, carry out two bits. /* No carry in, carry out two bits. */
*/
octa1 = (HIGH_ZERO & *p) >> 5; octa1 = (HIGH_ZERO & *p) >> 5;
octa2 = (LOW_ZERO & *p) >> 2; octa2 = (LOW_ZERO & *p) >> 2;
carry = (CARRY_ZERO & *p); carry = (CARRY_ZERO & *p);
@ -797,8 +797,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
break; break;
case 1: case 1:
/* Carry in two bits, carry out one bit. /* Carry in two bits, carry out one bit. */
*/
octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7); octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7);
octa2 = (MID_ONE & *p) >> 4; octa2 = (MID_ONE & *p) >> 4;
octa3 = (LOW_ONE & *p) >> 1; octa3 = (LOW_ONE & *p) >> 1;
@ -809,8 +809,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
break; break;
case 2: case 2:
/* Carry in one bit, no carry out. /* Carry in one bit, no carry out. */
*/
octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6); octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
octa2 = (MID_TWO & *p) >> 3; octa2 = (MID_TWO & *p) >> 3;
octa3 = (LOW_TWO & *p); octa3 = (LOW_TWO & *p);
@ -838,6 +838,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
{ {
case 0: case 0:
/* Carry out, no carry in */ /* Carry out, no carry in */
octa1 = (HIGH_ZERO & *p) >> 5; octa1 = (HIGH_ZERO & *p) >> 5;
octa2 = (LOW_ZERO & *p) >> 2; octa2 = (LOW_ZERO & *p) >> 2;
carry = (CARRY_ZERO & *p); carry = (CARRY_ZERO & *p);
@ -847,6 +848,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
case 1: case 1:
/* Carry in, carry out */ /* Carry in, carry out */
octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7); octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7);
octa2 = (MID_ONE & *p) >> 4; octa2 = (MID_ONE & *p) >> 4;
octa3 = (LOW_ONE & *p) >> 1; octa3 = (LOW_ONE & *p) >> 1;
@ -858,6 +860,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
case 2: case 2:
/* Carry in, no carry out */ /* Carry in, no carry out */
octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6); octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
octa2 = (MID_TWO & *p) >> 3; octa2 = (MID_TWO & *p) >> 3;
octa3 = (LOW_TWO & *p); octa3 = (LOW_TWO & *p);
@ -879,8 +882,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
} }
/* VALADDR points to an integer of LEN bytes. /* VALADDR points to an integer of LEN bytes.
* Print it in decimal on stream or format it in buf. Print it in decimal on stream or format it in buf. */
*/
void void
print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr, print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
unsigned len, enum bfd_endian byte_order) unsigned len, enum bfd_endian byte_order)
@ -901,8 +904,8 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
int flip; int flip;
/* Base-ten number is less than twice as many digits /* Base-ten number is less than twice as many digits
* as the base 16 number, which is 2 digits per byte. as the base 16 number, which is 2 digits per byte. */
*/
decimal_len = len * 2 * 2; decimal_len = len * 2 * 2;
digits = xmalloc (decimal_len); digits = xmalloc (decimal_len);
@ -947,15 +950,15 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
*/ */
if (flip == 0) if (flip == 0)
{ {
/* Take top nibble. /* Take top nibble. */
*/
digits[0] += HIGH_NIBBLE (*p); digits[0] += HIGH_NIBBLE (*p);
flip = 1; flip = 1;
} }
else else
{ {
/* Take low nibble and bump our pointer "p". /* Take low nibble and bump our pointer "p". */
*/
digits[0] += LOW_NIBBLE (*p); digits[0] += LOW_NIBBLE (*p);
if (byte_order == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
p++; p++;
@ -1001,8 +1004,8 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
} }
/* Ok, now "digits" is the decimal representation, with /* Ok, now "digits" is the decimal representation, with
* the "decimal_digits" actual digits. Print! the "decimal_digits" actual digits. Print! */
*/
for (i = decimal_digits - 1; i >= 0; i--) for (i = decimal_digits - 1; i >= 0; i--)
{ {
fprintf_filtered (stream, "%1d", digits[i]); fprintf_filtered (stream, "%1d", digits[i]);
@ -1102,8 +1105,7 @@ maybe_print_array_index (struct type *index_type, LONGEST index,
(FIXME?) Assumes array element separator is a comma, which is correct (FIXME?) Assumes array element separator is a comma, which is correct
for all languages currently handled. for all languages currently handled.
(FIXME?) Some languages have a notation for repeated array elements, (FIXME?) Some languages have a notation for repeated array elements,
perhaps we should try to use that notation when appropriate. perhaps we should try to use that notation when appropriate. */
*/
void void
val_print_array_elements (struct type *type, const gdb_byte *valaddr, val_print_array_elements (struct type *type, const gdb_byte *valaddr,
@ -1392,7 +1394,7 @@ val_print_string (struct type *elttype, const char *encoding,
{ {
int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */ int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
int errcode; /* Errno returned from bad reads. */ int errcode; /* Errno returned from bad reads. */
int found_nul; /* Non-zero if we found the nul char */ int found_nul; /* Non-zero if we found the nul char. */
unsigned int fetchlimit; /* Maximum number of chars to print. */ unsigned int fetchlimit; /* Maximum number of chars to print. */
int bytes_read; int bytes_read;
gdb_byte *buffer = NULL; /* Dynamically growable fetch buffer. */ gdb_byte *buffer = NULL; /* Dynamically growable fetch buffer. */
@ -1638,7 +1640,7 @@ _initialize_valprint (void)
_("Generic command for setting how things print."), _("Generic command for setting how things print."),
&setprintlist, "set print ", 0, &setlist); &setprintlist, "set print ", 0, &setlist);
add_alias_cmd ("p", "print", no_class, 1, &setlist); add_alias_cmd ("p", "print", no_class, 1, &setlist);
/* prefer set print to set prompt */ /* Prefer set print to set prompt. */
add_alias_cmd ("pr", "print", no_class, 1, &setlist); add_alias_cmd ("pr", "print", no_class, 1, &setlist);
add_prefix_cmd ("print", no_class, show_print, add_prefix_cmd ("print", no_class, show_print,

View file

@ -239,7 +239,7 @@ struct value_history_chunk
static struct value_history_chunk *value_history_chain; static struct value_history_chunk *value_history_chain;
static int value_history_count; /* Abs number of last entry stored */ static int value_history_count; /* Abs number of last entry stored. */
/* List of all value objects currently allocated /* List of all value objects currently allocated
@ -1937,13 +1937,13 @@ value_static_field (struct type *type, int fieldno)
case FIELD_LOC_KIND_PHYSNAME: case FIELD_LOC_KIND_PHYSNAME:
{ {
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno); char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
/*TYPE_FIELD_NAME (type, fieldno);*/ /* TYPE_FIELD_NAME (type, fieldno); */
struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0); struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
if (sym == NULL) if (sym == NULL)
{ {
/* With some compilers, e.g. HP aCC, static data members are /* With some compilers, e.g. HP aCC, static data members are
reported as non-debuggable symbols */ reported as non-debuggable symbols. */
struct minimal_symbol *msym = lookup_minimal_symbol (phys_name, struct minimal_symbol *msym = lookup_minimal_symbol (phys_name,
NULL, NULL); NULL, NULL);
@ -2098,8 +2098,7 @@ value_field (struct value *arg1, int fieldno)
J is an index into F which provides the desired method. J is an index into F which provides the desired method.
We only use the symbol for its address, so be happy with either a We only use the symbol for its address, so be happy with either a
full symbol or a minimal symbol. full symbol or a minimal symbol. */
*/
struct value * struct value *
value_fn_field (struct value **arg1p, struct fn_field *f, value_fn_field (struct value **arg1p, struct fn_field *f,
@ -2149,8 +2148,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
value_addr (*arg1p))); value_addr (*arg1p)));
/* Move the `this' pointer according to the offset. /* Move the `this' pointer according to the offset.
VALUE_OFFSET (*arg1p) += offset; VALUE_OFFSET (*arg1p) += offset; */
*/
} }
return v; return v;

View file

@ -53,11 +53,11 @@ show_varobjdebug (struct ui_file *file, int from_tty,
fprintf_filtered (file, _("Varobj debugging is %s.\n"), value); fprintf_filtered (file, _("Varobj debugging is %s.\n"), value);
} }
/* String representations of gdb's format codes */ /* String representations of gdb's format codes. */
char *varobj_format_string[] = char *varobj_format_string[] =
{ "natural", "binary", "decimal", "hexadecimal", "octal" }; { "natural", "binary", "decimal", "hexadecimal", "octal" };
/* String representations of gdb's known languages */ /* String representations of gdb's known languages. */
char *varobj_language_string[] = { "unknown", "C", "C++", "Java" }; char *varobj_language_string[] = { "unknown", "C", "C++", "Java" };
/* True if we want to allow Python-based pretty-printing. */ /* True if we want to allow Python-based pretty-printing. */
@ -79,7 +79,7 @@ struct varobj_root
/* Alloc'd expression for this parent. */ /* Alloc'd expression for this parent. */
struct expression *exp; struct expression *exp;
/* Block for which this expression is valid */ /* Block for which this expression is valid. */
struct block *valid_block; struct block *valid_block;
/* The frame for this expression. This field is set iff valid_block is /* The frame for this expression. This field is set iff valid_block is
@ -95,14 +95,14 @@ struct varobj_root
/* If 1, the -var-update always recomputes the value in the /* If 1, the -var-update always recomputes the value in the
current thread and frame. Otherwise, variable object is current thread and frame. Otherwise, variable object is
always updated in the specific scope/thread/frame */ always updated in the specific scope/thread/frame. */
int floating; int floating;
/* Flag that indicates validity: set to 0 when this varobj_root refers /* Flag that indicates validity: set to 0 when this varobj_root refers
to symbols that do not exist anymore. */ to symbols that do not exist anymore. */
int is_valid; int is_valid;
/* Language info for this variable and its children */ /* Language info for this variable and its children. */
struct language_specific *lang; struct language_specific *lang;
/* The varobj for this root node. */ /* The varobj for this root node. */
@ -118,10 +118,10 @@ struct varobj_root
struct varobj struct varobj
{ {
/* Alloc'd name of the variable for this object.. If this variable is a /* Alloc'd name of the variable for this object. If this variable is a
child, then this name will be the child's source name. child, then this name will be the child's source name.
(bar, not foo.bar) */ (bar, not foo.bar). */
/* NOTE: This is the "expression" */ /* NOTE: This is the "expression". */
char *name; char *name;
/* Alloc'd expression for this child. Can be used to create a /* Alloc'd expression for this child. Can be used to create a
@ -132,7 +132,7 @@ struct varobj
convenience when constructing this object's children. */ convenience when constructing this object's children. */
char *obj_name; char *obj_name;
/* Index of this variable in its parent or -1 */ /* Index of this variable in its parent or -1. */
int index; int index;
/* The type of this variable. This can be NULL /* The type of this variable. This can be NULL
@ -146,7 +146,7 @@ struct varobj
the value is either NULL, or not lazy. */ the value is either NULL, or not lazy. */
struct value *value; struct value *value;
/* The number of (immediate) children this variable has */ /* The number of (immediate) children this variable has. */
int num_children; int num_children;
/* If this object is a child, this points to its immediate parent. */ /* If this object is a child, this points to its immediate parent. */
@ -161,13 +161,14 @@ struct varobj
can avoid that. */ can avoid that. */
int children_requested; int children_requested;
/* Description of the root variable. Points to root variable for children. */ /* Description of the root variable. Points to root variable for
children. */
struct varobj_root *root; struct varobj_root *root;
/* The format of the output for this object */ /* The format of the output for this object. */
enum varobj_display_formats format; enum varobj_display_formats format;
/* Was this variable updated via a varobj_set_value operation */ /* Was this variable updated via a varobj_set_value operation. */
int updated; int updated;
/* Last print value. */ /* Last print value. */
@ -364,7 +365,7 @@ static char *java_value_of_variable (struct varobj *var,
struct language_specific struct language_specific
{ {
/* The language of this variable */ /* The language of this variable. */
enum varobj_languages language; enum varobj_languages language;
/* The number of children of PARENT. */ /* The number of children of PARENT. */
@ -396,7 +397,7 @@ struct language_specific
/* Array of known source language routines. */ /* Array of known source language routines. */
static struct language_specific languages[vlang_end] = { static struct language_specific languages[vlang_end] = {
/* Unknown (try treating as C */ /* Unknown (try treating as C). */
{ {
vlang_unknown, vlang_unknown,
c_number_of_children, c_number_of_children,
@ -445,7 +446,7 @@ static struct language_specific languages[vlang_end] = {
java_value_of_variable} java_value_of_variable}
}; };
/* A little convenience enum for dealing with C++/Java */ /* A little convenience enum for dealing with C++/Java. */
enum vsections enum vsections
{ {
v_public = 0, v_private, v_protected v_public = 0, v_private, v_protected
@ -453,17 +454,17 @@ enum vsections
/* Private data */ /* Private data */
/* Mappings of varobj_display_formats enums to gdb's format codes */ /* Mappings of varobj_display_formats enums to gdb's format codes. */
static int format_code[] = { 0, 't', 'd', 'x', 'o' }; static int format_code[] = { 0, 't', 'd', 'x', 'o' };
/* Header of the list of root variable objects */ /* Header of the list of root variable objects. */
static struct varobj_root *rootlist; static struct varobj_root *rootlist;
/* Prime number indicating the number of buckets in the hash table */ /* Prime number indicating the number of buckets in the hash table. */
/* A prime large enough to avoid too many colisions */ /* A prime large enough to avoid too many colisions. */
#define VAROBJ_TABLE_SIZE 227 #define VAROBJ_TABLE_SIZE 227
/* Pointer to the varobj hash table (built at run time) */ /* Pointer to the varobj hash table (built at run time). */
static struct vlist **varobj_table; static struct vlist **varobj_table;
/* Is the variable X one of our "fake" children? */ /* Is the variable X one of our "fake" children? */
@ -489,7 +490,7 @@ varobj_ensure_python_env (struct varobj *var)
} }
#endif #endif
/* Creates a varobj (not its children) */ /* Creates a varobj (not its children). */
/* Return the full FRAME which corresponds to the given CORE_ADDR /* Return the full FRAME which corresponds to the given CORE_ADDR
or NULL if no FRAME on the chain corresponds to CORE_ADDR. */ or NULL if no FRAME on the chain corresponds to CORE_ADDR. */
@ -548,7 +549,7 @@ varobj_create (char *objname,
if (has_stack_frames ()) if (has_stack_frames ())
{ {
/* Allow creator to specify context of variable */ /* Allow creator to specify context of variable. */
if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME)) if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME))
fi = get_selected_frame (NULL); fi = get_selected_frame (NULL);
else else
@ -564,7 +565,7 @@ varobj_create (char *objname,
else else
fi = NULL; fi = NULL;
/* frame = -2 means always use selected frame */ /* frame = -2 means always use selected frame. */
if (type == USE_SELECTED_FRAME) if (type == USE_SELECTED_FRAME)
var->root->floating = 1; var->root->floating = 1;
@ -617,7 +618,7 @@ varobj_create (char *objname,
/* We definitely need to catch errors here. /* We definitely need to catch errors here.
If evaluate_expression succeeds we got the value we wanted. If evaluate_expression succeeds we got the value we wanted.
But if it fails, we still go on with a call to evaluate_type() */ But if it fails, we still go on with a call to evaluate_type(). */
if (!gdb_evaluate_expression (var->root->exp, &value)) if (!gdb_evaluate_expression (var->root->exp, &value))
{ {
/* Error getting the value. Try to at least get the /* Error getting the value. Try to at least get the
@ -635,10 +636,10 @@ varobj_create (char *objname,
lang = variable_language (var); lang = variable_language (var);
var->root->lang = &languages[lang]; var->root->lang = &languages[lang];
/* Set ourselves as our root */ /* Set ourselves as our root. */
var->root->rootvar = var; var->root->rootvar = var;
/* Reset the selected frame */ /* Reset the selected frame. */
if (frame_id_p (old_id)) if (frame_id_p (old_id))
select_frame (frame_find_by_id (old_id)); select_frame (frame_find_by_id (old_id));
} }
@ -651,7 +652,7 @@ varobj_create (char *objname,
var->obj_name = xstrdup (objname); var->obj_name = xstrdup (objname);
/* If a varobj name is duplicated, the install will fail so /* If a varobj name is duplicated, the install will fail so
we must clenup */ we must cleanup. */
if (!install_variable (var)) if (!install_variable (var))
{ {
do_cleanups (old_chain); do_cleanups (old_chain);
@ -663,7 +664,7 @@ varobj_create (char *objname,
return var; return var;
} }
/* Generates an unique name that can be used for a varobj */ /* Generates an unique name that can be used for a varobj. */
char * char *
varobj_gen_name (void) varobj_gen_name (void)
@ -671,7 +672,7 @@ varobj_gen_name (void)
static int id = 0; static int id = 0;
char *obj_name; char *obj_name;
/* generate a name for this object */ /* Generate a name for this object. */
id++; id++;
obj_name = xstrprintf ("var%d", id); obj_name = xstrprintf ("var%d", id);
@ -704,7 +705,7 @@ varobj_get_handle (char *objname)
return cv->var; return cv->var;
} }
/* Given the handle, return the name of the object */ /* Given the handle, return the name of the object. */
char * char *
varobj_get_objname (struct varobj *var) varobj_get_objname (struct varobj *var)
@ -712,7 +713,7 @@ varobj_get_objname (struct varobj *var)
return var->obj_name; return var->obj_name;
} }
/* Given the handle, return the expression represented by the object */ /* Given the handle, return the expression represented by the object. */
char * char *
varobj_get_expression (struct varobj *var) varobj_get_expression (struct varobj *var)
@ -723,7 +724,7 @@ varobj_get_expression (struct varobj *var)
/* Deletes a varobj and all its children if only_children == 0, /* Deletes a varobj and all its children if only_children == 0,
otherwise deletes only the children; returns a malloc'ed list of otherwise deletes only the children; returns a malloc'ed list of
all the (malloc'ed) names of the variables that have been deleted all the (malloc'ed) names of the variables that have been deleted
(NULL terminated) */ (NULL terminated). */
int int
varobj_delete (struct varobj *var, char ***dellist, int only_children) varobj_delete (struct varobj *var, char ***dellist, int only_children)
@ -733,17 +734,17 @@ varobj_delete (struct varobj *var, char ***dellist, int only_children)
struct cpstack *result = NULL; struct cpstack *result = NULL;
char **cp; char **cp;
/* Initialize a stack for temporary results */ /* Initialize a stack for temporary results. */
cppush (&result, NULL); cppush (&result, NULL);
if (only_children) if (only_children)
/* Delete only the variable children */ /* Delete only the variable children. */
delcount = delete_variable (&result, var, 1 /* only the children */ ); delcount = delete_variable (&result, var, 1 /* only the children */ );
else else
/* Delete the variable and all its children */ /* Delete the variable and all its children. */
delcount = delete_variable (&result, var, 0 /* parent+children */ ); delcount = delete_variable (&result, var, 0 /* parent+children */ );
/* We may have been asked to return a list of what has been deleted */ /* We may have been asked to return a list of what has been deleted. */
if (dellist != NULL) if (dellist != NULL)
{ {
*dellist = xmalloc ((delcount + 1) * sizeof (char *)); *dellist = xmalloc ((delcount + 1) * sizeof (char *));
@ -788,7 +789,7 @@ instantiate_pretty_printer (PyObject *constructor, struct value *value)
#endif #endif
/* Set/Get variable object display format */ /* Set/Get variable object display format. */
enum varobj_display_formats enum varobj_display_formats
varobj_set_display_format (struct varobj *var, varobj_set_display_format (struct varobj *var,
@ -1119,7 +1120,7 @@ varobj_get_num_children (struct varobj *var)
} }
/* Creates a list of the immediate children of a variable object; /* Creates a list of the immediate children of a variable object;
the return code is the number of such children or -1 on error */ the return code is the number of such children or -1 on error. */
VEC (varobj_p)* VEC (varobj_p)*
varobj_list_children (struct varobj *var, int *from, int *to) varobj_list_children (struct varobj *var, int *from, int *to)
@ -1187,7 +1188,7 @@ varobj_add_child (struct varobj *var, const char *name, struct value *value)
#endif /* HAVE_PYTHON */ #endif /* HAVE_PYTHON */
/* Obtain the type of an object Variable as a string similar to the one gdb /* Obtain the type of an object Variable as a string similar to the one gdb
prints on the console */ prints on the console. */
char * char *
varobj_get_type (struct varobj *var) varobj_get_type (struct varobj *var)
@ -1238,7 +1239,7 @@ varobj_get_attributes (struct varobj *var)
int attributes = 0; int attributes = 0;
if (varobj_editable_p (var)) if (varobj_editable_p (var))
/* FIXME: define masks for attributes */ /* FIXME: define masks for attributes. */
attributes |= 0x00000001; /* Editable */ attributes |= 0x00000001; /* Editable */
return attributes; return attributes;
@ -1264,8 +1265,8 @@ varobj_get_value (struct varobj *var)
} }
/* Set the value of an object variable (if it is editable) to the /* Set the value of an object variable (if it is editable) to the
value of the given expression */ value of the given expression. */
/* Note: Invokes functions that can call error() */ /* Note: Invokes functions that can call error(). */
int int
varobj_set_value (struct varobj *var, char *expression) varobj_set_value (struct varobj *var, char *expression)
@ -1282,7 +1283,7 @@ varobj_set_value (struct varobj *var, char *expression)
gdb_assert (varobj_editable_p (var)); gdb_assert (varobj_editable_p (var));
input_radix = 10; /* ALWAYS reset to decimal temporarily */ input_radix = 10; /* ALWAYS reset to decimal temporarily. */
exp = parse_exp_1 (&s, 0, 0); exp = parse_exp_1 (&s, 0, 0);
if (!gdb_evaluate_expression (exp, &value)) if (!gdb_evaluate_expression (exp, &value))
{ {
@ -1437,12 +1438,12 @@ install_new_value_visualizer (struct varobj *var)
this is the first assignement after the variable object was just this is the first assignement after the variable object was just
created, or changed type. In that case, just assign the value created, or changed type. In that case, just assign the value
and return 0. and return 0.
Otherwise, assign the new value, and return 1 if the value is different Otherwise, assign the new value, and return 1 if the value is
from the current one, 0 otherwise. The comparison is done on textual different from the current one, 0 otherwise. The comparison is
representation of value. Therefore, some types need not be compared. E.g. done on textual representation of value. Therefore, some types
for structures the reported value is always "{...}", so no comparison is need not be compared. E.g. for structures the reported value is
necessary here. If the old value was NULL and new one is not, or vice versa, always "{...}", so no comparison is necessary here. If the old
we always return 1. value was NULL and new one is not, or vice versa, we always return 1.
The VALUE parameter should not be released -- the function will The VALUE parameter should not be released -- the function will
take care of releasing it when needed. */ take care of releasing it when needed. */
@ -1903,10 +1904,10 @@ delete_variable (struct cpstack **resultp, struct varobj *var,
return delcount; return delcount;
} }
/* Delete the variable object VAR and its children */ /* Delete the variable object VAR and its children. */
/* IMPORTANT NOTE: If we delete a variable which is a child /* IMPORTANT NOTE: If we delete a variable which is a child
and the parent is not removed we dump core. It must be always and the parent is not removed we dump core. It must be always
initially called with remove_from_parent_p set */ initially called with remove_from_parent_p set. */
static void static void
delete_variable_1 (struct cpstack **resultp, int *delcountp, delete_variable_1 (struct cpstack **resultp, int *delcountp,
struct varobj *var, int only_children_p, struct varobj *var, int only_children_p,
@ -1927,11 +1928,11 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp,
} }
VEC_free (varobj_p, var->children); VEC_free (varobj_p, var->children);
/* if we were called to delete only the children we are done here */ /* if we were called to delete only the children we are done here. */
if (only_children_p) if (only_children_p)
return; return;
/* Otherwise, add it to the list of deleted ones and proceed to do so */ /* Otherwise, add it to the list of deleted ones and proceed to do so. */
/* If the name is null, this is a temporary variable, that has not /* If the name is null, this is a temporary variable, that has not
yet been installed, don't report it, it belongs to the caller... */ yet been installed, don't report it, it belongs to the caller... */
if (var->obj_name != NULL) if (var->obj_name != NULL)
@ -1940,11 +1941,11 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp,
*delcountp = *delcountp + 1; *delcountp = *delcountp + 1;
} }
/* If this variable has a parent, remove it from its parent's list */ /* If this variable has a parent, remove it from its parent's list. */
/* OPTIMIZATION: if the parent of this variable is also being deleted, /* OPTIMIZATION: if the parent of this variable is also being deleted,
(as indicated by remove_from_parent_p) we don't bother doing an (as indicated by remove_from_parent_p) we don't bother doing an
expensive list search to find the element to remove when we are expensive list search to find the element to remove when we are
discarding the list afterwards */ discarding the list afterwards. */
if ((remove_from_parent_p) && (var->parent != NULL)) if ((remove_from_parent_p) && (var->parent != NULL))
{ {
VEC_replace (varobj_p, var->parent->children, var->index, NULL); VEC_replace (varobj_p, var->parent->children, var->index, NULL);
@ -1953,7 +1954,7 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp,
if (var->obj_name != NULL) if (var->obj_name != NULL)
uninstall_variable (var); uninstall_variable (var);
/* Free memory associated with this variable */ /* Free memory associated with this variable. */
free_variable (var); free_variable (var);
} }
@ -1979,16 +1980,16 @@ install_variable (struct varobj *var)
if (cv != NULL) if (cv != NULL)
error (_("Duplicate variable object name")); error (_("Duplicate variable object name"));
/* Add varobj to hash table */ /* Add varobj to hash table. */
newvl = xmalloc (sizeof (struct vlist)); newvl = xmalloc (sizeof (struct vlist));
newvl->next = *(varobj_table + index); newvl->next = *(varobj_table + index);
newvl->var = var; newvl->var = var;
*(varobj_table + index) = newvl; *(varobj_table + index) = newvl;
/* If root, add varobj to root list */ /* If root, add varobj to root list. */
if (is_root_p (var)) if (is_root_p (var))
{ {
/* Add to list of root variables */ /* Add to list of root variables. */
if (rootlist == NULL) if (rootlist == NULL)
var->root->next = NULL; var->root->next = NULL;
else else
@ -2011,7 +2012,7 @@ uninstall_variable (struct varobj *var)
unsigned int index = 0; unsigned int index = 0;
unsigned int i = 1; unsigned int i = 1;
/* Remove varobj from hash table */ /* Remove varobj from hash table. */
for (chp = var->obj_name; *chp; chp++) for (chp = var->obj_name; *chp; chp++)
{ {
index = (index + (i++ * (unsigned int) *chp)) % VAROBJ_TABLE_SIZE; index = (index + (i++ * (unsigned int) *chp)) % VAROBJ_TABLE_SIZE;
@ -2043,10 +2044,10 @@ uninstall_variable (struct varobj *var)
xfree (cv); xfree (cv);
/* If root, remove varobj from root list */ /* If root, remove varobj from root list. */
if (is_root_p (var)) if (is_root_p (var))
{ {
/* Remove from list of root variables */ /* Remove from list of root variables. */
if (rootlist == var->root) if (rootlist == var->root)
rootlist = var->root->next; rootlist = var->root->next;
else else
@ -2074,7 +2075,7 @@ uninstall_variable (struct varobj *var)
} }
/* Create and install a child of the parent of the given name */ /* Create and install a child of the parent of the given name. */
static struct varobj * static struct varobj *
create_child (struct varobj *parent, int index, char *name) create_child (struct varobj *parent, int index, char *name)
{ {
@ -2091,7 +2092,7 @@ create_child_with_value (struct varobj *parent, int index, const char *name,
child = new_variable (); child = new_variable ();
/* name is allocated by name_of_child */ /* Name is allocated by name_of_child. */
/* FIXME: xstrdup should not be here. */ /* FIXME: xstrdup should not be here. */
child->name = xstrdup (name); child->name = xstrdup (name);
child->index = index; child->index = index;
@ -2121,7 +2122,7 @@ create_child_with_value (struct varobj *parent, int index, const char *name,
* Miscellaneous utility functions. * Miscellaneous utility functions.
*/ */
/* Allocate memory and initialize a new variable */ /* Allocate memory and initialize a new variable. */
static struct varobj * static struct varobj *
new_variable (void) new_variable (void)
{ {
@ -2154,7 +2155,7 @@ new_variable (void)
return var; return var;
} }
/* Allocate memory and initialize a new root variable */ /* Allocate memory and initialize a new root variable. */
static struct varobj * static struct varobj *
new_root_variable (void) new_root_variable (void)
{ {
@ -2290,7 +2291,7 @@ variable_default_display (struct varobj *var)
return FORMAT_NATURAL; return FORMAT_NATURAL;
} }
/* FIXME: The following should be generic for any pointer */ /* FIXME: The following should be generic for any pointer. */
static void static void
cppush (struct cpstack **pstack, char *name) cppush (struct cpstack **pstack, char *name)
{ {
@ -2302,7 +2303,7 @@ cppush (struct cpstack **pstack, char *name)
*pstack = s; *pstack = s;
} }
/* FIXME: The following should be generic for any pointer */ /* FIXME: The following should be generic for any pointer. */
static char * static char *
cppop (struct cpstack **pstack) cppop (struct cpstack **pstack)
{ {
@ -2759,7 +2760,7 @@ c_number_of_children (struct varobj *var)
We can show char* so we allow it to be dereferenced. If you decide We can show char* so we allow it to be dereferenced. If you decide
to test for it, please mind that a little magic is necessary to to test for it, please mind that a little magic is necessary to
properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and
TYPE_NAME == "char" */ TYPE_NAME == "char". */
if (TYPE_CODE (target) == TYPE_CODE_FUNC if (TYPE_CODE (target) == TYPE_CODE_FUNC
|| TYPE_CODE (target) == TYPE_CODE_VOID) || TYPE_CODE (target) == TYPE_CODE_VOID)
children = 0; children = 0;
@ -2768,7 +2769,7 @@ c_number_of_children (struct varobj *var)
break; break;
default: default:
/* Other types have no children */ /* Other types have no children. */
break; break;
} }
@ -2925,7 +2926,7 @@ c_describe_child (struct varobj *parent, int index,
break; break;
default: default:
/* This should not happen */ /* This should not happen. */
if (cname) if (cname)
*cname = xstrdup ("???"); *cname = xstrdup ("???");
if (cfull_expression) if (cfull_expression)
@ -2985,7 +2986,7 @@ c_value_of_root (struct varobj **var_handle)
/* Only root variables can be updated... */ /* Only root variables can be updated... */
if (!is_root_p (var)) if (!is_root_p (var))
/* Not a root var */ /* Not a root var. */
return NULL; return NULL;
back_to = make_cleanup_restore_current_thread (); back_to = make_cleanup_restore_current_thread ();
@ -3096,7 +3097,7 @@ c_value_of_variable (struct varobj *var, enum varobj_display_formats format)
gdb_assert (!value_lazy (var->value)); gdb_assert (!value_lazy (var->value));
/* If the specified format is the current one, /* If the specified format is the current one,
we can reuse print_value */ we can reuse print_value. */
if (format == var->format) if (format == var->format)
return xstrdup (var->print_value); return xstrdup (var->print_value);
else else
@ -3136,11 +3137,11 @@ cplus_number_of_children (struct varobj *var)
if (kids[v_protected] != 0) if (kids[v_protected] != 0)
children++; children++;
/* Add any baseclasses */ /* Add any baseclasses. */
children += TYPE_N_BASECLASSES (type); children += TYPE_N_BASECLASSES (type);
dont_know = 0; dont_know = 0;
/* FIXME: save children in var */ /* FIXME: save children in var. */
} }
} }
else else
@ -3375,7 +3376,7 @@ cplus_describe_child (struct varobj *parent, int index,
access = "protected"; access = "protected";
break; break;
case 2: case 2:
/* Must be protected */ /* Must be protected. */
access = "protected"; access = "protected";
break; break;
default: default:

View file

@ -34,9 +34,9 @@ enum varobj_display_formats
enum varobj_type enum varobj_type
{ {
USE_SPECIFIED_FRAME, /* Use the frame passed to varobj_create */ USE_SPECIFIED_FRAME, /* Use the frame passed to varobj_create. */
USE_CURRENT_FRAME, /* Use the current frame */ USE_CURRENT_FRAME, /* Use the current frame. */
USE_SELECTED_FRAME /* Always reevaluate in selected frame */ USE_SELECTED_FRAME /* Always reevaluate in selected frame. */
}; };
/* Enumerator describing if a variable object is in scope. */ /* Enumerator describing if a variable object is in scope. */
@ -50,7 +50,7 @@ enum varobj_scope_status
will. */ will. */
}; };
/* String representations of gdb's format codes (defined in varobj.c) */ /* String representations of gdb's format codes (defined in varobj.c). */
extern char *varobj_format_string[]; extern char *varobj_format_string[];
/* Languages supported by this variable objects system. */ /* Languages supported by this variable objects system. */
@ -59,10 +59,10 @@ enum varobj_languages
vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java, vlang_end vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java, vlang_end
}; };
/* String representations of gdb's known languages (defined in varobj.c) */ /* String representations of gdb's known languages (defined in varobj.c). */
extern char *varobj_language_string[]; extern char *varobj_language_string[];
/* Struct thar describes a variable object instance */ /* Struct thar describes a variable object instance. */
struct varobj; struct varobj;
typedef struct varobj *varobj_p; typedef struct varobj *varobj_p;
@ -77,7 +77,7 @@ typedef struct varobj_update_result_t
enum varobj_scope_status status; enum varobj_scope_status status;
/* This variable is used internally by varobj_update to indicate if the /* This variable is used internally by varobj_update to indicate if the
new value of varobj is already computed and installed, or has to new value of varobj is already computed and installed, or has to
be yet installed. Don't use this outside varobj.c */ be yet installed. Don't use this outside varobj.c. */
int value_installed; int value_installed;
/* This will be non-NULL when new children were added to the varobj. /* This will be non-NULL when new children were added to the varobj.

View file

@ -89,7 +89,8 @@ static BOOL WINAPI (*GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO,
DWORD); DWORD);
static BOOL WINAPI (*LookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID); static BOOL WINAPI (*LookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID);
static BOOL WINAPI (*OpenProcessToken)(HANDLE, DWORD, PHANDLE); static BOOL WINAPI (*OpenProcessToken)(HANDLE, DWORD, PHANDLE);
static BOOL WINAPI (*GetCurrentConsoleFont) (HANDLE, BOOL, CONSOLE_FONT_INFO *); static BOOL WINAPI (*GetCurrentConsoleFont) (HANDLE, BOOL,
CONSOLE_FONT_INFO *);
static COORD WINAPI (*GetConsoleFontSize) (HANDLE, DWORD); static COORD WINAPI (*GetConsoleFontSize) (HANDLE, DWORD);
static struct target_ops windows_ops; static struct target_ops windows_ops;
@ -113,7 +114,8 @@ static struct target_ops windows_ops;
# if CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API_MINOR) >= 181 # if CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API_MINOR) >= 181
# define __USEWIDE # define __USEWIDE
typedef wchar_t cygwin_buf_t; typedef wchar_t cygwin_buf_t;
static DWORD WINAPI (*GetModuleFileNameEx) (HANDLE, HMODULE, LPWSTR, DWORD); static DWORD WINAPI (*GetModuleFileNameEx) (HANDLE, HMODULE,
LPWSTR, DWORD);
# define STARTUPINFO STARTUPINFOW # define STARTUPINFO STARTUPINFOW
# define CreateProcess CreateProcessW # define CreateProcess CreateProcessW
# define GetModuleFileNameEx_name "GetModuleFileNameExW" # define GetModuleFileNameEx_name "GetModuleFileNameExW"
@ -135,8 +137,10 @@ static struct target_ops windows_ops;
# endif # endif
#endif #endif
static int have_saved_context; /* True if we've saved context from a cygwin signal. */ static int have_saved_context; /* True if we've saved context from a
static CONTEXT saved_context; /* Containes the saved context from a cygwin signal. */ cygwin signal. */
static CONTEXT saved_context; /* Containes the saved context from a
cygwin signal. */
/* If we're not using the old Cygwin header file set, define the /* If we're not using the old Cygwin header file set, define the
following which never should have been in the generic Win32 API following which never should have been in the generic Win32 API
@ -186,7 +190,7 @@ static void cygwin_set_dr7 (unsigned long val);
static unsigned long cygwin_get_dr6 (void); static unsigned long cygwin_get_dr6 (void);
static enum target_signal last_sig = TARGET_SIGNAL_0; static enum target_signal last_sig = TARGET_SIGNAL_0;
/* Set if a signal was received from the debugged process */ /* Set if a signal was received from the debugged process. */
/* Thread information structure used to track information that is /* Thread information structure used to track information that is
not available in gdb's thread structure. */ not available in gdb's thread structure. */
@ -380,7 +384,7 @@ windows_init_thread_list (void)
thread_head.next = NULL; thread_head.next = NULL;
} }
/* Delete a thread from the list of threads */ /* Delete a thread from the list of threads. */
static void static void
windows_delete_thread (ptid_t ptid) windows_delete_thread (ptid_t ptid)
{ {
@ -418,17 +422,19 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
if (!current_thread) if (!current_thread)
return; /* Windows sometimes uses a non-existent thread id in its return; /* Windows sometimes uses a non-existent thread id in its
events */ events. */
if (current_thread->reload_context) if (current_thread->reload_context)
{ {
#ifdef __COPY_CONTEXT_SIZE #ifdef __COPY_CONTEXT_SIZE
if (have_saved_context) if (have_saved_context)
{ {
/* Lie about where the program actually is stopped since cygwin has informed us that /* Lie about where the program actually is stopped since
we should consider the signal to have occurred at another location which is stored cygwin has informed us that we should consider the signal
in "saved_context. */ to have occurred at another location which is stored in
memcpy (&current_thread->context, &saved_context, __COPY_CONTEXT_SIZE); "saved_context. */
memcpy (&current_thread->context, &saved_context,
__COPY_CONTEXT_SIZE);
have_saved_context = 0; have_saved_context = 0;
} }
else else
@ -438,7 +444,8 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
th->context.ContextFlags = CONTEXT_DEBUGGER_DR; th->context.ContextFlags = CONTEXT_DEBUGGER_DR;
GetThreadContext (th->h, &th->context); GetThreadContext (th->h, &th->context);
/* Copy dr values from that thread. /* Copy dr values from that thread.
But only if there were not modified since last stop. PR gdb/2388 */ But only if there were not modified since last stop.
PR gdb/2388 */
if (!debug_registers_changed) if (!debug_registers_changed)
{ {
dr[0] = th->context.Dr0; dr[0] = th->context.Dr0;
@ -477,7 +484,7 @@ windows_fetch_inferior_registers (struct target_ops *ops,
{ {
current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE); current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent /* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */ thread id in its events. */
if (current_thread) if (current_thread)
do_windows_fetch_inferior_registers (regcache, r); do_windows_fetch_inferior_registers (regcache, r);
} }
@ -486,7 +493,7 @@ static void
do_windows_store_inferior_registers (const struct regcache *regcache, int r) do_windows_store_inferior_registers (const struct regcache *regcache, int r)
{ {
if (!current_thread) if (!current_thread)
/* Windows sometimes uses a non-existent thread id in its events */; /* Windows sometimes uses a non-existent thread id in its events. */;
else if (r >= 0) else if (r >= 0)
regcache_raw_collect (regcache, r, regcache_raw_collect (regcache, r,
((char *) &current_thread->context) + mappings[r]); ((char *) &current_thread->context) + mappings[r]);
@ -497,14 +504,14 @@ do_windows_store_inferior_registers (const struct regcache *regcache, int r)
} }
} }
/* Store a new register value into the current thread context */ /* Store a new register value into the current thread context. */
static void static void
windows_store_inferior_registers (struct target_ops *ops, windows_store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int r) struct regcache *regcache, int r)
{ {
current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE); current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent /* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */ thread id in its events. */
if (current_thread) if (current_thread)
do_windows_store_inferior_registers (regcache, r); do_windows_store_inferior_registers (regcache, r);
} }
@ -519,7 +526,8 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
MODULEINFO mi; MODULEINFO mi;
int i; int i;
HMODULE dh_buf[1]; HMODULE dh_buf[1];
HMODULE *DllHandle = dh_buf; /* Set to temporary storage for initial query */ HMODULE *DllHandle = dh_buf; /* Set to temporary storage for
initial query. */
DWORD cbNeeded; DWORD cbNeeded;
#ifdef __CYGWIN__ #ifdef __CYGWIN__
cygwin_buf_t pathbuf[__PMAX]; /* Temporary storage prior to converting to cygwin_buf_t pathbuf[__PMAX]; /* Temporary storage prior to converting to
@ -529,33 +537,34 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
#endif #endif
cbNeeded = 0; cbNeeded = 0;
/* Find size of buffer needed to handle list of modules loaded in inferior */ /* Find size of buffer needed to handle list of modules loaded in
inferior. */
if (!EnumProcessModules (current_process_handle, DllHandle, if (!EnumProcessModules (current_process_handle, DllHandle,
sizeof (HMODULE), &cbNeeded) || !cbNeeded) sizeof (HMODULE), &cbNeeded) || !cbNeeded)
goto failed; goto failed;
/* Allocate correct amount of space for module list */ /* Allocate correct amount of space for module list. */
DllHandle = (HMODULE *) alloca (cbNeeded); DllHandle = (HMODULE *) alloca (cbNeeded);
if (!DllHandle) if (!DllHandle)
goto failed; goto failed;
/* Get the list of modules */ /* Get the list of modules. */
if (!EnumProcessModules (current_process_handle, DllHandle, cbNeeded, if (!EnumProcessModules (current_process_handle, DllHandle, cbNeeded,
&cbNeeded)) &cbNeeded))
goto failed; goto failed;
for (i = 0; i < (int) (cbNeeded / sizeof (HMODULE)); i++) for (i = 0; i < (int) (cbNeeded / sizeof (HMODULE)); i++)
{ {
/* Get information on this module */ /* Get information on this module. */
if (!GetModuleInformation (current_process_handle, DllHandle[i], if (!GetModuleInformation (current_process_handle, DllHandle[i],
&mi, sizeof (mi))) &mi, sizeof (mi)))
error (_("Can't get module info")); error (_("Can't get module info"));
if (!base_address || mi.lpBaseOfDll == base_address) if (!base_address || mi.lpBaseOfDll == base_address)
{ {
/* Try to find the name of the given module */ /* Try to find the name of the given module. */
#ifdef __CYGWIN__ #ifdef __CYGWIN__
/* Cygwin prefers that the path be in /x/y/z format */ /* Cygwin prefers that the path be in /x/y/z format. */
len = GetModuleFileNameEx (current_process_handle, len = GetModuleFileNameEx (current_process_handle,
DllHandle[i], pathbuf, __PMAX); DllHandle[i], pathbuf, __PMAX);
if (len == 0) if (len == 0)
@ -567,7 +576,8 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
len = GetModuleFileNameEx (current_process_handle, len = GetModuleFileNameEx (current_process_handle,
DllHandle[i], dll_name_ret, __PMAX); DllHandle[i], dll_name_ret, __PMAX);
if (len == 0) if (len == 0)
error (_("Error getting dll name: %u."), (unsigned) GetLastError ()); error (_("Error getting dll name: %u."),
(unsigned) GetLastError ());
#endif #endif
return 1; /* success */ return 1; /* success */
} }
@ -579,7 +589,7 @@ failed:
} }
/* Encapsulate the information required in a call to /* Encapsulate the information required in a call to
symbol_file_add_args */ symbol_file_add_args. */
struct safe_symbol_file_add_args struct safe_symbol_file_add_args
{ {
char *name; char *name;
@ -612,7 +622,7 @@ safe_symbol_file_add_stub (void *argv)
#undef p #undef p
} }
/* Restore gdb's stderr after calling symbol_file_add */ /* Restore gdb's stderr after calling symbol_file_add. */
static void static void
safe_symbol_file_add_cleanup (void *p) safe_symbol_file_add_cleanup (void *p)
{ {
@ -752,7 +762,8 @@ windows_make_so (const char *name, LPVOID load_addr)
/* The symbols in a dll are offset by 0x1000, which is the the /* The symbols in a dll are offset by 0x1000, which is the the
offset from 0 of the first byte in an image - because of the offset from 0 of the first byte in an image - because of the
file header and the section alignment. */ file header and the section alignment. */
cygwin_load_start = (CORE_ADDR) (uintptr_t) ((char *) load_addr + 0x1000); cygwin_load_start = (CORE_ADDR) (uintptr_t) ((char *)
load_addr + 0x1000);
cygwin_load_end = cygwin_load_start + bfd_section_size (abfd, text); cygwin_load_end = cygwin_load_start + bfd_section_size (abfd, text);
bfd_close (abfd); bfd_close (abfd);
@ -784,11 +795,12 @@ get_image_name (HANDLE h, void *address, int unicode)
/* See if we could read the address of a string, and that the /* See if we could read the address of a string, and that the
address isn't null. */ address isn't null. */
if (!ReadProcessMemory (h, address, &address_ptr, sizeof (address_ptr), &done) if (!ReadProcessMemory (h, address, &address_ptr,
sizeof (address_ptr), &done)
|| done != sizeof (address_ptr) || !address_ptr) || done != sizeof (address_ptr) || !address_ptr)
return NULL; return NULL;
/* Find the length of the string */ /* Find the length of the string. */
while (ReadProcessMemory (h, address_ptr + len++ * size, &b, size, &done) while (ReadProcessMemory (h, address_ptr + len++ * size, &b, size, &done)
&& (b[0] != 0 || b[size - 1] != 0) && done == size) && (b[0] != 0 || b[size - 1] != 0) && done == size)
continue; continue;
@ -927,7 +939,8 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
&s, 1024, 0) &s, 1024, 0)
|| !s || !*s) || !s || !*s)
/* nothing to do */; /* nothing to do */;
else if (strncmp (s, _CYGWIN_SIGNAL_STRING, sizeof (_CYGWIN_SIGNAL_STRING) - 1) != 0) else if (strncmp (s, _CYGWIN_SIGNAL_STRING,
sizeof (_CYGWIN_SIGNAL_STRING) - 1) != 0)
{ {
#ifdef __CYGWIN__ #ifdef __CYGWIN__
if (strncmp (s, "cYg", 3) != 0) if (strncmp (s, "cYg", 3) != 0)
@ -937,11 +950,13 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
#ifdef __COPY_CONTEXT_SIZE #ifdef __COPY_CONTEXT_SIZE
else else
{ {
/* Got a cygwin signal marker. A cygwin signal is followed by the signal number /* Got a cygwin signal marker. A cygwin signal is followed by
itself and then optionally followed by the thread id and address to saved context the signal number itself and then optionally followed by the
within the DLL. If these are supplied, then the given thread is assumed to have thread id and address to saved context within the DLL. If
issued the signal and the context from the thread is assumed to be stored at the these are supplied, then the given thread is assumed to have
given address in the inferior. Tell gdb to treat this like a real signal. */ issued the signal and the context from the thread is assumed
to be stored at the given address in the inferior. Tell gdb
to treat this like a real signal. */
char *p; char *p;
int sig = strtol (s + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0); int sig = strtol (s + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0);
int gotasig = target_signal_from_host (sig); int gotasig = target_signal_from_host (sig);
@ -956,7 +971,8 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
retval = main_thread_id; retval = main_thread_id;
else if ((x = (LPCVOID) strtoul (p, &p, 0)) else if ((x = (LPCVOID) strtoul (p, &p, 0))
&& ReadProcessMemory (current_process_handle, x, && ReadProcessMemory (current_process_handle, x,
&saved_context, __COPY_CONTEXT_SIZE, &n) &saved_context,
__COPY_CONTEXT_SIZE, &n)
&& n == __COPY_CONTEXT_SIZE) && n == __COPY_CONTEXT_SIZE)
have_saved_context = 1; have_saved_context = 1;
current_event.dwThreadId = retval; current_event.dwThreadId = retval;
@ -1097,7 +1113,7 @@ handle_exception (struct target_waitstatus *ourstatus)
ourstatus->kind = TARGET_WAITKIND_STOPPED; ourstatus->kind = TARGET_WAITKIND_STOPPED;
/* Record the context of the current thread */ /* Record the context of the current thread. */
th = thread_rec (current_event.dwThreadId, -1); th = thread_rec (current_event.dwThreadId, -1);
switch (code) switch (code)
@ -1107,17 +1123,23 @@ handle_exception (struct target_waitstatus *ourstatus)
ourstatus->value.sig = TARGET_SIGNAL_SEGV; ourstatus->value.sig = TARGET_SIGNAL_SEGV;
#ifdef __CYGWIN__ #ifdef __CYGWIN__
{ {
/* See if the access violation happened within the cygwin DLL itself. Cygwin uses /* See if the access violation happened within the cygwin DLL
a kind of exception handling to deal with passed-in invalid addresses. gdb itself. Cygwin uses a kind of exception handling to deal
should not treat these as real SEGVs since they will be silently handled by with passed-in invalid addresses. gdb should not treat
cygwin. A real SEGV will (theoretically) be caught by cygwin later in the process these as real SEGVs since they will be silently handled by
and will be sent as a cygwin-specific-signal. So, ignore SEGVs if they show up cygwin. A real SEGV will (theoretically) be caught by
cygwin later in the process and will be sent as a
cygwin-specific-signal. So, ignore SEGVs if they show up
within the text segment of the DLL itself. */ within the text segment of the DLL itself. */
char *fn; char *fn;
CORE_ADDR addr = (CORE_ADDR) (uintptr_t) current_event.u.Exception.ExceptionRecord.ExceptionAddress; CORE_ADDR addr = (CORE_ADDR) (uintptr_t)
if ((!cygwin_exceptions && (addr >= cygwin_load_start && addr < cygwin_load_end)) current_event.u.Exception.ExceptionRecord.ExceptionAddress;
if ((!cygwin_exceptions && (addr >= cygwin_load_start
&& addr < cygwin_load_end))
|| (find_pc_partial_function (addr, &fn, NULL, NULL) || (find_pc_partial_function (addr, &fn, NULL, NULL)
&& strncmp (fn, "KERNEL32!IsBad", strlen ("KERNEL32!IsBad")) == 0)) && strncmp (fn, "KERNEL32!IsBad",
strlen ("KERNEL32!IsBad")) == 0))
return 0; return 0;
} }
#endif #endif
@ -1211,7 +1233,7 @@ handle_exception (struct target_waitstatus *ourstatus)
} }
/* Resume all artificially suspended threads if we are continuing /* Resume all artificially suspended threads if we are continuing
execution */ execution. */
static BOOL static BOOL
windows_continue (DWORD continue_status, int id) windows_continue (DWORD continue_status, int id)
{ {
@ -1314,8 +1336,8 @@ windows_resume (struct target_ops *ops,
for (i = 0; xlate[i].them != -1; i++) for (i = 0; xlate[i].them != -1; i++)
if (xlate[i].us == sig) if (xlate[i].us == sig)
{ {
current_event.u.Exception.ExceptionRecord.ExceptionCode = current_event.u.Exception.ExceptionRecord.ExceptionCode
xlate[i].them; = xlate[i].them;
continue_status = DBG_EXCEPTION_NOT_HANDLED; continue_status = DBG_EXCEPTION_NOT_HANDLED;
break; break;
} }
@ -1334,13 +1356,13 @@ windows_resume (struct target_ops *ops,
DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n", DEBUG_EXEC (("gdb: windows_resume (pid=%d, tid=%ld, step=%d, sig=%d);\n",
ptid_get_pid (ptid), ptid_get_tid (ptid), step, sig)); ptid_get_pid (ptid), ptid_get_tid (ptid), step, sig));
/* Get context for currently selected thread */ /* Get context for currently selected thread. */
th = thread_rec (ptid_get_tid (inferior_ptid), FALSE); th = thread_rec (ptid_get_tid (inferior_ptid), FALSE);
if (th) if (th)
{ {
if (step) if (step)
{ {
/* Single step by setting t bit */ /* Single step by setting t bit. */
struct regcache *regcache = get_current_regcache (); struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
windows_fetch_inferior_registers (ops, regcache, windows_fetch_inferior_registers (ops, regcache,
@ -1392,8 +1414,8 @@ ctrl_c_handler (DWORD event_type)
return TRUE; return TRUE;
if (!DebugBreakProcess (current_process_handle)) if (!DebugBreakProcess (current_process_handle))
warning (_("\ warning (_("Could not interrupt program. "
Could not interrupt program. Press Ctrl-c in the program console.")); "Press Ctrl-c in the program console."));
/* Return true to tell that Ctrl-C has been handled. */ /* Return true to tell that Ctrl-C has been handled. */
return TRUE; return TRUE;
@ -1446,7 +1468,7 @@ get_windows_debug_event (struct target_ops *ops,
} }
break; break;
} }
/* Record the existence of this thread */ /* Record the existence of this thread. */
retval = current_event.dwThreadId; retval = current_event.dwThreadId;
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0, th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
current_event.dwThreadId), current_event.dwThreadId),
@ -1483,7 +1505,7 @@ get_windows_debug_event (struct target_ops *ops,
windows_delete_thread (ptid_build (current_event.dwProcessId, 0, windows_delete_thread (ptid_build (current_event.dwProcessId, 0,
main_thread_id)); main_thread_id));
main_thread_id = current_event.dwThreadId; main_thread_id = current_event.dwThreadId;
/* Add the main thread */ /* Add the main thread. */
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0, th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
current_event.dwThreadId), current_event.dwThreadId),
current_event.u.CreateProcessInfo.hThread, current_event.u.CreateProcessInfo.hThread,
@ -1560,7 +1582,7 @@ get_windows_debug_event (struct target_ops *ops,
} }
break; break;
case OUTPUT_DEBUG_STRING_EVENT: /* message from the kernel */ case OUTPUT_DEBUG_STRING_EVENT: /* Message from the kernel. */
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
@ -1783,7 +1805,8 @@ windows_attach (struct target_ops *ops, char *args, int from_tty)
if (set_process_privilege (SE_DEBUG_NAME, TRUE) < 0) if (set_process_privilege (SE_DEBUG_NAME, TRUE) < 0)
{ {
printf_unfiltered ("Warning: Failed to get SE_DEBUG_NAME privilege\n"); printf_unfiltered ("Warning: Failed to get SE_DEBUG_NAME privilege\n");
printf_unfiltered ("This can cause attach to fail on Windows NT/2K/XP\n"); printf_unfiltered ("This can cause attach to "
"fail on Windows NT/2K/XP\n");
} }
windows_init_thread_list (); windows_init_thread_list ();
@ -1793,7 +1816,7 @@ windows_attach (struct target_ops *ops, char *args, int from_tty)
#ifdef __CYGWIN__ #ifdef __CYGWIN__
if (!ok) if (!ok)
{ {
/* Try fall back to Cygwin pid */ /* Try fall back to Cygwin pid. */
pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid); pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
if (pid > 0) if (pid > 0)
@ -1861,7 +1884,7 @@ windows_pid_to_exec_file (int pid)
{ {
static char path[__PMAX]; static char path[__PMAX];
#ifdef __CYGWIN__ #ifdef __CYGWIN__
/* Try to find exe name as symlink target of /proc/<pid>/exe */ /* Try to find exe name as symlink target of /proc/<pid>/exe. */
int nchars; int nchars;
char procexe[sizeof ("/proc/4294967295/exe")]; char procexe[sizeof ("/proc/4294967295/exe")];
sprintf (procexe, "/proc/%u/exe", pid); sprintf (procexe, "/proc/%u/exe", pid);
@ -2019,7 +2042,8 @@ windows_create_inferior (struct target_ops *ops, char *exec_file,
cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t)); cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
swprintf (cygallargs, len, L" -c 'exec %s %s'", exec_file, allargs); swprintf (cygallargs, len, L" -c 'exec %s %s'", exec_file, allargs);
#else #else
cygallargs = (char *) alloca (sizeof (" -c 'exec '") + strlen (exec_file) cygallargs = (char *)
alloca (sizeof (" -c 'exec '") + strlen (exec_file)
+ strlen (allargs) + 2); + strlen (allargs) + 2);
sprintf (cygallargs, " -c 'exec %s %s'", exec_file, allargs); sprintf (cygallargs, " -c 'exec %s %s'", exec_file, allargs);
#endif #endif
@ -2217,13 +2241,13 @@ windows_kill_inferior (struct target_ops *ops)
break; break;
} }
target_mourn_inferior (); /* or just windows_mourn_inferior? */ target_mourn_inferior (); /* Or just windows_mourn_inferior? */
} }
static void static void
windows_prepare_to_store (struct regcache *regcache) windows_prepare_to_store (struct regcache *regcache)
{ {
/* Do nothing, since we can store individual regs */ /* Do nothing, since we can store individual regs. */
} }
static int static int
@ -2272,7 +2296,8 @@ windows_xfer_shared_libraries (struct target_ops *ops,
obstack_init (&obstack); obstack_init (&obstack);
obstack_grow_str (&obstack, "<library-list>\n"); obstack_grow_str (&obstack, "<library-list>\n");
for (so = solib_start.next; so; so = so->next) for (so = solib_start.next; so; so = so->next)
windows_xfer_shared_library (so->so_name, (CORE_ADDR) (uintptr_t) so->lm_info->load_addr, windows_xfer_shared_library (so->so_name, (CORE_ADDR)
(uintptr_t) so->lm_info->load_addr,
target_gdbarch, &obstack); target_gdbarch, &obstack);
obstack_grow_str0 (&obstack, "</library-list>\n"); obstack_grow_str0 (&obstack, "</library-list>\n");
@ -2434,7 +2459,8 @@ Show use of shell to start subprocess."), NULL,
NULL, /* FIXME: i18n: */ NULL, /* FIXME: i18n: */
&setlist, &showlist); &setlist, &showlist);
add_setshow_boolean_cmd ("cygwin-exceptions", class_support, &cygwin_exceptions, _("\ add_setshow_boolean_cmd ("cygwin-exceptions", class_support,
&cygwin_exceptions, _("\
Break when an exception is detected in the Cygwin DLL itself."), _("\ Break when an exception is detected in the Cygwin DLL itself."), _("\
Show whether gdb breaks on exceptions in the Cygwin DLL itself."), NULL, Show whether gdb breaks on exceptions in the Cygwin DLL itself."), NULL,
NULL, NULL,
@ -2541,8 +2567,8 @@ windows_thread_alive (struct target_ops *ops, ptid_t ptid)
gdb_assert (ptid_get_tid (ptid) != 0); gdb_assert (ptid_get_tid (ptid) != 0);
tid = ptid_get_tid (ptid); tid = ptid_get_tid (ptid);
return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0 ? return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0
FALSE : TRUE; ? FALSE : TRUE;
} }
void void
@ -2694,9 +2720,11 @@ _initialize_loadable (void)
EnumProcessModules = bad_EnumProcessModules; EnumProcessModules = bad_EnumProcessModules;
GetModuleInformation = bad_GetModuleInformation; GetModuleInformation = bad_GetModuleInformation;
GetModuleFileNameEx = bad_GetModuleFileNameEx; GetModuleFileNameEx = bad_GetModuleFileNameEx;
/* This will probably fail on Windows 9x/Me. Let the user know that we're /* This will probably fail on Windows 9x/Me. Let the user know
missing some functionality. */ that we're missing some functionality. */
warning(_("cannot automatically find executable file or library to read symbols.\nUse \"file\" or \"dll\" command to load executable/libraries directly.")); warning(_("\
cannot automatically find executable file or library to read symbols.\n\
Use \"file\" or \"dll\" command to load executable/libraries directly."));
} }
hm = LoadLibrary ("advapi32.dll"); hm = LoadLibrary ("advapi32.dll");
@ -2709,7 +2737,8 @@ _initialize_loadable (void)
GetProcAddress (hm, "AdjustTokenPrivileges"); GetProcAddress (hm, "AdjustTokenPrivileges");
/* Only need to set one of these since if OpenProcessToken fails nothing /* Only need to set one of these since if OpenProcessToken fails nothing
else is needed. */ else is needed. */
if (!OpenProcessToken || !LookupPrivilegeValueA || !AdjustTokenPrivileges) if (!OpenProcessToken || !LookupPrivilegeValueA
|| !AdjustTokenPrivileges)
OpenProcessToken = bad_OpenProcessToken; OpenProcessToken = bad_OpenProcessToken;
} }
} }

View file

@ -86,8 +86,10 @@ static const char* TIB_NAME[] =
" last_error_number " /* %fs:0x0034 */ " last_error_number " /* %fs:0x0034 */
}; };
static const int MAX_TIB32 = sizeof (thread_information_32) / sizeof (uint32_t); static const int MAX_TIB32 =
static const int MAX_TIB64 = sizeof (thread_information_64) / sizeof (uint64_t); sizeof (thread_information_32) / sizeof (uint32_t);
static const int MAX_TIB64 =
sizeof (thread_information_64) / sizeof (uint64_t);
static const int FULL_TIB_SIZE = 0x1000; static const int FULL_TIB_SIZE = 0x1000;
static int maint_display_all_tib = 0; static int maint_display_all_tib = 0;
@ -125,7 +127,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
module_list_ptr_type = void_ptr_type; module_list_ptr_type = void_ptr_type;
append_composite_type_field (list_type, "forward_list", module_list_ptr_type); append_composite_type_field (list_type, "forward_list",
module_list_ptr_type);
append_composite_type_field (list_type, "backward_list", append_composite_type_field (list_type, "backward_list",
module_list_ptr_type); module_list_ptr_type);
@ -184,7 +187,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
/* uint32_t current_seh; %fs:0x0000 */ /* uint32_t current_seh; %fs:0x0000 */
append_composite_type_field (tib_type, "current_seh", seh_ptr_type); append_composite_type_field (tib_type, "current_seh", seh_ptr_type);
/* uint32_t current_top_of_stack; %fs:0x0004 */ /* uint32_t current_top_of_stack; %fs:0x0004 */
append_composite_type_field (tib_type, "current_top_of_stack", void_ptr_type); append_composite_type_field (tib_type, "current_top_of_stack",
void_ptr_type);
/* uint32_t current_bottom_of_stack; %fs:0x0008 */ /* uint32_t current_bottom_of_stack; %fs:0x0008 */
append_composite_type_field (tib_type, "current_bottom_of_stack", append_composite_type_field (tib_type, "current_bottom_of_stack",
void_ptr_type); void_ptr_type);
@ -206,7 +210,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
/* uint32_t active_rpc_handle; %fs:0x0028 */ /* uint32_t active_rpc_handle; %fs:0x0028 */
append_composite_type_field (tib_type, "active_rpc_handle", dword_ptr_type); append_composite_type_field (tib_type, "active_rpc_handle", dword_ptr_type);
/* uint32_t thread_local_storage; %fs:0x002c */ /* uint32_t thread_local_storage; %fs:0x002c */
append_composite_type_field (tib_type, "thread_local_storage", void_ptr_type); append_composite_type_field (tib_type, "thread_local_storage",
void_ptr_type);
/* uint32_t process_environment_block; %fs:0x0030 */ /* uint32_t process_environment_block; %fs:0x0030 */
append_composite_type_field (tib_type, "process_environment_block", append_composite_type_field (tib_type, "process_environment_block",
peb_ptr_type); peb_ptr_type);
@ -320,8 +325,8 @@ display_one_tib (ptid_t ptid)
if (target_read (&current_target, TARGET_OBJECT_MEMORY, if (target_read (&current_target, TARGET_OBJECT_MEMORY,
NULL, tib, thread_local_base, tib_size) != tib_size) NULL, tib, thread_local_base, tib_size) != tib_size)
{ {
printf_filtered (_("Unable to read thread information block for %s at \ printf_filtered (_("Unable to read thread information "
address %s\n"), "block for %s at address %s\n"),
target_pid_to_str (ptid), target_pid_to_str (ptid),
paddress (target_gdbarch, thread_local_base)); paddress (target_gdbarch, thread_local_base));
return -1; return -1;
@ -397,8 +402,8 @@ static void
show_maint_show_all_tib (struct ui_file *file, int from_tty, show_maint_show_all_tib (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value) struct cmd_list_element *c, const char *value)
{ {
fprintf_filtered (file, _("Show all non-zero elements of Thread Information \ fprintf_filtered (file, _("Show all non-zero elements of "
Block is %s.\n"), value); "Thread Information Block is %s.\n"), value);
} }
static void static void

View file

@ -86,20 +86,20 @@ struct symloc
static enum language psymtab_language = language_unknown; static enum language psymtab_language = language_unknown;
/* Simplified internal version of coff symbol table information */ /* Simplified internal version of coff symbol table information. */
struct coff_symbol struct coff_symbol
{ {
char *c_name; char *c_name;
int c_symnum; /* symbol number of this entry */ int c_symnum; /* Symbol number of this entry. */
int c_naux; /* 0 if syment only, 1 if syment + auxent */ int c_naux; /* 0 if syment only, 1 if syment + auxent. */
long c_value; long c_value;
unsigned char c_sclass; unsigned char c_sclass;
int c_secnum; int c_secnum;
unsigned int c_type; unsigned int c_type;
}; };
/* last function's saved coff symbol `cs' */ /* Last function's saved coff symbol `cs'. */
static struct coff_symbol fcn_cs_saved; static struct coff_symbol fcn_cs_saved;
@ -116,7 +116,7 @@ static CORE_ADDR cur_src_end_addr;
static CORE_ADDR first_object_file_end; static CORE_ADDR first_object_file_end;
/* initial symbol-table-debug-string vector length */ /* Initial symbol-table-debug-string vector length. */
#define INITIAL_STABVECTOR_LENGTH 40 #define INITIAL_STABVECTOR_LENGTH 40
@ -133,8 +133,8 @@ static unsigned local_symesz;
struct coff_symfile_info struct coff_symfile_info
{ {
file_ptr min_lineno_offset; /* Where in file lowest line#s are */ file_ptr min_lineno_offset; /* Where in file lowest line#s are. */
file_ptr max_lineno_offset; /* 1+last byte of line#s in file */ file_ptr max_lineno_offset; /* 1+last byte of line#s in file. */
/* Pointer to the string table. */ /* Pointer to the string table. */
char *strtbl; char *strtbl;
@ -381,9 +381,10 @@ compare_lte (const void *lte1p, const void *lte2p)
return lte1->pc - lte2->pc; return lte1->pc - lte2->pc;
} }
/* Given a line table with function entries are marked, arrange its functions /* Given a line table with function entries are marked, arrange its
in ascending order and strip off function entry markers and return it in functions in ascending order and strip off function entry markers
a newly created table. If the old one is good enough, return the old one. */ and return it in a newly created table. If the old one is good
enough, return the old one. */
/* FIXME: I think all this stuff can be replaced by just passing /* FIXME: I think all this stuff can be replaced by just passing
sort_linevec = 1 to end_symtab. */ sort_linevec = 1 to end_symtab. */
@ -406,9 +407,9 @@ arrange_linetable (struct linetable *oldLineTb)
for (function_count = 0, ii = 0; ii < oldLineTb->nitems; ++ii) for (function_count = 0, ii = 0; ii < oldLineTb->nitems; ++ii)
{ {
if (oldLineTb->item[ii].line == 0) if (oldLineTb->item[ii].line == 0)
{ /* function entry found. */ { /* Function entry found. */
if (function_count >= fentry_size) if (function_count >= fentry_size)
{ /* make sure you have room. */ { /* Make sure you have room. */
fentry_size *= 2; fentry_size *= 2;
fentry = (struct linetable_entry *) fentry = (struct linetable_entry *)
xrealloc (fentry, xrealloc (fentry,
@ -429,13 +430,13 @@ arrange_linetable (struct linetable *oldLineTb)
qsort (fentry, function_count, qsort (fentry, function_count,
sizeof (struct linetable_entry), compare_lte); sizeof (struct linetable_entry), compare_lte);
/* allocate a new line table. */ /* Allocate a new line table. */
newLineTb = (struct linetable *) newLineTb = (struct linetable *)
xmalloc xmalloc
(sizeof (struct linetable) + (sizeof (struct linetable) +
(oldLineTb->nitems - function_count) * sizeof (struct linetable_entry)); (oldLineTb->nitems - function_count) * sizeof (struct linetable_entry));
/* if line table does not start with a function beginning, copy up until /* If line table does not start with a function beginning, copy up until
a function begin. */ a function begin. */
newline = 0; newline = 0;
@ -473,7 +474,7 @@ typedef struct _inclTable
int begin, end; int begin, end;
struct subfile *subfile; struct subfile *subfile;
unsigned funStartLine; /* start line # of its function */ unsigned funStartLine; /* Start line # of its function. */
} }
InclTable; InclTable;
@ -582,7 +583,8 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
memset (&main_subfile, '\0', sizeof (main_subfile)); memset (&main_subfile, '\0', sizeof (main_subfile));
if (inclIndx == 0) if (inclIndx == 0)
/* All source lines were in the main source file. None in include files. */ /* All source lines were in the main source file. None in include
files. */
enter_line_range (&main_subfile, offset, 0, start, end, enter_line_range (&main_subfile, offset, 0, start, end,
&main_source_baseline); &main_source_baseline);
@ -755,7 +757,7 @@ return_after_cleanup:
static void static void
aix_process_linenos (void) aix_process_linenos (void)
{ {
/* process line numbers and enter them into line vector */ /* Process line numbers and enter them into line vector. */
process_linenos (last_source_start_addr, cur_src_end_addr); process_linenos (last_source_start_addr, cur_src_end_addr);
} }
@ -937,7 +939,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
{ {
struct objfile *objfile = pst->objfile; struct objfile *objfile = pst->objfile;
bfd *abfd = objfile->obfd; bfd *abfd = objfile->obfd;
char *raw_auxptr; /* Pointer to first raw aux entry for sym */ char *raw_auxptr; /* Pointer to first raw aux entry for sym. */
char *strtbl = char *strtbl =
((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl; ((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl;
char *debugsec = char *debugsec =
@ -964,7 +966,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
char *filestring = " _start_ "; /* Name of the current file. */ char *filestring = " _start_ "; /* Name of the current file. */
char *last_csect_name; /* last seen csect's name and value */ char *last_csect_name; /* Last seen csect's name and value. */
CORE_ADDR last_csect_val; CORE_ADDR last_csect_val;
int last_csect_sec; int last_csect_sec;
@ -1076,7 +1078,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
start_symtab ("_globals_", (char *) NULL, (CORE_ADDR) 0); start_symtab ("_globals_", (char *) NULL, (CORE_ADDR) 0);
record_debugformat (debugfmt); record_debugformat (debugfmt);
cur_src_end_addr = first_object_file_end; cur_src_end_addr = first_object_file_end;
/* done with all files, everything from here on is globals */ /* Done with all files, everything from here on is globals. */
} }
if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT) if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT)
@ -1316,7 +1318,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
contains number of lines to '}' */ contains number of lines to '}' */
if (context_stack_depth <= 0) if (context_stack_depth <= 0)
{ /* We attempted to pop an empty context stack */ { /* We attempted to pop an empty context stack. */
ef_complaint (cs->c_symnum); ef_complaint (cs->c_symnum);
within_function = 0; within_function = 0;
break; break;
@ -1410,7 +1412,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
else if (strcmp (cs->c_name, ".eb") == 0) else if (strcmp (cs->c_name, ".eb") == 0)
{ {
if (context_stack_depth <= 0) if (context_stack_depth <= 0)
{ /* We attempted to pop an empty context stack */ { /* We attempted to pop an empty context stack. */
eb_complaint (cs->c_symnum); eb_complaint (cs->c_symnum);
break; break;
} }
@ -1717,7 +1719,7 @@ read_symbol_lineno (int symno)
return 0; return 0;
gotit: gotit:
/* take aux entry and return its lineno */ /* Take aux entry and return its lineno. */
symno++; symno++;
bfd_coff_swap_aux_in (objfile->obfd, stbl + symno * local_symesz, bfd_coff_swap_aux_in (objfile->obfd, stbl + symno * local_symesz,
symbol->n_type, symbol->n_sclass, symbol->n_type, symbol->n_sclass,
@ -1726,7 +1728,7 @@ gotit:
return main_aux->x_sym.x_misc.x_lnsz.x_lnno; return main_aux->x_sym.x_misc.x_lnsz.x_lnno;
} }
/* Support for line number handling */ /* Support for line number handling. */
/* This function is called for every section; it finds the outer limits /* This function is called for every section; it finds the outer limits
* of the line table (minimum and maximum file offset) so that the * of the line table (minimum and maximum file offset) so that the
@ -1775,7 +1777,7 @@ xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
return; return;
} }
/* Read in all partial symtabs on which this one is dependent */ /* Read in all partial symtabs on which this one is dependent. */
for (i = 0; i < pst->number_of_dependencies; i++) for (i = 0; i < pst->number_of_dependencies; i++)
if (!pst->dependencies[i]->readin) if (!pst->dependencies[i]->readin)
{ {
@ -1872,7 +1874,7 @@ xcoff_new_init (struct objfile *objfile)
static void static void
xcoff_symfile_init (struct objfile *objfile) xcoff_symfile_init (struct objfile *objfile)
{ {
/* Allocate struct to keep track of the symfile */ /* Allocate struct to keep track of the symfile. */
objfile->deprecated_sym_private objfile->deprecated_sym_private
= xmalloc (sizeof (struct coff_symfile_info)); = xmalloc (sizeof (struct coff_symfile_info));
@ -2172,12 +2174,12 @@ scan_xcoff_symtab (struct objfile *objfile)
/* Current partial symtab */ /* Current partial symtab */
struct partial_symtab *pst; struct partial_symtab *pst;
/* List of current psymtab's include files */ /* List of current psymtab's include files. */
char **psymtab_include_list; char **psymtab_include_list;
int includes_allocated; int includes_allocated;
int includes_used; int includes_used;
/* Index within current psymtab dependency list */ /* Index within current psymtab dependency list. */
struct partial_symtab **dependency_list; struct partial_symtab **dependency_list;
int dependencies_used, dependencies_allocated; int dependencies_used, dependencies_allocated;
@ -2186,10 +2188,10 @@ scan_xcoff_symtab (struct objfile *objfile)
union internal_auxent main_aux[5]; union internal_auxent main_aux[5];
unsigned int ssymnum; unsigned int ssymnum;
char *last_csect_name = NULL; /* last seen csect's name and value */ char *last_csect_name = NULL; /* Last seen csect's name and value. */
CORE_ADDR last_csect_val = 0; CORE_ADDR last_csect_val = 0;
int last_csect_sec = 0; int last_csect_sec = 0;
int misc_func_recorded = 0; /* true if any misc. function */ int misc_func_recorded = 0; /* true if any misc. function. */
int textlow_not_set = 1; int textlow_not_set = 1;
pst = (struct partial_symtab *) 0; pst = (struct partial_symtab *) 0;
@ -2546,7 +2548,7 @@ scan_xcoff_symtab (struct objfile *objfile)
case C_BINCL: case C_BINCL:
{ {
/* Mark down an include file in the current psymtab */ /* Mark down an include file in the current psymtab. */
enum language tmp_language; enum language tmp_language;
swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol, swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
@ -2884,9 +2886,10 @@ scan_xcoff_symtab (struct objfile *objfile)
dependencies_used, textlow_not_set); dependencies_used, textlow_not_set);
} }
/* Record the toc offset value of this symbol table into objfile structure. /* Record the toc offset value of this symbol table into objfile
If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain structure. If no XMC_TC0 is found, toc_offset should be zero.
this information would be file auxiliary header. */ Another place to obtain this information would be file auxiliary
header. */
((struct coff_symfile_info *) objfile->deprecated_sym_private)->toc_offset ((struct coff_symfile_info *) objfile->deprecated_sym_private)->toc_offset
= toc_offset; = toc_offset;
@ -2909,8 +2912,8 @@ xcoff_get_toc_offset (struct objfile *objfile)
hung off the objfile structure. hung off the objfile structure.
SECTION_OFFSETS contains offsets relative to which the symbols in the SECTION_OFFSETS contains offsets relative to which the symbols in the
various sections are (depending where the sections were actually loaded). various sections are (depending where the sections were actually
*/ loaded). */
static void static void
xcoff_initial_scan (struct objfile *objfile, int symfile_flags) xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
@ -2991,7 +2994,7 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
if (val != size) if (val != size)
perror_with_name (_("reading symbol table")); perror_with_name (_("reading symbol table"));
/* If we are reinitializing, or if we have never loaded syms yet, init */ /* If we are reinitializing, or if we have never loaded syms yet, init. */
if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0) if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
/* I'm not sure how how good num_symbols is; the rule of thumb in /* I'm not sure how how good num_symbols is; the rule of thumb in
init_psymbol_list was developed for a.out. On the one hand, init_psymbol_list was developed for a.out. On the one hand,

View file

@ -344,7 +344,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
cache->framesize += xstormy16_reg_size; cache->framesize += xstormy16_reg_size;
} }
/* optional stack allocation for args and local vars <= 4 byte */ /* Optional stack allocation for args and local vars <= 4 byte. */
else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */ else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */
{ {
cache->framesize += ((inst & 0x0030) >> 4) + 1; cache->framesize += ((inst & 0x0030) >> 4) + 1;
@ -356,7 +356,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
cache->framesize += (inst & 0x00f0) >> 4; cache->framesize += (inst & 0x00f0) >> 4;
} }
/* optional stack allocation for args and local vars >= 16 byte */ /* Optional stack allocation for args and local vars >= 16 byte. */
else if (inst == 0x314f && inst2 >= 0x0010) /* 314f HHHH add r15, #0xH */ else if (inst == 0x314f && inst2 >= 0x0010) /* 314f HHHH add r15, #0xH */
{ {
cache->framesize += inst2; cache->framesize += inst2;
@ -368,15 +368,16 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
cache->uses_fp = 1; cache->uses_fp = 1;
} }
/* optional copying of args in r2-r7 to r10-r13 */ /* optional copying of args in r2-r7 to r10-r13. */
/* Probably only in optimized case but legal action for prologue */ /* Probably only in optimized case but legal action for prologue. */
else if ((inst & 0xff00) == 0x4600 /* 46SD mov rD, rS */ else if ((inst & 0xff00) == 0x4600 /* 46SD mov rD, rS */
&& (inst & 0x00f0) >= 0x0020 && (inst & 0x00f0) <= 0x0070 && (inst & 0x00f0) >= 0x0020 && (inst & 0x00f0) <= 0x0070
&& (inst & 0x000f) >= 0x00a0 && (inst & 0x000f) <= 0x000d) && (inst & 0x000f) >= 0x00a0 && (inst & 0x000f) <= 0x000d)
; ;
/* optional copying of args in r2-r7 to stack */ /* Optional copying of args in r2-r7 to stack. */
/* 72DS HHHH mov.b (rD, 0xHHHH), r(S-8) (bit3 always 1, bit2-0 = reg) */ /* 72DS HHHH mov.b (rD, 0xHHHH), r(S-8)
(bit3 always 1, bit2-0 = reg) */
/* 73DS HHHH mov.w (rD, 0xHHHH), r(S-8) */ /* 73DS HHHH mov.w (rD, 0xHHHH), r(S-8) */
else if ((inst & 0xfed8) == 0x72d8 && (inst & 0x0007) >= 2) else if ((inst & 0xfed8) == 0x72d8 && (inst & 0x0007) >= 2)
{ {
@ -478,13 +479,15 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
while ((addr -= xstormy16_inst_size) >= func_addr) while ((addr -= xstormy16_inst_size) >= func_addr)
{ {
inst = read_memory_unsigned_integer (addr, inst = read_memory_unsigned_integer (addr,
xstormy16_inst_size, byte_order); xstormy16_inst_size,
byte_order);
if (inst >= 0x009a && inst <= 0x009d) /* pop r10...r13 */ if (inst >= 0x009a && inst <= 0x009d) /* pop r10...r13 */
continue; continue;
if (inst == 0x305f || inst == 0x307f) /* dec r15, #0x1/#0x3 */ if (inst == 0x305f || inst == 0x307f) /* dec r15, #0x1/#0x3 */
break; break;
inst2 = read_memory_unsigned_integer (addr - xstormy16_inst_size, inst2 = read_memory_unsigned_integer (addr - xstormy16_inst_size,
xstormy16_inst_size, byte_order); xstormy16_inst_size,
byte_order);
if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */ if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
{ {
addr -= xstormy16_inst_size; addr -= xstormy16_inst_size;
@ -575,9 +578,11 @@ xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
if (target_read_memory (addr, buf, sizeof buf)) if (target_read_memory (addr, buf, sizeof buf))
return 0; return 0;
inst = extract_unsigned_integer (buf, inst = extract_unsigned_integer (buf,
xstormy16_inst_size, byte_order); xstormy16_inst_size,
byte_order);
inst2 = extract_unsigned_integer (buf + xstormy16_inst_size, inst2 = extract_unsigned_integer (buf + xstormy16_inst_size,
xstormy16_inst_size, byte_order); xstormy16_inst_size,
byte_order);
faddr2 = inst2 << 8 | (inst & 0xff); faddr2 = inst2 << 8 | (inst & 0xff);
if (faddr == faddr2) if (faddr == faddr2)
return addr; return addr;
@ -851,7 +856,8 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
Initializer function for the Sanyo Xstormy16a module. Initializer function for the Sanyo Xstormy16a module.
Called by gdb at start-up. */ Called by gdb at start-up. */
extern initialize_file_ftype _initialize_xstormy16_tdep; /* -Wmissing-prototypes */ /* -Wmissing-prototypes */
extern initialize_file_ftype _initialize_xstormy16_tdep;
void void
_initialize_xstormy16_tdep (void) _initialize_xstormy16_tdep (void)

View file

@ -116,7 +116,8 @@ static int xtensa_debug_level = 0;
#define PS_WOE (1<<18) #define PS_WOE (1<<18)
#define PS_EXC (1<<4) #define PS_EXC (1<<4)
/* Convert a live A-register number to the corresponding AR-register number. */ /* Convert a live A-register number to the corresponding AR-register
number. */
static int static int
arreg_number (struct gdbarch *gdbarch, int a_regnum, ULONGEST wb) arreg_number (struct gdbarch *gdbarch, int a_regnum, ULONGEST wb)
{ {
@ -890,10 +891,11 @@ typedef struct xtensa_windowed_frame_cache
{ {
int wb; /* WINDOWBASE of the previous frame. */ int wb; /* WINDOWBASE of the previous frame. */
int callsize; /* Call size of this frame. */ int callsize; /* Call size of this frame. */
int ws; /* WINDOWSTART of the previous frame. It keeps track of int ws; /* WINDOWSTART of the previous frame. It
life windows only. If there is no bit set for the keeps track of life windows only. If there
window, that means it had been already spilled is no bit set for the window, that means it
because of window overflow. */ had been already spilled because of window
overflow. */
/* Spilled A-registers from the previous frame. /* Spilled A-registers from the previous frame.
AREGS[i] == -1, if corresponding AR is alive. */ AREGS[i] == -1, if corresponding AR is alive. */
@ -902,7 +904,8 @@ typedef struct xtensa_windowed_frame_cache
/* Call0 ABI Definitions. */ /* Call0 ABI Definitions. */
#define C0_MAXOPDS 3 /* Maximum number of operands for prologue analysis. */ #define C0_MAXOPDS 3 /* Maximum number of operands for prologue
analysis. */
#define C0_NREGS 16 /* Number of A-registers to track. */ #define C0_NREGS 16 /* Number of A-registers to track. */
#define C0_CLESV 12 /* Callee-saved registers are here and up. */ #define C0_CLESV 12 /* Callee-saved registers are here and up. */
#define C0_SP 1 /* Register used as SP. */ #define C0_SP 1 /* Register used as SP. */
@ -929,8 +932,9 @@ typedef struct xtensa_c0reg
int fr_reg; /* original register from which register content int fr_reg; /* original register from which register content
is derived, or C0_CONST, or C0_INEXP. */ is derived, or C0_CONST, or C0_INEXP. */
int fr_ofs; /* constant offset from reg, or immediate value. */ int fr_ofs; /* constant offset from reg, or immediate value. */
int to_stk; /* offset from original SP to register (4-byte aligned), int to_stk; /* offset from original SP to register (4-byte
or C0_NOSTK if register has not been saved. */ aligned), or C0_NOSTK if register has not
been saved. */
} xtensa_c0reg_t; } xtensa_c0reg_t;
@ -938,7 +942,8 @@ typedef struct xtensa_c0reg
typedef struct xtensa_call0_frame_cache typedef struct xtensa_call0_frame_cache
{ {
int c0_frmsz; /* Stack frame size. */ int c0_frmsz; /* Stack frame size. */
int c0_hasfp; /* Current frame uses frame pointer. */ int c0_hasfp; /* Current frame uses frame
pointer. */
int fp_regnum; /* A-register used as FP. */ int fp_regnum; /* A-register used as FP. */
int c0_fp; /* Actual value of frame pointer. */ int c0_fp; /* Actual value of frame pointer. */
xtensa_c0reg_t c0_rt[C0_NREGS]; /* Register tracking information. */ xtensa_c0reg_t c0_rt[C0_NREGS]; /* Register tracking information. */
@ -1132,7 +1137,8 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
&register_operand) != 0) &register_operand) != 0)
RETURN_FP; RETURN_FP;
fp_regnum = gdbarch_tdep (gdbarch)->a0_base + register_operand; fp_regnum
= gdbarch_tdep (gdbarch)->a0_base + register_operand;
RETURN_FP; RETURN_FP;
} }
} }
@ -1166,8 +1172,7 @@ done:
cache->base = SP (or best guess about FP) of this frame; cache->base = SP (or best guess about FP) of this frame;
cache->pc = entry-PC (entry point of the frame function); cache->pc = entry-PC (entry point of the frame function);
cache->prev_sp = SP of the previous frame. cache->prev_sp = SP of the previous frame. */
*/
static void static void
call0_frame_cache (struct frame_info *this_frame, call0_frame_cache (struct frame_info *this_frame,
@ -1278,8 +1283,9 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
} }
if ((cache->prev_sp == 0) && ( ra != 0 )) if ((cache->prev_sp == 0) && ( ra != 0 ))
/* If RA is equal to 0 this frame is an outermost frame. Leave /* If RA is equal to 0 this frame is an outermost frame.
cache->prev_sp unchanged marking the boundary of the frame stack. */ Leave cache->prev_sp unchanged marking the boundary of the
frame stack. */
{ {
if ((cache->wd.ws & (1 << cache->wd.wb)) == 0) if ((cache->wd.ws & (1 << cache->wd.wb)) == 0)
{ {
@ -1296,7 +1302,8 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
(gdbarch, gdbarch_tdep (gdbarch)->a0_base + 1, (gdbarch, gdbarch_tdep (gdbarch)->a0_base + 1,
cache->wd.wb); cache->wd.wb);
cache->prev_sp = get_frame_register_unsigned (this_frame, regnum); cache->prev_sp = get_frame_register_unsigned (this_frame,
regnum);
} }
} }
} }
@ -1406,7 +1413,8 @@ xtensa_frame_prev_register (struct frame_info *this_frame,
spe = cache->c0.c0_fp spe = cache->c0.c0_fp
- cache->c0.c0_rt[cache->c0.fp_regnum].fr_ofs; - cache->c0.c0_rt[cache->c0.fp_regnum].fr_ofs;
return frame_unwind_got_memory (this_frame, regnum, spe + stkofs); return frame_unwind_got_memory (this_frame, regnum,
spe + stkofs);
} }
} }
} }
@ -1472,7 +1480,8 @@ xtensa_extract_return_value (struct type *type,
/* On Xtensa, we can return up to 4 words (or 2 for call12). */ /* On Xtensa, we can return up to 4 words (or 2 for call12). */
if (len > (callsize > 8 ? 8 : 16)) if (len > (callsize > 8 ? 8 : 16))
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
_("cannot extract return value of %d bytes long"), len); _("cannot extract return value of %d bytes long"),
len);
/* Get the register offset of the return /* Get the register offset of the return
register (A2) in the caller window. */ register (A2) in the caller window. */
@ -1612,8 +1621,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
int align; /* alignment */ int align; /* alignment */
union union
{ {
int offset; /* stack offset if on stack */ int offset; /* stack offset if on stack. */
int regno; /* regno if in register */ int regno; /* regno if in register. */
} u; } u;
}; };
@ -1912,7 +1921,8 @@ typedef enum {
c0opc_mov, /* Moving a register to a register. */ c0opc_mov, /* Moving a register to a register. */
c0opc_movi, /* Moving an immediate to a register. */ c0opc_movi, /* Moving an immediate to a register. */
c0opc_l32r, /* Loading a literal. */ c0opc_l32r, /* Loading a literal. */
c0opc_s32i, /* Storing word at fixed offset from a base register. */ c0opc_s32i, /* Storing word at fixed offset from a base
register. */
c0opc_NrOf /* Number of opcode classifications. */ c0opc_NrOf /* Number of opcode classifications. */
} xtensa_insn_kind; } xtensa_insn_kind;
@ -2216,7 +2226,8 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
goto done; goto done;
opc = xtensa_opcode_decode (isa, ifmt, is, slot); opc = xtensa_opcode_decode (isa, ifmt, is, slot);
DEBUGVERB ("[call0_analyze_prologue] instr addr = 0x%08x, opc = %d\n", DEBUGVERB ("[call0_analyze_prologue] instr "
"addr = 0x%08x, opc = %d\n",
(unsigned)ia, opc); (unsigned)ia, opc);
if (opc == XTENSA_UNDEFINED) if (opc == XTENSA_UNDEFINED)
opclass = c0opc_illegal; opclass = c0opc_illegal;
@ -2302,7 +2313,8 @@ done:
static void static void
call0_frame_cache (struct frame_info *this_frame, call0_frame_cache (struct frame_info *this_frame,
xtensa_frame_cache_t *cache, CORE_ADDR pc, CORE_ADDR litbase) xtensa_frame_cache_t *cache,
CORE_ADDR pc, CORE_ADDR litbase)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@ -2382,21 +2394,23 @@ analysis failed in this frame. GDB command execution stopped."));
else if (cache->c0.c0_rt[C0_RA].fr_reg == C0_CONST else if (cache->c0.c0_rt[C0_RA].fr_reg == C0_CONST
&& cache->c0.c0_rt[C0_RA].fr_ofs == 0) && cache->c0.c0_rt[C0_RA].fr_ofs == 0)
{ {
/* Special case for terminating backtrace at a function that wants to /* Special case for terminating backtrace at a function that
be seen as the outermost. Such a function will clear it's RA (A0) wants to be seen as the outermost. Such a function will
register to 0 in the prologue instead of saving its original value. */ clear it's RA (A0) register to 0 in the prologue instead of
saving its original value. */
ra = 0; ra = 0;
} }
else else
{ {
/* RA was copied to another register or (before any function call) may /* RA was copied to another register or (before any function
still be in the original RA register. This is not always reliable: call) may still be in the original RA register. This is not
even in a leaf function, register tracking stops after prologue, and always reliable: even in a leaf function, register tracking
even in prologue, non-prologue instructions (not tracked) may overwrite stops after prologue, and even in prologue, non-prologue
RA or any register it was copied to. If likely in prologue or before instructions (not tracked) may overwrite RA or any register
any call, use retracking info and hope for the best (compiler should it was copied to. If likely in prologue or before any call,
have saved RA in stack if not in a leaf function). If not in prologue, use retracking info and hope for the best (compiler should
too bad. */ have saved RA in stack if not in a leaf function). If not in
prologue, too bad. */
int i; int i;
for (i = 0; for (i = 0;
@ -2667,7 +2681,7 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_name (gdbarch, xtensa_register_name); set_gdbarch_register_name (gdbarch, xtensa_register_name);
set_gdbarch_register_type (gdbarch, xtensa_register_type); set_gdbarch_register_type (gdbarch, xtensa_register_type);
/* To call functions from GDB using dummy frame */ /* To call functions from GDB using dummy frame. */
set_gdbarch_push_dummy_call (gdbarch, xtensa_push_dummy_call); set_gdbarch_push_dummy_call (gdbarch, xtensa_push_dummy_call);
set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_believe_pcc_promotion (gdbarch, 1);
@ -2736,9 +2750,9 @@ _initialize_xtensa_tdep (void)
add_setshow_zinteger_cmd ("xtensa", add_setshow_zinteger_cmd ("xtensa",
class_maintenance, class_maintenance,
&xtensa_debug_level, _("\ &xtensa_debug_level,
Set Xtensa debugging."), _("\ _("Set Xtensa debugging."),
Show Xtensa debugging."), _("\ _("Show Xtensa debugging."), _("\
When non-zero, Xtensa-specific debugging is enabled. \ When non-zero, Xtensa-specific debugging is enabled. \
Can be 1, 2, 3, or 4 indicating the level of debugging."), Can be 1, 2, 3, or 4 indicating the level of debugging."),
NULL, NULL,

View file

@ -145,7 +145,7 @@ typedef struct
/* For xtensa-config.c to expand to the structure above. */ /* For xtensa-config.c to expand to the structure above. */
#define XTREG(index,ofs,bsz,sz,al,tnum,flg,cp,ty,gr,name,fet,sto,mas,ct,x,y) \ #define XTREG(index,ofs,bsz,sz,al,tnum,flg,cp,ty,gr,name,fet,sto,mas,ct,x,y) \
{#name, ofs, ty, ((gr)|((xtRegisterGroupNCP>>2)<<(cp+2))), \ {#name, ofs, ty, ((gr) | ((xtRegisterGroupNCP >> 2) << (cp + 2))), \
ct, bsz, sz, al, tnum, flg, cp, mas, fet, sto}, ct, bsz, sz, al, tnum, flg, cp, mas, fet, sto},
#define XTREG_END {0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0}, #define XTREG_END {0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0},