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:
parent
d2a0f03272
commit
581e13c188
27 changed files with 811 additions and 726 deletions
|
@ -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.
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
/* Implement the ``struct ui_file'' object. */
|
/* Implement the ``struct ui_file'' object. */
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "ui-file.h"
|
#include "ui-file.h"
|
||||||
|
@ -108,8 +108,8 @@ null_file_write (struct ui_file *file,
|
||||||
long sizeof_buf)
|
long sizeof_buf)
|
||||||
{
|
{
|
||||||
if (file->to_fputs == null_file_fputs)
|
if (file->to_fputs == null_file_fputs)
|
||||||
/* Both the write and fputs methods are null. Discard the
|
/* Both the write and fputs methods are null. Discard the
|
||||||
request. */
|
request. */
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -144,12 +144,12 @@ static void
|
||||||
null_file_fputs (const char *buf, struct ui_file *file)
|
null_file_fputs (const char *buf, struct ui_file *file)
|
||||||
{
|
{
|
||||||
if (file->to_write == null_file_write)
|
if (file->to_write == null_file_write)
|
||||||
/* Both the write and fputs methods are null. Discard the
|
/* Both the write and fputs methods are null. Discard the
|
||||||
request. */
|
request. */
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The write method was implemented, use that. */
|
/* The write method was implemented, use that. */
|
||||||
file->to_write (file, buf, strlen (buf));
|
file->to_write (file, buf, strlen (buf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ set_ui_file_data (struct ui_file *file, void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ui_file utility function for converting a ``struct ui_file'' into
|
/* ui_file utility function for converting a ``struct ui_file'' into
|
||||||
a memory buffer. */
|
a memory buffer. */
|
||||||
|
|
||||||
struct accumulated_ui_file
|
struct accumulated_ui_file
|
||||||
{
|
{
|
||||||
|
@ -323,8 +323,8 @@ ui_file_obsavestring (struct ui_file *file, struct obstack *obstack,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A pure memory based ``struct ui_file'' that can be used an output
|
/* A pure memory based ``struct ui_file'' that can be used an output
|
||||||
buffer. The buffers accumulated contents are available via
|
buffer. The buffers accumulated contents are available via
|
||||||
ui_file_put(). */
|
ui_file_put(). */
|
||||||
|
|
||||||
struct mem_file
|
struct mem_file
|
||||||
{
|
{
|
||||||
|
@ -434,7 +434,7 @@ mem_file_write (struct ui_file *file,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ``struct ui_file'' implementation that maps directly onto
|
/* ``struct ui_file'' implementation that maps directly onto
|
||||||
<stdio.h>'s FILE. */
|
<stdio.h>'s FILE. */
|
||||||
|
|
||||||
static ui_file_write_ftype stdio_file_write;
|
static ui_file_write_ftype stdio_file_write;
|
||||||
static ui_file_fputs_ftype stdio_file_fputs;
|
static ui_file_fputs_ftype stdio_file_fputs;
|
||||||
|
@ -559,7 +559,7 @@ stdio_file_isatty (struct ui_file *file)
|
||||||
return (isatty (fileno (stdio->file)));
|
return (isatty (fileno (stdio->file)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Like fdopen(). Create a ui_file from a previously opened FILE. */
|
/* Like fdopen(). Create a ui_file from a previously opened FILE. */
|
||||||
|
|
||||||
struct ui_file *
|
struct ui_file *
|
||||||
stdio_fileopen (FILE *file)
|
stdio_fileopen (FILE *file)
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
struct obstack;
|
struct obstack;
|
||||||
struct ui_file;
|
struct ui_file;
|
||||||
|
|
||||||
/* Create a generic ui_file object with null methods. */
|
/* Create a generic ui_file object with null methods. */
|
||||||
|
|
||||||
extern struct ui_file *ui_file_new (void);
|
extern struct ui_file *ui_file_new (void);
|
||||||
|
|
||||||
/* Override methods used by specific implementations of a UI_FILE
|
/* Override methods used by specific implementations of a UI_FILE
|
||||||
object. */
|
object. */
|
||||||
|
|
||||||
typedef void (ui_file_flush_ftype) (struct ui_file *stream);
|
typedef void (ui_file_flush_ftype) (struct ui_file *stream);
|
||||||
extern void set_ui_file_flush (struct ui_file *stream,
|
extern void set_ui_file_flush (struct ui_file *stream,
|
||||||
ui_file_flush_ftype *flush);
|
ui_file_flush_ftype *flush);
|
||||||
|
|
||||||
/* NOTE: Both fputs and write methods are available. Default
|
/* NOTE: Both fputs and write methods are available. Default
|
||||||
implementations that mapping one onto the other are included. */
|
implementations that mapping one onto the other are included. */
|
||||||
typedef void (ui_file_write_ftype) (struct ui_file *stream,
|
typedef void (ui_file_write_ftype) (struct ui_file *stream,
|
||||||
const char *buf, long length_buf);
|
const char *buf, long length_buf);
|
||||||
extern void set_ui_file_write (struct ui_file *stream,
|
extern void set_ui_file_write (struct ui_file *stream,
|
||||||
|
@ -83,14 +83,14 @@ 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);
|
||||||
|
|
||||||
/* Returns a freshly allocated buffer containing the entire contents
|
/* Returns a freshly allocated buffer containing the entire contents
|
||||||
of FILE (as determined by ui_file_put()) with a NUL character
|
of FILE (as determined by ui_file_put()) with a NUL character
|
||||||
appended. LENGTH, if not NULL, is set to the size of the buffer
|
appended. LENGTH, if not NULL, is set to the size of the buffer
|
||||||
minus that appended NUL. */
|
minus that appended NUL. */
|
||||||
extern char *ui_file_xstrdup (struct ui_file *file, long *length);
|
extern char *ui_file_xstrdup (struct ui_file *file, long *length);
|
||||||
|
|
||||||
/* Similar to ui_file_xstrdup, but return a new string allocated on
|
/* Similar to ui_file_xstrdup, but return a new string allocated on
|
||||||
|
@ -100,16 +100,16 @@ extern char *ui_file_obsavestring (struct ui_file *file,
|
||||||
|
|
||||||
extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
|
extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
|
||||||
|
|
||||||
/* Create/open a memory based file. Can be used as a scratch buffer
|
/* Create/open a memory based file. Can be used as a scratch buffer
|
||||||
for collecting output. */
|
for collecting output. */
|
||||||
extern struct ui_file *mem_fileopen (void);
|
extern struct ui_file *mem_fileopen (void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Open/create a an STDIO based UI_FILE using the already open FILE. */
|
/* Open/create a an STDIO based UI_FILE using the already open FILE. */
|
||||||
extern struct ui_file *stdio_fileopen (FILE *file);
|
extern struct ui_file *stdio_fileopen (FILE *file);
|
||||||
|
|
||||||
/* Open NAME returning an STDIO based UI_FILE. */
|
/* Open NAME returning an STDIO based UI_FILE. */
|
||||||
extern struct ui_file *gdb_fopen (char *name, char *mode);
|
extern struct ui_file *gdb_fopen (char *name, char *mode);
|
||||||
|
|
||||||
/* Create a file which writes to both ONE and TWO. CLOSE_ONE
|
/* Create a file which writes to both ONE and TWO. CLOSE_ONE
|
||||||
|
|
60
gdb/ui-out.c
60
gdb/ui-out.c
|
@ -42,15 +42,15 @@ struct ui_out_hdr
|
||||||
|
|
||||||
/* Maintain a stack so that the info applicable to the inner most list
|
/* Maintain a stack so that the info applicable to the inner most list
|
||||||
is always available. Stack/nested level 0 is reserved for the
|
is always available. Stack/nested level 0 is reserved for the
|
||||||
top-level result. */
|
top-level result. */
|
||||||
|
|
||||||
enum { MAX_UI_OUT_LEVELS = 8 };
|
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;
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ struct ui_out
|
||||||
struct ui_out_table table;
|
struct ui_out_table table;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The current (inner most) level. */
|
/* The current (inner most) level. */
|
||||||
static struct ui_out_level *
|
static struct ui_out_level *
|
||||||
current_level (struct ui_out *uiout)
|
current_level (struct ui_out *uiout)
|
||||||
{
|
{
|
||||||
return &uiout->levels[uiout->level];
|
return &uiout->levels[uiout->level];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new level, of TYPE. Return the new level's index. */
|
/* Create a new level, of TYPE. Return the new level's index. */
|
||||||
static int
|
static int
|
||||||
push_level (struct ui_out *uiout,
|
push_level (struct ui_out *uiout,
|
||||||
enum ui_out_type type,
|
enum ui_out_type type,
|
||||||
|
@ -125,7 +125,7 @@ push_level (struct ui_out *uiout,
|
||||||
{
|
{
|
||||||
struct ui_out_level *current;
|
struct ui_out_level *current;
|
||||||
|
|
||||||
/* We had better not overflow the buffer. */
|
/* We had better not overflow the buffer. */
|
||||||
uiout->level++;
|
uiout->level++;
|
||||||
gdb_assert (uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS);
|
gdb_assert (uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS);
|
||||||
current = current_level (uiout);
|
current = current_level (uiout);
|
||||||
|
@ -135,12 +135,12 @@ push_level (struct ui_out *uiout,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Discard the current level, return the discarded level's index.
|
/* Discard the current level, return the discarded level's index.
|
||||||
TYPE is the type of the level being discarded. */
|
TYPE is the type of the level being discarded. */
|
||||||
static int
|
static int
|
||||||
pop_level (struct ui_out *uiout,
|
pop_level (struct ui_out *uiout,
|
||||||
enum ui_out_type type)
|
enum ui_out_type type)
|
||||||
{
|
{
|
||||||
/* We had better not underflow the buffer. */
|
/* We had better not underflow the buffer. */
|
||||||
gdb_assert (uiout->level > 0 && uiout->level < MAX_UI_OUT_LEVELS);
|
gdb_assert (uiout->level > 0 && uiout->level < MAX_UI_OUT_LEVELS);
|
||||||
gdb_assert (current_level (uiout)->type == type);
|
gdb_assert (current_level (uiout)->type == type);
|
||||||
uiout->level--;
|
uiout->level--;
|
||||||
|
@ -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)
|
||||||
|
|
20
gdb/ui-out.h
20
gdb/ui-out.h
|
@ -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 */
|
||||||
|
@ -52,7 +52,7 @@ enum ui_flags
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* The ui_out stream structure. */
|
/* The ui_out stream structure. */
|
||||||
/* NOTE: cagney/2000-02-01: The ui_stream object can be subsumed by
|
/* NOTE: cagney/2000-02-01: The ui_stream object can be subsumed by
|
||||||
the more generic ui_file object. */
|
the more generic ui_file object. */
|
||||||
|
|
||||||
|
@ -63,10 +63,10 @@ struct ui_stream
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes for ui-out API. */
|
/* Prototypes for ui-out API. */
|
||||||
|
|
||||||
/* A result is a recursive data structure consisting of lists and
|
/* A result is a recursive data structure consisting of lists and
|
||||||
tuples. */
|
tuples. */
|
||||||
|
|
||||||
enum ui_out_type
|
enum ui_out_type
|
||||||
{
|
{
|
||||||
|
@ -86,8 +86,8 @@ extern struct cleanup *ui_out_begin_cleanup_end (struct ui_out *uiout,
|
||||||
|
|
||||||
/* A table can be considered a special tuple/list combination with the
|
/* A table can be considered a special tuple/list combination with the
|
||||||
implied structure: ``table = { hdr = { header, ... } , body = [ {
|
implied structure: ``table = { hdr = { header, ... } , body = [ {
|
||||||
field, ... }, ... ] }''. If NR_ROWS is negative then there is at
|
field, ... }, ... ] }''. If NR_ROWS is negative then there is at
|
||||||
least one row. */
|
least one row. */
|
||||||
extern void ui_out_table_header (struct ui_out *uiout, int width,
|
extern void ui_out_table_header (struct ui_out *uiout, int width,
|
||||||
enum ui_align align, const char *col_name,
|
enum ui_align align, const char *col_name,
|
||||||
const char *colhdr);
|
const char *colhdr);
|
||||||
|
@ -189,11 +189,11 @@ 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 */
|
||||||
|
|
||||||
/* Type definition of all implementation functions. */
|
/* Type definition of all implementation functions. */
|
||||||
|
|
||||||
typedef void (table_begin_ftype) (struct ui_out * uiout,
|
typedef void (table_begin_ftype) (struct ui_out * uiout,
|
||||||
int nbrofcols, int nr_rows,
|
int nbrofcols, int nr_rows,
|
||||||
|
@ -204,7 +204,7 @@ typedef void (table_header_ftype) (struct ui_out * uiout, int width,
|
||||||
enum ui_align align, const char *col_name,
|
enum ui_align align, const char *col_name,
|
||||||
const char *colhdr);
|
const char *colhdr);
|
||||||
/* Note: level 0 is the top-level so LEVEL is always greater than
|
/* Note: level 0 is the top-level so LEVEL is always greater than
|
||||||
zero. */
|
zero. */
|
||||||
typedef void (ui_out_begin_ftype) (struct ui_out *uiout,
|
typedef void (ui_out_begin_ftype) (struct ui_out *uiout,
|
||||||
enum ui_out_type type,
|
enum ui_out_type type,
|
||||||
int level, const char *id);
|
int level, const char *id);
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
82
gdb/utils.c
82
gdb/utils.c
|
@ -38,7 +38,7 @@
|
||||||
#include <pc.h>
|
#include <pc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SunOS's curses.h has a '#define reg register' in it. Thank you Sun. */
|
/* SunOS's curses.h has a '#define reg register' in it. Thank you Sun. */
|
||||||
#ifdef reg
|
#ifdef reg
|
||||||
#undef reg
|
#undef reg
|
||||||
#endif
|
#endif
|
||||||
|
@ -113,7 +113,7 @@ static int debug_timestamp = 0;
|
||||||
static struct cleanup *cleanup_chain; /* cleaned up after a failed command */
|
static struct cleanup *cleanup_chain; /* cleaned up after a failed command */
|
||||||
static struct cleanup *final_cleanup_chain; /* cleaned up when gdb exits */
|
static struct cleanup *final_cleanup_chain; /* cleaned up when gdb exits */
|
||||||
|
|
||||||
/* Nonzero if we have job control. */
|
/* Nonzero if we have job control. */
|
||||||
|
|
||||||
int job_control;
|
int job_control;
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ free_current_contents (void *ptr)
|
||||||
use the cleanup chain for handling normal cleanups as well as dealing
|
use the cleanup chain for handling normal cleanups as well as dealing
|
||||||
with cleanups that need to be done as a result of a call to error().
|
with cleanups that need to be done as a result of a call to error().
|
||||||
In such cases, we may not be certain where the first cleanup is, unless
|
In such cases, we may not be certain where the first cleanup is, unless
|
||||||
we have a do-nothing one to always use as the base. */
|
we have a do-nothing one to always use as the base. */
|
||||||
|
|
||||||
void
|
void
|
||||||
null_cleanup (void *arg)
|
null_cleanup (void *arg)
|
||||||
|
@ -629,8 +629,8 @@ set_display_space (int new_value)
|
||||||
|
|
||||||
/* As indicated by display_time and display_space, report GDB's elapsed time
|
/* As indicated by display_time and display_space, report GDB's elapsed time
|
||||||
and space usage from the base time and space provided in ARG, which
|
and space usage from the base time and space provided in ARG, which
|
||||||
must be a pointer to a struct cmd_stat. This function is intended
|
must be a pointer to a struct cmd_stat. This function is intended
|
||||||
to be called as a cleanup. */
|
to be called as a cleanup. */
|
||||||
static void
|
static void
|
||||||
report_command_stats (void *arg)
|
report_command_stats (void *arg)
|
||||||
{
|
{
|
||||||
|
@ -889,13 +889,13 @@ add_intermediate_continuation (struct thread_info *thread,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Walk down the cmd_continuation list, and execute all the
|
/* Walk down the cmd_continuation list, and execute all the
|
||||||
continuations. There is a problem though. In some cases new
|
continuations. There is a problem though. In some cases new
|
||||||
continuations may be added while we are in the middle of this
|
continuations may be added while we are in the middle of this
|
||||||
loop. If this happens they will be added in the front, and done
|
loop. If this happens they will be added in the front, and done
|
||||||
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);
|
||||||
|
@ -1092,7 +1092,7 @@ static const char *internal_problem_modes[] =
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Print a message reporting an internal error/warning. Ask the user
|
/* Print a message reporting an internal error/warning. Ask the user
|
||||||
if they want to continue, dump core, or just exit. Return
|
if they want to continue, dump core, or just exit. Return
|
||||||
something to indicate a quit. */
|
something to indicate a quit. */
|
||||||
|
|
||||||
|
@ -1385,7 +1385,7 @@ perror_with_name (const char *string)
|
||||||
|
|
||||||
/* I understand setting these is a matter of taste. Still, some people
|
/* I understand setting these is a matter of taste. Still, some people
|
||||||
may clear errno but not know about bfd_error. Doing this here is not
|
may clear errno but not know about bfd_error. Doing this here is not
|
||||||
unreasonable. */
|
unreasonable. */
|
||||||
bfd_set_error (bfd_error_no_error);
|
bfd_set_error (bfd_error_no_error);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
|
@ -1435,7 +1435,7 @@ quit (void)
|
||||||
|
|
||||||
|
|
||||||
/* Called when a memory allocation fails, with the number of bytes of
|
/* Called when a memory allocation fails, with the number of bytes of
|
||||||
memory requested in SIZE. */
|
memory requested in SIZE. */
|
||||||
|
|
||||||
void
|
void
|
||||||
nomem (long size)
|
nomem (long size)
|
||||||
|
@ -1533,7 +1533,7 @@ xfree (void *ptr)
|
||||||
|
|
||||||
|
|
||||||
/* Like asprintf/vasprintf but get an internal_error if the call
|
/* Like asprintf/vasprintf but get an internal_error if the call
|
||||||
fails. */
|
fails. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrprintf (const char *format, ...)
|
xstrprintf (const char *format, ...)
|
||||||
|
@ -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)
|
||||||
|
@ -1973,7 +1973,7 @@ parse_escape (struct gdbarch *gdbarch, char **string_ptr)
|
||||||
/* Print the character C on STREAM as part of the contents of a literal
|
/* Print the character C on STREAM as part of the contents of a literal
|
||||||
string whose delimiter is QUOTER. Note that this routine should only
|
string whose delimiter is QUOTER. Note that this routine should only
|
||||||
be call for printing things which are independent of the language
|
be call for printing things which are independent of the language
|
||||||
of the program being debugged. */
|
of the program being debugged. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
|
printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
|
||||||
|
@ -2025,7 +2025,7 @@ printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
|
||||||
/* Print the character C on STREAM as part of the contents of a
|
/* Print the character C on STREAM as part of the contents of a
|
||||||
literal string whose delimiter is QUOTER. Note that these routines
|
literal string whose delimiter is QUOTER. Note that these routines
|
||||||
should only be call for printing things which are independent of
|
should only be call for printing things which are independent of
|
||||||
the language of the program being debugged. */
|
the language of the program being debugged. */
|
||||||
|
|
||||||
void
|
void
|
||||||
fputstr_filtered (const char *str, int quoter, struct ui_file *stream)
|
fputstr_filtered (const char *str, int quoter, struct ui_file *stream)
|
||||||
|
@ -2310,7 +2310,7 @@ prompt_for_continue (void)
|
||||||
need to save the ---Type <return>--- line at the top of the screen. */
|
need to save the ---Type <return>--- line at the top of the screen. */
|
||||||
reinitialize_more_filter ();
|
reinitialize_more_filter ();
|
||||||
|
|
||||||
dont_repeat (); /* Forget prev cmd -- CR won't repeat it. */
|
dont_repeat (); /* Forget prev cmd -- CR won't repeat it. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reinitialize filter; ie. tell it to reset to original values. */
|
/* Reinitialize filter; ie. tell it to reset to original values. */
|
||||||
|
@ -2323,7 +2323,7 @@ reinitialize_more_filter (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indicate that if the next sequence of characters overflows the line,
|
/* Indicate that if the next sequence of characters overflows the line,
|
||||||
a newline should be inserted here rather than when it hits the end.
|
a newline should be inserted here rather than when it hits the end.
|
||||||
If INDENT is non-null, it is a string to be printed to indent the
|
If INDENT is non-null, it is a string to be printed to indent the
|
||||||
wrapped part on the next line. INDENT must remain accessible until
|
wrapped part on the next line. INDENT must remain accessible until
|
||||||
the next call to wrap_here() or until a newline is printed through
|
the next call to wrap_here() or until a newline is printed through
|
||||||
|
@ -2346,7 +2346,7 @@ reinitialize_more_filter (void)
|
||||||
void
|
void
|
||||||
wrap_here (char *indent)
|
wrap_here (char *indent)
|
||||||
{
|
{
|
||||||
/* This should have been allocated, but be paranoid anyway. */
|
/* This should have been allocated, but be paranoid anyway. */
|
||||||
if (!wrap_buffer)
|
if (!wrap_buffer)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
_("failed internal consistency check"));
|
_("failed internal consistency check"));
|
||||||
|
@ -2380,11 +2380,11 @@ wrap_here (char *indent)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print input string to gdb_stdout, filtered, with wrap,
|
/* Print input string to gdb_stdout, filtered, with wrap,
|
||||||
arranging strings in columns of n chars. String can be
|
arranging strings in columns of n chars. String can be
|
||||||
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,9 +2425,9 @@ 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. */
|
||||||
|
|
||||||
void
|
void
|
||||||
begin_line (void)
|
begin_line (void)
|
||||||
|
@ -2525,16 +2525,16 @@ 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
|
||||||
longer than (the user settable) chars_per_line.
|
longer than (the user settable) chars_per_line.
|
||||||
Note also that this can set chars_printed > chars_per_line
|
Note also that this can set chars_printed > chars_per_line
|
||||||
if we are printing a long string. */
|
if we are printing a long string. */
|
||||||
chars_printed = strlen (wrap_indent)
|
chars_printed = strlen (wrap_indent)
|
||||||
|
@ -2888,7 +2888,7 @@ print_spaces_filtered (int n, struct ui_file *stream)
|
||||||
/* fprintf_symbol_filtered attempts to demangle NAME, a symbol in language
|
/* fprintf_symbol_filtered attempts to demangle NAME, a symbol in language
|
||||||
LANG, using demangling args ARG_MODE, and print it filtered to STREAM.
|
LANG, using demangling args ARG_MODE, and print it filtered to STREAM.
|
||||||
If the name is not mangled, or the language for the name is unknown, or
|
If the name is not mangled, or the language for the name is unknown, or
|
||||||
demangling is off, the name is printed in its "raw" form. */
|
demangling is off, the name is printed in its "raw" form. */
|
||||||
|
|
||||||
void
|
void
|
||||||
fprintf_symbol_filtered (struct ui_file *stream, char *name,
|
fprintf_symbol_filtered (struct ui_file *stream, char *name,
|
||||||
|
@ -2922,7 +2922,7 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name,
|
||||||
As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
|
As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
|
||||||
This "feature" is useful when searching for matching C++ function names
|
This "feature" is useful when searching for matching C++ function names
|
||||||
(such as if the user types 'break FOO', where FOO is a mangled C++
|
(such as if the user types 'break FOO', where FOO is a mangled C++
|
||||||
function). */
|
function). */
|
||||||
|
|
||||||
int
|
int
|
||||||
strcmp_iw (const char *string1, const char *string2)
|
strcmp_iw (const char *string1, const char *string2)
|
||||||
|
@ -3148,13 +3148,13 @@ When set, debugging messages will be marked with seconds and microseconds."),
|
||||||
&setdebuglist, &showdebuglist);
|
&setdebuglist, &showdebuglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Machine specific function to handle SIGWINCH signal. */
|
/* Machine specific function to handle SIGWINCH signal. */
|
||||||
|
|
||||||
#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 *
|
||||||
|
@ -3174,7 +3174,7 @@ paddress (struct gdbarch *gdbarch, CORE_ADDR addr)
|
||||||
/* Truncate address to the size of a target address, avoiding shifts
|
/* Truncate address to the size of a target address, avoiding shifts
|
||||||
larger or equal than the width of a CORE_ADDR. The local
|
larger or equal than the width of a CORE_ADDR. The local
|
||||||
variable ADDR_BIT stops the compiler reporting a shift overflow
|
variable ADDR_BIT stops the compiler reporting a shift overflow
|
||||||
when it won't occur. */
|
when it won't occur. */
|
||||||
/* NOTE: This assumes that the significant address information is
|
/* NOTE: This assumes that the significant address information is
|
||||||
kept in the least significant bits of ADDR - the upper bits were
|
kept in the least significant bits of ADDR - the upper bits were
|
||||||
either zero or sign extended. Should gdbarch_address_to_pointer or
|
either zero or sign extended. Should gdbarch_address_to_pointer or
|
||||||
|
@ -3191,7 +3191,7 @@ static char *
|
||||||
decimal2str (char *sign, ULONGEST addr, int width)
|
decimal2str (char *sign, ULONGEST addr, int width)
|
||||||
{
|
{
|
||||||
/* Steal code from valprint.c:print_decimal(). Should this worry
|
/* Steal code from valprint.c:print_decimal(). Should this worry
|
||||||
about the real size of addr as the above does? */
|
about the real size of addr as the above does? */
|
||||||
unsigned long temp[3];
|
unsigned long temp[3];
|
||||||
char *str = get_cell ();
|
char *str = get_cell ();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -3396,7 +3396,7 @@ hex_string_custom: insufficient space to store result"));
|
||||||
* otherwise VAL is interpreted as unsigned. If WIDTH is supplied,
|
* otherwise VAL is interpreted as unsigned. If WIDTH is supplied,
|
||||||
* it is the minimum width (0-padded if needed). USE_C_FORMAT means
|
* it is the minimum width (0-padded if needed). USE_C_FORMAT means
|
||||||
* to use C format in all cases. If it is false, then 'x'
|
* to use C format in all cases. If it is false, then 'x'
|
||||||
* and 'o' formats do not include a prefix (0x or leading 0). */
|
* and 'o' formats do not include a prefix (0x or leading 0). */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
int_string (LONGEST val, int radix, int is_signed, int width,
|
int_string (LONGEST val, int radix, int is_signed, int width,
|
||||||
|
@ -3594,14 +3594,14 @@ xfullpath (const char *filename)
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
/* Extract the basename of filename, and return immediately
|
/* Extract the basename of filename, and return immediately
|
||||||
a copy of filename if it does not contain any directory prefix. */
|
a copy of filename if it does not contain any directory prefix. */
|
||||||
if (base_name == filename)
|
if (base_name == filename)
|
||||||
return xstrdup (filename);
|
return xstrdup (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';
|
||||||
|
|
||||||
|
@ -3616,7 +3616,7 @@ xfullpath (const char *filename)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Canonicalize the directory prefix, and build the resulting
|
/* Canonicalize the directory prefix, and build the resulting
|
||||||
filename. If the dirname realpath already contains an ending
|
filename. If the dirname realpath already contains an ending
|
||||||
directory separator, avoid doubling it. */
|
directory separator, avoid doubling it. */
|
||||||
real_path = gdb_realpath (dir_name);
|
real_path = gdb_realpath (dir_name);
|
||||||
if (IS_DIR_SEPARATOR (real_path[strlen (real_path) - 1]))
|
if (IS_DIR_SEPARATOR (real_path[strlen (real_path) - 1]))
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -438,7 +439,7 @@ v850_is_save_register (int reg)
|
||||||
{
|
{
|
||||||
/* The caller-save registers are R2, R20 - R29 and R31. All other
|
/* The caller-save registers are R2, R20 - R29 and R31. All other
|
||||||
registers are either special purpose (PC, SP), argument registers,
|
registers are either special purpose (PC, SP), argument registers,
|
||||||
or just considered free for use in the caller. */
|
or just considered free for use in the caller. */
|
||||||
return reg == E_R2_REGNUM
|
return reg == E_R2_REGNUM
|
||||||
|| (reg >= E_R20_REGNUM && reg <= E_R29_REGNUM)
|
|| (reg >= E_R20_REGNUM && reg <= E_R29_REGNUM)
|
||||||
|| reg == E_R31_REGNUM;
|
|| reg == E_R31_REGNUM;
|
||||||
|
@ -492,7 +493,7 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
|
||||||
|
|
||||||
insn = read_memory_integer (current_pc, 2, byte_order);
|
insn = read_memory_integer (current_pc, 2, byte_order);
|
||||||
current_pc += 2;
|
current_pc += 2;
|
||||||
if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
|
if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
|
||||||
{
|
{
|
||||||
insn2 = read_memory_integer (current_pc, 2, byte_order);
|
insn2 = read_memory_integer (current_pc, 2, byte_order);
|
||||||
current_pc += 2;
|
current_pc += 2;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
|
|
||||||
/* Define whether or not the C operator '/' truncates towards zero for
|
/* Define whether or not the C operator '/' truncates towards zero for
|
||||||
differently signed operands (truncation direction is undefined in C). */
|
differently signed operands (truncation direction is undefined in C). */
|
||||||
|
|
||||||
#ifndef TRUNCATION_TOWARDS_ZERO
|
#ifndef TRUNCATION_TOWARDS_ZERO
|
||||||
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
|
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
|
||||||
|
@ -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)
|
||||||
|
@ -146,7 +145,7 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
|
||||||
See comments in value_coerce_array() for rationale for reason for
|
See comments in value_coerce_array() for rationale for reason for
|
||||||
doing lower bounds adjustment here rather than there.
|
doing lower bounds adjustment here rather than there.
|
||||||
FIXME: Perhaps we should validate that the index is valid and if
|
FIXME: Perhaps we should validate that the index is valid and if
|
||||||
verbosity is set, warn about invalid indices (but still use them). */
|
verbosity is set, warn about invalid indices (but still use them). */
|
||||||
|
|
||||||
struct value *
|
struct value *
|
||||||
value_subscript (struct value *array, LONGEST index)
|
value_subscript (struct value *array, LONGEST index)
|
||||||
|
@ -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)
|
||||||
|
@ -554,7 +553,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We know that arg1 is a structure, so try to find a unary user
|
/* We know that arg1 is a structure, so try to find a unary user
|
||||||
defined operator that matches the operator in question.
|
defined operator that matches the operator in question.
|
||||||
Create an argument vector that calls arg1.operator @ (arg1)
|
Create an argument vector that calls arg1.operator @ (arg1)
|
||||||
and return that value (where '@' is (almost) any unary operator which
|
and return that value (where '@' is (almost) any unary operator which
|
||||||
is legal for GNU C++). */
|
is legal for GNU C++). */
|
||||||
|
@ -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)
|
||||||
|
@ -696,7 +694,7 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||||
or a repeat count and a value to be repeated. INVAL1 is set to the
|
or a repeat count and a value to be repeated. INVAL1 is set to the
|
||||||
first of two concatenated values, or the repeat count. INVAL2 is set
|
first of two concatenated values, or the repeat count. INVAL2 is set
|
||||||
to the second of the two concatenated values or the value to be
|
to the second of the two concatenated values or the value to be
|
||||||
repeated. */
|
repeated. */
|
||||||
|
|
||||||
if (TYPE_CODE (type2) == TYPE_CODE_INT)
|
if (TYPE_CODE (type2) == TYPE_CODE_INT)
|
||||||
{
|
{
|
||||||
|
@ -713,12 +711,12 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||||
inval2 = arg2;
|
inval2 = arg2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now process the input values. */
|
/* Now process the input values. */
|
||||||
|
|
||||||
if (TYPE_CODE (type1) == TYPE_CODE_INT)
|
if (TYPE_CODE (type1) == TYPE_CODE_INT)
|
||||||
{
|
{
|
||||||
/* We have a repeat count. Validate the second value and then
|
/* We have a repeat count. Validate the second value and then
|
||||||
construct a value repeated that many times. */
|
construct a value repeated that many times. */
|
||||||
if (TYPE_CODE (type2) == TYPE_CODE_STRING
|
if (TYPE_CODE (type2) == TYPE_CODE_STRING
|
||||||
|| TYPE_CODE (type2) == TYPE_CODE_CHAR)
|
|| TYPE_CODE (type2) == TYPE_CODE_CHAR)
|
||||||
{
|
{
|
||||||
|
@ -761,7 +759,7 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||||
else if (TYPE_CODE (type1) == TYPE_CODE_STRING
|
else if (TYPE_CODE (type1) == TYPE_CODE_STRING
|
||||||
|| TYPE_CODE (type1) == TYPE_CODE_CHAR)
|
|| TYPE_CODE (type1) == TYPE_CODE_CHAR)
|
||||||
{
|
{
|
||||||
/* We have two character strings to concatenate. */
|
/* We have two character strings to concatenate. */
|
||||||
if (TYPE_CODE (type2) != TYPE_CODE_STRING
|
if (TYPE_CODE (type2) != TYPE_CODE_STRING
|
||||||
&& TYPE_CODE (type2) != TYPE_CODE_CHAR)
|
&& TYPE_CODE (type2) != TYPE_CODE_CHAR)
|
||||||
{
|
{
|
||||||
|
@ -796,7 +794,7 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||||
else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
|
else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
|
||||||
|| TYPE_CODE (type1) == TYPE_CODE_BOOL)
|
|| TYPE_CODE (type1) == TYPE_CODE_BOOL)
|
||||||
{
|
{
|
||||||
/* We have two bitstrings to concatenate. */
|
/* We have two bitstrings to concatenate. */
|
||||||
if (TYPE_CODE (type2) != TYPE_CODE_BITSTRING
|
if (TYPE_CODE (type2) != TYPE_CODE_BITSTRING
|
||||||
&& TYPE_CODE (type2) != TYPE_CODE_BOOL)
|
&& TYPE_CODE (type2) != TYPE_CODE_BOOL)
|
||||||
{
|
{
|
||||||
|
@ -807,7 +805,7 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We don't know how to concatenate these operands. */
|
/* We don't know how to concatenate these operands. */
|
||||||
error (_("illegal operands for concatenation."));
|
error (_("illegal operands for concatenation."));
|
||||||
}
|
}
|
||||||
return (outval);
|
return (outval);
|
||||||
|
@ -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;
|
||||||
|
@ -1175,7 +1175,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
|
|
||||||
case BINOP_MOD:
|
case BINOP_MOD:
|
||||||
/* Knuth 1.2.4, integer only. Note that unlike the C '%' op,
|
/* Knuth 1.2.4, integer only. Note that unlike the C '%' op,
|
||||||
v1 mod 0 has a defined value, v1. */
|
v1 mod 0 has a defined value, v1. */
|
||||||
if (v2 == 0)
|
if (v2 == 0)
|
||||||
{
|
{
|
||||||
v = v1;
|
v = v1;
|
||||||
|
@ -1183,7 +1183,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = v1 / v2;
|
v = v1 / v2;
|
||||||
/* Note floor(v1/v2) == v1/v2 for unsigned. */
|
/* Note floor(v1/v2) == v1/v2 for unsigned. */
|
||||||
v = v1 - (v2 * v);
|
v = v1 - (v2 * v);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1301,7 +1301,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
|
|
||||||
case BINOP_MOD:
|
case BINOP_MOD:
|
||||||
/* Knuth 1.2.4, integer only. Note that unlike the C '%' op,
|
/* Knuth 1.2.4, integer only. Note that unlike the C '%' op,
|
||||||
X mod 0 has a defined value, X. */
|
X mod 0 has a defined value, X. */
|
||||||
if (v2 == 0)
|
if (v2 == 0)
|
||||||
{
|
{
|
||||||
v = v1;
|
v = v1;
|
||||||
|
@ -1309,7 +1309,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = v1 / v2;
|
v = v1 / v2;
|
||||||
/* Compute floor. */
|
/* Compute floor. */
|
||||||
if (TRUNCATION_TOWARDS_ZERO && (v < 0) && ((v1 % v2) != 0))
|
if (TRUNCATION_TOWARDS_ZERO && (v < 0) && ((v1 % v2) != 0))
|
||||||
{
|
{
|
||||||
v--;
|
v--;
|
||||||
|
@ -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. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1828,7 +1828,7 @@ value_complement (struct value *arg1)
|
||||||
|
|
||||||
/* The INDEX'th bit of SET value whose value_type is TYPE,
|
/* The INDEX'th bit of SET value whose value_type is TYPE,
|
||||||
and whose value_contents is valaddr.
|
and whose value_contents is valaddr.
|
||||||
Return -1 if out of range, -2 other error. */
|
Return -1 if out of range, -2 other error. */
|
||||||
|
|
||||||
int
|
int
|
||||||
value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
|
value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
|
||||||
|
|
42
gdb/valops.c
42
gdb/valops.c
|
@ -368,7 +368,7 @@ value_cast (struct type *type, struct value *arg2)
|
||||||
if (code1 == TYPE_CODE_REF)
|
if (code1 == TYPE_CODE_REF)
|
||||||
{
|
{
|
||||||
/* We dereference type; then we recurse and finally
|
/* We dereference type; then we recurse and finally
|
||||||
we generate value of the given reference. Nothing wrong with
|
we generate value of the given reference. Nothing wrong with
|
||||||
that. */
|
that. */
|
||||||
struct type *t1 = check_typedef (type);
|
struct type *t1 = check_typedef (type);
|
||||||
struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1));
|
struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1));
|
||||||
|
@ -1420,7 +1420,7 @@ address_of_variable (struct symbol *var, struct block *b)
|
||||||
struct value *val;
|
struct value *val;
|
||||||
|
|
||||||
/* Evaluate it first; if the result is a memory address, we're fine.
|
/* Evaluate it first; if the result is a memory address, we're fine.
|
||||||
Lazy evaluation pays off here. */
|
Lazy evaluation pays off here. */
|
||||||
|
|
||||||
val = value_of_variable (var, b);
|
val = value_of_variable (var, b);
|
||||||
|
|
||||||
|
@ -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)));
|
||||||
|
@ -1891,7 +1890,7 @@ typecmp (int staticp, int varargs, int nargs,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function used by value_struct_elt to recurse through
|
/* Helper function used by value_struct_elt to recurse through
|
||||||
baseclasses. Look for a field NAME in ARG1. Adjust the address of
|
baseclasses. Look for a field NAME in ARG1. Adjust the address of
|
||||||
ARG1 by OFFSET bytes, and search in it assuming it has (class) type
|
ARG1 by OFFSET bytes, and search in it assuming it has (class) type
|
||||||
TYPE. If found, return value, else return NULL.
|
TYPE. If found, return value, else return NULL.
|
||||||
|
|
||||||
|
@ -2006,7 +2005,7 @@ search_struct_field (const char *name, struct value *arg1, int offset,
|
||||||
error (_("virtual baseclass botch"));
|
error (_("virtual baseclass botch"));
|
||||||
|
|
||||||
/* The virtual base class pointer might have been clobbered
|
/* The virtual base class pointer might have been clobbered
|
||||||
by the user program. Make sure that it still points to a
|
by the user program. Make sure that it still points to a
|
||||||
valid memory location. */
|
valid memory location. */
|
||||||
|
|
||||||
boffset += value_embedded_offset (arg1) + offset;
|
boffset += value_embedded_offset (arg1) + offset;
|
||||||
|
@ -2051,7 +2050,7 @@ search_struct_field (const char *name, struct value *arg1, int offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function used by value_struct_elt to recurse through
|
/* Helper function used by value_struct_elt to recurse through
|
||||||
baseclasses. Look for a field NAME in ARG1. Adjust the address of
|
baseclasses. Look for a field NAME in ARG1. Adjust the address of
|
||||||
ARG1 by OFFSET bytes, and search in it assuming it has (class) type
|
ARG1 by OFFSET bytes, and search in it assuming it has (class) type
|
||||||
TYPE.
|
TYPE.
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -2132,7 +2131,7 @@ search_struct_method (const char *name, struct value **arg1p,
|
||||||
const gdb_byte *base_valaddr;
|
const gdb_byte *base_valaddr;
|
||||||
|
|
||||||
/* The virtual base class pointer might have been
|
/* The virtual base class pointer might have been
|
||||||
clobbered by the user program. Make sure that it
|
clobbered by the user program. Make sure that it
|
||||||
still points to a valid memory location. */
|
still points to a valid memory location. */
|
||||||
|
|
||||||
if (offset < 0 || offset >= TYPE_LENGTH (type))
|
if (offset < 0 || offset >= TYPE_LENGTH (type))
|
||||||
|
@ -2181,7 +2180,7 @@ search_struct_method (const char *name, struct value **arg1p,
|
||||||
ERR is used in the error message if *ARGP's type is wrong.
|
ERR is used in the error message if *ARGP's type is wrong.
|
||||||
|
|
||||||
C++: ARGS is a list of argument types to aid in the selection of
|
C++: ARGS is a list of argument types to aid in the selection of
|
||||||
an appropriate method. Also, handle derived types.
|
an appropriate method. Also, handle derived types.
|
||||||
|
|
||||||
STATIC_MEMFUNCP, if non-NULL, points to a caller-supplied location
|
STATIC_MEMFUNCP, if non-NULL, points to a caller-supplied location
|
||||||
where the truthvalue of whether the function that was resolved was
|
where the truthvalue of whether the function that was resolved was
|
||||||
|
@ -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,
|
||||||
|
@ -2402,7 +2399,7 @@ value_find_oload_method_list (struct value **argp, const char *method,
|
||||||
METHOD: for member functions.
|
METHOD: for member functions.
|
||||||
BOTH: used for overload resolution of operators where the
|
BOTH: used for overload resolution of operators where the
|
||||||
candidates are expected to be either member or non member
|
candidates are expected to be either member or non member
|
||||||
functions. In this case the first argument ARGTYPES
|
functions. In this case the first argument ARGTYPES
|
||||||
(representing 'this') is expected to be a reference to the
|
(representing 'this') is expected to be a reference to the
|
||||||
target object, and will be dereferenced when attempting the
|
target object, and will be dereferenced when attempting the
|
||||||
non-member search.
|
non-member search.
|
||||||
|
@ -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,
|
||||||
|
@ -2770,7 +2766,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
|
||||||
*oload_syms = NULL;
|
*oload_syms = NULL;
|
||||||
*oload_champ_bv = NULL;
|
*oload_champ_bv = NULL;
|
||||||
|
|
||||||
/* First, see if we have a deeper namespace we can search in.
|
/* First, see if we have a deeper namespace we can search in.
|
||||||
If we get a good match there, use it. */
|
If we get a good match there, use it. */
|
||||||
|
|
||||||
if (qualified_name[next_namespace_len] == ':')
|
if (qualified_name[next_namespace_len] == ':')
|
||||||
|
@ -3103,7 +3099,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
|
||||||
++start;
|
++start;
|
||||||
|
|
||||||
/* If skipping artificial fields, find the first real field
|
/* If skipping artificial fields, find the first real field
|
||||||
in T1. */
|
in T1. */
|
||||||
if (skip_artificial)
|
if (skip_artificial)
|
||||||
{
|
{
|
||||||
while (start < TYPE_NFIELDS (t1)
|
while (start < TYPE_NFIELDS (t1)
|
||||||
|
@ -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 "
|
||||||
|
|
112
gdb/valprint.c
112
gdb/valprint.c
|
@ -62,7 +62,7 @@ static void set_output_radix_1 (int, unsigned);
|
||||||
|
|
||||||
void _initialize_valprint (void);
|
void _initialize_valprint (void);
|
||||||
|
|
||||||
#define PRINT_MAX_DEFAULT 200 /* Start print_max off at this value. */
|
#define PRINT_MAX_DEFAULT 200 /* Start print_max off at this value. */
|
||||||
|
|
||||||
struct value_print_options user_print_options =
|
struct value_print_options user_print_options =
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ show_print_array_indexes (struct ui_file *file, int from_tty,
|
||||||
|
|
||||||
/* Print repeat counts if there are more than this many repetitions of an
|
/* Print repeat counts if there are more than this many repetitions of an
|
||||||
element in an array. Referenced by the low level language dependent
|
element in an array. Referenced by the low level language dependent
|
||||||
print routines. */
|
print routines. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_repeat_count_threshold (struct ui_file *file, int from_tty,
|
show_repeat_count_threshold (struct ui_file *file, int from_tty,
|
||||||
|
@ -168,7 +168,7 @@ show_repeat_count_threshold (struct ui_file *file, int from_tty,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If nonzero, stops printing of char arrays at first null. */
|
/* If nonzero, stops printing of char arrays at first null. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_stop_print_at_null (struct ui_file *file, int from_tty,
|
show_stop_print_at_null (struct ui_file *file, int from_tty,
|
||||||
|
@ -180,7 +180,7 @@ show_stop_print_at_null (struct ui_file *file, int from_tty,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Controls pretty printing of structures. */
|
/* Controls pretty printing of structures. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_prettyprint_structs (struct ui_file *file, int from_tty,
|
show_prettyprint_structs (struct ui_file *file, int from_tty,
|
||||||
|
@ -199,7 +199,7 @@ show_prettyprint_arrays (struct ui_file *file, int from_tty,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If nonzero, causes unions inside structures or other unions to be
|
/* If nonzero, causes unions inside structures or other unions to be
|
||||||
printed. */
|
printed. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_unionprint (struct ui_file *file, int from_tty,
|
show_unionprint (struct ui_file *file, int from_tty,
|
||||||
|
@ -210,7 +210,7 @@ show_unionprint (struct ui_file *file, int from_tty,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If nonzero, causes machine addresses to be printed in certain contexts. */
|
/* If nonzero, causes machine addresses to be printed in certain contexts. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_addressprint (struct ui_file *file, int from_tty,
|
show_addressprint (struct ui_file *file, int from_tty,
|
||||||
|
@ -299,7 +299,7 @@ valprint_check_validity (struct ui_file *stream,
|
||||||
for (specific CPU type and thus specific target byte ordering), then
|
for (specific CPU type and thus specific target byte ordering), then
|
||||||
either the print routines are going to have to take this into account,
|
either the print routines are going to have to take this into account,
|
||||||
or the data is going to have to be passed into here already converted
|
or the data is going to have to be passed into here already converted
|
||||||
to the host byte ordering, whichever is more convenient. */
|
to the host byte ordering, whichever is more convenient. */
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -512,9 +512,9 @@ val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
|
||||||
|
|
||||||
/* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g.
|
/* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g.
|
||||||
The raison d'etre of this function is to consolidate printing of
|
The raison d'etre of this function is to consolidate printing of
|
||||||
LONG_LONG's into this one function. The format chars b,h,w,g are
|
LONG_LONG's into this one function. The format chars b,h,w,g are
|
||||||
from print_scalar_formatted(). Numbers are printed using C
|
from print_scalar_formatted(). Numbers are printed using C
|
||||||
format.
|
format.
|
||||||
|
|
||||||
USE_C_FORMAT means to use C format in all cases. Without it,
|
USE_C_FORMAT means to use C format in all cases. Without it,
|
||||||
'o' and 'x' format do not include the standard C radix prefix
|
'o' and 'x' format do not include the standard C radix prefix
|
||||||
|
@ -527,7 +527,7 @@ val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
|
||||||
the integer is a protocol thing, not a user-visible thing). The
|
the integer is a protocol thing, not a user-visible thing). The
|
||||||
parameter remains to preserve the information of what things might
|
parameter remains to preserve the information of what things might
|
||||||
be printed with language-specific format, should we ever resurrect
|
be printed with language-specific format, should we ever resurrect
|
||||||
that capability. */
|
that capability. */
|
||||||
|
|
||||||
void
|
void
|
||||||
print_longest (struct ui_file *stream, int format, int use_c_format,
|
print_longest (struct ui_file *stream, int format, int use_c_format,
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -919,7 +922,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||||
* the nibbles by 16, add Y and re-decimalize. Repeat with Z.
|
* the nibbles by 16, add Y and re-decimalize. Repeat with Z.
|
||||||
*
|
*
|
||||||
* The trick is that "digits" holds a base-10 number, but sometimes
|
* The trick is that "digits" holds a base-10 number, but sometimes
|
||||||
* the individual digits are > 10.
|
* the individual digits are > 10.
|
||||||
*
|
*
|
||||||
* Outer loop is per nibble (hex digit) of input, from MSD end to
|
* Outer loop is per nibble (hex digit) of input, from MSD end to
|
||||||
* LSD end.
|
* LSD end.
|
||||||
|
@ -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]);
|
||||||
|
@ -1042,7 +1045,7 @@ print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VALADDR points to a char integer of LEN bytes.
|
/* VALADDR points to a char integer of LEN bytes.
|
||||||
Print it out in appropriate language form on stream.
|
Print it out in appropriate language form on stream.
|
||||||
Omit any leading zero chars. */
|
Omit any leading zero chars. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -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,
|
||||||
|
@ -1205,7 +1207,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
|
||||||
/* Read LEN bytes of target memory at address MEMADDR, placing the
|
/* Read LEN bytes of target memory at address MEMADDR, placing the
|
||||||
results in GDB's memory at MYADDR. Returns a count of the bytes
|
results in GDB's memory at MYADDR. Returns a count of the bytes
|
||||||
actually read, and optionally an errno value in the location
|
actually read, and optionally an errno value in the location
|
||||||
pointed to by ERRNOPTR if ERRNOPTR is non-null. */
|
pointed to by ERRNOPTR if ERRNOPTR is non-null. */
|
||||||
|
|
||||||
/* FIXME: cagney/1999-10-14: Only used by val_print_string. Can this
|
/* FIXME: cagney/1999-10-14: Only used by val_print_string. Can this
|
||||||
function be eliminated. */
|
function be eliminated. */
|
||||||
|
@ -1214,24 +1216,24 @@ static int
|
||||||
partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
|
partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
|
||||||
int len, int *errnoptr)
|
int len, int *errnoptr)
|
||||||
{
|
{
|
||||||
int nread; /* Number of bytes actually read. */
|
int nread; /* Number of bytes actually read. */
|
||||||
int errcode; /* Error from last read. */
|
int errcode; /* Error from last read. */
|
||||||
|
|
||||||
/* First try a complete read. */
|
/* First try a complete read. */
|
||||||
errcode = target_read_memory (memaddr, myaddr, len);
|
errcode = target_read_memory (memaddr, myaddr, len);
|
||||||
if (errcode == 0)
|
if (errcode == 0)
|
||||||
{
|
{
|
||||||
/* Got it all. */
|
/* Got it all. */
|
||||||
nread = len;
|
nread = len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Loop, reading one byte at a time until we get as much as we can. */
|
/* Loop, reading one byte at a time until we get as much as we can. */
|
||||||
for (errcode = 0, nread = 0; len > 0 && errcode == 0; nread++, len--)
|
for (errcode = 0, nread = 0; len > 0 && errcode == 0; nread++, len--)
|
||||||
{
|
{
|
||||||
errcode = target_read_memory (memaddr++, myaddr++, 1);
|
errcode = target_read_memory (memaddr++, myaddr++, 1);
|
||||||
}
|
}
|
||||||
/* If an error, the last read was unsuccessful, so adjust count. */
|
/* If an error, the last read was unsuccessful, so adjust count. */
|
||||||
if (errcode != 0)
|
if (errcode != 0)
|
||||||
{
|
{
|
||||||
nread--;
|
nread--;
|
||||||
|
@ -1262,7 +1264,7 @@ partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
|
||||||
|
|
||||||
Note: There was a FIXME asking to make this code use target_read_string,
|
Note: There was a FIXME asking to make this code use target_read_string,
|
||||||
but this function is more general (can read past null characters, up to
|
but this function is more general (can read past null characters, up to
|
||||||
given LEN). Besides, it is used much more often than target_read_string
|
given LEN). Besides, it is used much more often than target_read_string
|
||||||
so it is more tested. Perhaps callers of target_read_string should use
|
so it is more tested. Perhaps callers of target_read_string should use
|
||||||
this function instead? */
|
this function instead? */
|
||||||
|
|
||||||
|
@ -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. */
|
||||||
|
@ -1507,7 +1509,7 @@ set_input_radix_1 (int from_tty, unsigned radix)
|
||||||
radix greater than 1, even if we don't have unique digits for every
|
radix greater than 1, even if we don't have unique digits for every
|
||||||
value from 0 to radix-1, but in practice we lose on large radix values.
|
value from 0 to radix-1, but in practice we lose on large radix values.
|
||||||
We should either fix the lossage or restrict the radix range more.
|
We should either fix the lossage or restrict the radix range more.
|
||||||
(FIXME). */
|
(FIXME). */
|
||||||
|
|
||||||
if (radix < 2)
|
if (radix < 2)
|
||||||
{
|
{
|
||||||
|
@ -1540,7 +1542,7 @@ static void
|
||||||
set_output_radix_1 (int from_tty, unsigned radix)
|
set_output_radix_1 (int from_tty, unsigned radix)
|
||||||
{
|
{
|
||||||
/* Validate the radix and disallow ones that we aren't prepared to
|
/* Validate the radix and disallow ones that we aren't prepared to
|
||||||
handle correctly, leaving the radix unchanged. */
|
handle correctly, leaving the radix unchanged. */
|
||||||
switch (radix)
|
switch (radix)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
|
@ -1573,7 +1575,7 @@ set_output_radix_1 (int from_tty, unsigned radix)
|
||||||
|
|
||||||
It may be useful to have an unusual input radix. If the user wishes to
|
It may be useful to have an unusual input radix. If the user wishes to
|
||||||
set an input radix that is not valid as an output radix, he needs to use
|
set an input radix that is not valid as an output radix, he needs to use
|
||||||
the 'set input-radix' command. */
|
the 'set input-radix' command. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_radix (char *arg, int from_tty)
|
set_radix (char *arg, int from_tty)
|
||||||
|
@ -1591,7 +1593,7 @@ set_radix (char *arg, int from_tty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show both the input and output radices. */
|
/* Show both the input and output radices. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_radix (char *arg, int from_tty)
|
show_radix (char *arg, int from_tty)
|
||||||
|
@ -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,
|
||||||
|
@ -1725,7 +1727,7 @@ Show default output radix for printing of values."), NULL,
|
||||||
they are like normal set and show commands but allow two normally
|
they are like normal set and show commands but allow two normally
|
||||||
independent variables to be either set or shown with a single
|
independent variables to be either set or shown with a single
|
||||||
command. So the usual deprecated_add_set_cmd() and [deleted]
|
command. So the usual deprecated_add_set_cmd() and [deleted]
|
||||||
add_show_from_set() commands aren't really appropriate. */
|
add_show_from_set() commands aren't really appropriate. */
|
||||||
/* FIXME: i18n: With the new add_setshow_integer command, that is no
|
/* FIXME: i18n: With the new add_setshow_integer command, that is no
|
||||||
longer true - show can display anything. */
|
longer true - show can display anything. */
|
||||||
add_cmd ("radix", class_support, set_radix, _("\
|
add_cmd ("radix", class_support, set_radix, _("\
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct value_print_options
|
||||||
/* Maximum number of chars to print for a string pointer value or vector
|
/* Maximum number of chars to print for a string pointer value or vector
|
||||||
contents, or UINT_MAX for no limit. Note that "set print elements 0"
|
contents, or UINT_MAX for no limit. Note that "set print elements 0"
|
||||||
stores UINT_MAX in print_max, which displays in a show command as
|
stores UINT_MAX in print_max, which displays in a show command as
|
||||||
"unlimited". */
|
"unlimited". */
|
||||||
unsigned int print_max;
|
unsigned int print_max;
|
||||||
|
|
||||||
/* Print repeat counts if there are more than this many repetitions
|
/* Print repeat counts if there are more than this many repetitions
|
||||||
|
|
36
gdb/value.c
36
gdb/value.c
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
#include "tracepoint.h"
|
#include "tracepoint.h"
|
||||||
|
|
||||||
/* Prototypes for exported functions. */
|
/* Prototypes for exported functions. */
|
||||||
|
|
||||||
void _initialize_values (void);
|
void _initialize_values (void);
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ struct value
|
||||||
|
|
||||||
/* Only used for bitfields; position of start of field. For
|
/* Only used for bitfields; position of start of field. For
|
||||||
gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
|
gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
|
||||||
gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
|
gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
|
||||||
int bitpos;
|
int bitpos;
|
||||||
|
|
||||||
/* Only used for bitfields; the containing value. This allows a
|
/* Only used for bitfields; the containing value. This allows a
|
||||||
|
@ -214,7 +214,7 @@ struct value
|
||||||
int reference_count;
|
int reference_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
|
|
||||||
static void show_values (char *, int);
|
static void show_values (char *, int);
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -1672,7 +1672,7 @@ value_as_double (struct value *val)
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract a value as a C pointer. Does not deallocate the value.
|
/* Extract a value as a C pointer. Does not deallocate the value.
|
||||||
Note that val's type may not actually be a pointer; value_as_long
|
Note that val's type may not actually be a pointer; value_as_long
|
||||||
handles all the cases. */
|
handles all the cases. */
|
||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
|
@ -1851,7 +1851,7 @@ unpack_double (struct type *type, const gdb_byte *valaddr, int *invp)
|
||||||
int len;
|
int len;
|
||||||
int nosign;
|
int nosign;
|
||||||
|
|
||||||
*invp = 0; /* Assume valid. */
|
*invp = 0; /* Assume valid. */
|
||||||
CHECK_TYPEDEF (type);
|
CHECK_TYPEDEF (type);
|
||||||
code = TYPE_CODE (type);
|
code = TYPE_CODE (type);
|
||||||
len = TYPE_LENGTH (type);
|
len = TYPE_LENGTH (type);
|
||||||
|
@ -1921,7 +1921,7 @@ unpack_pointer (struct type *type, const gdb_byte *valaddr)
|
||||||
|
|
||||||
/* Get the value of the FIELDNO'th field (which must be static) of
|
/* Get the value of the FIELDNO'th field (which must be static) of
|
||||||
TYPE. Return NULL if the field doesn't exist or has been
|
TYPE. Return NULL if the field doesn't exist or has been
|
||||||
optimized out. */
|
optimized out. */
|
||||||
|
|
||||||
struct value *
|
struct value *
|
||||||
value_static_field (struct type *type, int fieldno)
|
value_static_field (struct type *type, int fieldno)
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -1985,7 +1985,7 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type)
|
||||||
/* Given a value ARG1 (offset by OFFSET bytes)
|
/* Given a value ARG1 (offset by OFFSET bytes)
|
||||||
of a struct or union type ARG_TYPE,
|
of a struct or union type ARG_TYPE,
|
||||||
extract and return the value of one of its (non-static) fields.
|
extract and return the value of one of its (non-static) fields.
|
||||||
FIELDNO says which field. */
|
FIELDNO says which field. */
|
||||||
|
|
||||||
struct value *
|
struct value *
|
||||||
value_primitive_field (struct value *arg1, int offset,
|
value_primitive_field (struct value *arg1, int offset,
|
||||||
|
@ -2085,7 +2085,7 @@ value_primitive_field (struct value *arg1, int offset,
|
||||||
|
|
||||||
/* Given a value ARG1 of a struct or union type,
|
/* Given a value ARG1 of a struct or union type,
|
||||||
extract and return the value of one of its (non-static) fields.
|
extract and return the value of one of its (non-static) fields.
|
||||||
FIELDNO says which field. */
|
FIELDNO says which field. */
|
||||||
|
|
||||||
struct value *
|
struct value *
|
||||||
value_field (struct value *arg1, int fieldno)
|
value_field (struct value *arg1, int fieldno)
|
||||||
|
@ -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;
|
||||||
|
@ -2170,7 +2168,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
|
||||||
number of bits from the LSB of the anonymous object to the LSB of the
|
number of bits from the LSB of the anonymous object to the LSB of the
|
||||||
bitfield.
|
bitfield.
|
||||||
|
|
||||||
If the field is signed, we also do sign extension. */
|
If the field is signed, we also do sign extension. */
|
||||||
|
|
||||||
LONGEST
|
LONGEST
|
||||||
unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
|
unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
|
||||||
|
@ -2193,7 +2191,7 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
|
||||||
val = extract_unsigned_integer (valaddr + bitpos / 8,
|
val = extract_unsigned_integer (valaddr + bitpos / 8,
|
||||||
bytes_read, byte_order);
|
bytes_read, byte_order);
|
||||||
|
|
||||||
/* Extract bits. See comment above. */
|
/* Extract bits. See comment above. */
|
||||||
|
|
||||||
if (gdbarch_bits_big_endian (get_type_arch (field_type)))
|
if (gdbarch_bits_big_endian (get_type_arch (field_type)))
|
||||||
lsbcount = (bytes_read * 8 - bitpos % 8 - bitsize);
|
lsbcount = (bytes_read * 8 - bitpos % 8 - bitsize);
|
||||||
|
@ -2202,7 +2200,7 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
|
||||||
val >>= lsbcount;
|
val >>= lsbcount;
|
||||||
|
|
||||||
/* If the field does not entirely fill a LONGEST, then zero the sign bits.
|
/* If the field does not entirely fill a LONGEST, then zero the sign bits.
|
||||||
If the field is signed, and is negative, then sign extend. */
|
If the field is signed, and is negative, then sign extend. */
|
||||||
|
|
||||||
if ((bitsize > 0) && (bitsize < 8 * (int) sizeof (val)))
|
if ((bitsize > 0) && (bitsize < 8 * (int) sizeof (val)))
|
||||||
{
|
{
|
||||||
|
@ -2235,7 +2233,7 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
|
||||||
/* Modify the value of a bitfield. ADDR points to a block of memory in
|
/* Modify the value of a bitfield. ADDR points to a block of memory in
|
||||||
target byte order; the bitfield starts in the byte pointed to. FIELDVAL
|
target byte order; the bitfield starts in the byte pointed to. FIELDVAL
|
||||||
is the desired value of the field, in host byte order. BITPOS and BITSIZE
|
is the desired value of the field, in host byte order. BITPOS and BITSIZE
|
||||||
indicate which bits (in target bit order) comprise the bitfield.
|
indicate which bits (in target bit order) comprise the bitfield.
|
||||||
Requires 0 < BITSIZE <= lbits, 0 <= BITPOS % 8 + BITSIZE <= lbits, and
|
Requires 0 < BITSIZE <= lbits, 0 <= BITPOS % 8 + BITSIZE <= lbits, and
|
||||||
0 <= BITPOS, where lbits is the size of a LONGEST in bits. */
|
0 <= BITPOS, where lbits is the size of a LONGEST in bits. */
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ extern void set_value_optimized_out (struct value *value, int val);
|
||||||
extern int value_entirely_optimized_out (const struct value *value);
|
extern int value_entirely_optimized_out (const struct value *value);
|
||||||
|
|
||||||
/* Set or return field indicating whether a variable is initialized or
|
/* Set or return field indicating whether a variable is initialized or
|
||||||
not, based on debugging information supplied by the compiler.
|
not, based on debugging information supplied by the compiler.
|
||||||
1 = initialized; 0 = uninitialized. */
|
1 = initialized; 0 = uninitialized. */
|
||||||
extern int value_initialized (struct value *);
|
extern int value_initialized (struct value *);
|
||||||
extern void set_value_initialized (struct value *, int);
|
extern void set_value_initialized (struct value *, int);
|
||||||
|
|
317
gdb/varobj.c
317
gdb/varobj.c
File diff suppressed because it is too large
Load diff
16
gdb/varobj.h
16
gdb/varobj.h
|
@ -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,19 +50,19 @@ 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. */
|
||||||
enum varobj_languages
|
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.
|
||||||
|
|
|
@ -57,7 +57,7 @@ vax_register_name (struct gdbarch *gdbarch, int regnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the GDB type object for the "standard" data type of data in
|
/* Return the GDB type object for the "standard" data type of data in
|
||||||
register REGNUM. */
|
register REGNUM. */
|
||||||
|
|
||||||
static struct type *
|
static struct type *
|
||||||
vax_register_type (struct gdbarch *gdbarch, int regnum)
|
vax_register_type (struct gdbarch *gdbarch, int regnum)
|
||||||
|
|
|
@ -56,7 +56,7 @@ calculate_allocation (const struct vec_prefix *pfx, int reserve)
|
||||||
alloc = num + -reserve;
|
alloc = num + -reserve;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Exponential growth. */
|
/* Exponential growth. */
|
||||||
if (!alloc)
|
if (!alloc)
|
||||||
alloc = 4;
|
alloc = 4;
|
||||||
else if (alloc < 16)
|
else if (alloc < 16)
|
||||||
|
@ -66,7 +66,7 @@ calculate_allocation (const struct vec_prefix *pfx, int reserve)
|
||||||
/* Grow slower when large. */
|
/* Grow slower when large. */
|
||||||
alloc = (alloc * 3 / 2);
|
alloc = (alloc * 3 / 2);
|
||||||
|
|
||||||
/* If this is still too small, set it to the right size. */
|
/* If this is still too small, set it to the right size. */
|
||||||
if (alloc < num + reserve)
|
if (alloc < num + reserve)
|
||||||
alloc = num + reserve;
|
alloc = num + reserve;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ calculate_allocation (const struct vec_prefix *pfx, int reserve)
|
||||||
|
|
||||||
/* Ensure there are at least abs(RESERVE) free slots in VEC. If
|
/* Ensure there are at least abs(RESERVE) free slots in VEC. If
|
||||||
RESERVE < 0 grow exactly, else grow exponentially. As a special
|
RESERVE < 0 grow exactly, else grow exponentially. As a special
|
||||||
case, if VEC is NULL, and RESERVE is 0, no vector will be created. */
|
case, if VEC is NULL, and RESERVE is 0, no vector will be created. */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
vec_p_reserve (void *vec, int reserve)
|
vec_p_reserve (void *vec, int reserve)
|
||||||
|
|
28
gdb/vec.h
28
gdb/vec.h
|
@ -73,7 +73,7 @@
|
||||||
specific size from the get go.
|
specific size from the get go.
|
||||||
|
|
||||||
You should prefer the push and pop operations, as they append and
|
You should prefer the push and pop operations, as they append and
|
||||||
remove from the end of the vector. If you need to remove several
|
remove from the end of the vector. If you need to remove several
|
||||||
items in one go, use the truncate operation. The insert and remove
|
items in one go, use the truncate operation. The insert and remove
|
||||||
operations allow you to change elements in the middle of the
|
operations allow you to change elements in the middle of the
|
||||||
vector. There are two remove operations, one which preserves the
|
vector. There are two remove operations, one which preserves the
|
||||||
|
@ -240,7 +240,7 @@
|
||||||
T *VEC_T_quick_push (VEC(T) *v, T *obj); // Object
|
T *VEC_T_quick_push (VEC(T) *v, T *obj); // Object
|
||||||
|
|
||||||
Push a new element onto the end, returns a pointer to the slot
|
Push a new element onto the end, returns a pointer to the slot
|
||||||
filled in. For object vectors, the new value can be NULL, in which
|
filled in. For object vectors, the new value can be NULL, in which
|
||||||
case NO initialization is performed. There must
|
case NO initialization is performed. There must
|
||||||
be sufficient space in the vector. */
|
be sufficient space in the vector. */
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@
|
||||||
T *VEC_T_safe_push (VEC(T,A) *&v, T *obj); // Object
|
T *VEC_T_safe_push (VEC(T,A) *&v, T *obj); // Object
|
||||||
|
|
||||||
Push a new element onto the end, returns a pointer to the slot
|
Push a new element onto the end, returns a pointer to the slot
|
||||||
filled in. For object vectors, the new value can be NULL, in which
|
filled in. For object vectors, the new value can be NULL, in which
|
||||||
case NO initialization is performed. Reallocates V, if needed. */
|
case NO initialization is performed. Reallocates V, if needed. */
|
||||||
|
|
||||||
#define VEC_safe_push(T,V,O) (VEC_OP(T,safe_push)(&(V),O VEC_ASSERT_INFO))
|
#define VEC_safe_push(T,V,O) (VEC_OP(T,safe_push)(&(V),O VEC_ASSERT_INFO))
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
T VEC_T_pop (VEC(T) *v); // Pointer
|
T VEC_T_pop (VEC(T) *v); // Pointer
|
||||||
void VEC_T_pop (VEC(T) *v); // Object
|
void VEC_T_pop (VEC(T) *v); // Object
|
||||||
|
|
||||||
Pop the last element off the end. Returns the element popped, for
|
Pop the last element off the end. Returns the element popped, for
|
||||||
pointer vectors. */
|
pointer vectors. */
|
||||||
|
|
||||||
#define VEC_pop(T,V) (VEC_OP(T,pop)(V VEC_ASSERT_INFO))
|
#define VEC_pop(T,V) (VEC_OP(T,pop)(V VEC_ASSERT_INFO))
|
||||||
|
@ -292,7 +292,7 @@
|
||||||
T *VEC_T_replace (VEC(T) *v, unsigned ix, T *val); // Object
|
T *VEC_T_replace (VEC(T) *v, unsigned ix, T *val); // Object
|
||||||
|
|
||||||
Replace the IXth element of V with a new value, VAL. For pointer
|
Replace the IXth element of V with a new value, VAL. For pointer
|
||||||
vectors returns the original value. For object vectors returns a
|
vectors returns the original value. For object vectors returns a
|
||||||
pointer to the new value. For object vectors the new value can be
|
pointer to the new value. For object vectors the new value can be
|
||||||
NULL, in which case no overwriting of the slot is actually
|
NULL, in which case no overwriting of the slot is actually
|
||||||
performed. */
|
performed. */
|
||||||
|
@ -304,10 +304,10 @@
|
||||||
T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T val); // Pointer
|
T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T val); // Pointer
|
||||||
T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T *val); // Object
|
T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T *val); // Object
|
||||||
|
|
||||||
Insert an element, VAL, at the IXth position of V. Return a pointer
|
Insert an element, VAL, at the IXth position of V. Return a pointer
|
||||||
to the slot created. For vectors of object, the new value can be
|
to the slot created. For vectors of object, the new value can be
|
||||||
NULL, in which case no initialization of the inserted slot takes
|
NULL, in which case no initialization of the inserted slot takes
|
||||||
place. There must be sufficient space. */
|
place. There must be sufficient space. */
|
||||||
|
|
||||||
#define VEC_quick_insert(T,V,I,O) \
|
#define VEC_quick_insert(T,V,I,O) \
|
||||||
(VEC_OP(T,quick_insert)(V,I,O VEC_ASSERT_INFO))
|
(VEC_OP(T,quick_insert)(V,I,O VEC_ASSERT_INFO))
|
||||||
|
@ -317,10 +317,10 @@
|
||||||
T *VEC_T_safe_insert (VEC(T,A) *&v, unsigned ix, T val); // Pointer
|
T *VEC_T_safe_insert (VEC(T,A) *&v, unsigned ix, T val); // Pointer
|
||||||
T *VEC_T_safe_insert (VEC(T,A) *&v, unsigned ix, T *val); // Object
|
T *VEC_T_safe_insert (VEC(T,A) *&v, unsigned ix, T *val); // Object
|
||||||
|
|
||||||
Insert an element, VAL, at the IXth position of V. Return a pointer
|
Insert an element, VAL, at the IXth position of V. Return a pointer
|
||||||
to the slot created. For vectors of object, the new value can be
|
to the slot created. For vectors of object, the new value can be
|
||||||
NULL, in which case no initialization of the inserted slot takes
|
NULL, in which case no initialization of the inserted slot takes
|
||||||
place. Reallocate V, if necessary. */
|
place. Reallocate V, if necessary. */
|
||||||
|
|
||||||
#define VEC_safe_insert(T,V,I,O) \
|
#define VEC_safe_insert(T,V,I,O) \
|
||||||
(VEC_OP(T,safe_insert)(&(V),I,O VEC_ASSERT_INFO))
|
(VEC_OP(T,safe_insert)(&(V),I,O VEC_ASSERT_INFO))
|
||||||
|
@ -330,7 +330,7 @@
|
||||||
T VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Pointer
|
T VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Pointer
|
||||||
void VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Object
|
void VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Object
|
||||||
|
|
||||||
Remove an element from the IXth position of V. Ordering of
|
Remove an element from the IXth position of V. Ordering of
|
||||||
remaining elements is preserved. For pointer vectors returns the
|
remaining elements is preserved. For pointer vectors returns the
|
||||||
removed object. This is an O(N) operation due to a memmove. */
|
removed object. This is an O(N) operation due to a memmove. */
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@
|
||||||
T VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Pointer
|
T VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Pointer
|
||||||
void VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Object
|
void VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Object
|
||||||
|
|
||||||
Remove an element from the IXth position of V. Ordering of
|
Remove an element from the IXth position of V. Ordering of
|
||||||
remaining elements is destroyed. For pointer vectors returns the
|
remaining elements is destroyed. For pointer vectors returns the
|
||||||
removed object. This is an O(1) operation. */
|
removed object. This is an O(1) operation. */
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ static inline VEC(T) *VEC_OP (T,copy) (VEC(T) *vec_) \
|
||||||
\
|
\
|
||||||
if (len_) \
|
if (len_) \
|
||||||
{ \
|
{ \
|
||||||
/* We must request exact size allocation, hence the negation. */ \
|
/* We must request exact size allocation, hence the negation. */ \
|
||||||
new_vec_ = (VEC (T) *) \
|
new_vec_ = (VEC (T) *) \
|
||||||
vec_o_reserve (NULL, -len_, offsetof (VEC(T),vec), sizeof (T)); \
|
vec_o_reserve (NULL, -len_, offsetof (VEC(T),vec), sizeof (T)); \
|
||||||
\
|
\
|
||||||
|
@ -732,7 +732,7 @@ static inline VEC(T) *VEC_OP (T,copy) (VEC(T) *vec_) \
|
||||||
\
|
\
|
||||||
if (len_) \
|
if (len_) \
|
||||||
{ \
|
{ \
|
||||||
/* We must request exact size allocation, hence the negation. */ \
|
/* We must request exact size allocation, hence the negation. */ \
|
||||||
new_vec_ = (VEC (T) *)(vec_p_reserve (NULL, -len_)); \
|
new_vec_ = (VEC (T) *)(vec_p_reserve (NULL, -len_)); \
|
||||||
\
|
\
|
||||||
new_vec_->num = len_; \
|
new_vec_->num = len_; \
|
||||||
|
@ -965,7 +965,7 @@ static inline VEC(T) *VEC_OP (T,copy) (VEC(T) *vec_) \
|
||||||
\
|
\
|
||||||
if (len_) \
|
if (len_) \
|
||||||
{ \
|
{ \
|
||||||
/* We must request exact size allocation, hence the negation. */ \
|
/* We must request exact size allocation, hence the negation. */ \
|
||||||
new_vec_ = (VEC (T) *) \
|
new_vec_ = (VEC (T) *) \
|
||||||
vec_o_reserve (NULL, -len_, offsetof (VEC(T),vec), sizeof (T)); \
|
vec_o_reserve (NULL, -len_, offsetof (VEC(T),vec), sizeof (T)); \
|
||||||
\
|
\
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
/* Version number of GDB, as a string. */
|
/* Version number of GDB, as a string. */
|
||||||
extern const char version[];
|
extern const char version[];
|
||||||
|
|
||||||
/* Canonical host name as a string. */
|
/* Canonical host name as a string. */
|
||||||
extern const char host_name[];
|
extern const char host_name[];
|
||||||
|
|
||||||
/* Canonical target name as a string. */
|
/* Canonical target name as a string. */
|
||||||
extern const char target_name[];
|
extern const char target_name[];
|
||||||
|
|
||||||
#endif /* #ifndef VERSION_H */
|
#endif /* #ifndef VERSION_H */
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -107,13 +108,14 @@ static struct target_ops windows_ops;
|
||||||
# define bad_GetModuleFileNameEx bad_GetModuleFileNameExA
|
# define bad_GetModuleFileNameEx bad_GetModuleFileNameExA
|
||||||
#else
|
#else
|
||||||
# define __PMAX PATH_MAX
|
# define __PMAX PATH_MAX
|
||||||
/* The starting and ending address of the cygwin1.dll text segment. */
|
/* The starting and ending address of the cygwin1.dll text segment. */
|
||||||
static CORE_ADDR cygwin_load_start;
|
static CORE_ADDR cygwin_load_start;
|
||||||
static CORE_ADDR cygwin_load_end;
|
static CORE_ADDR cygwin_load_end;
|
||||||
# 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,12 +137,14 @@ 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
|
||||||
headers in the first place since they were our own invention... */
|
headers in the first place since they were our own invention... */
|
||||||
#ifndef _GNU_H_WINDOWS_H
|
#ifndef _GNU_H_WINDOWS_H
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -166,7 +170,7 @@ static int windows_initialization_done;
|
||||||
#define DR6_CLEAR_VALUE 0xffff0ff0
|
#define DR6_CLEAR_VALUE 0xffff0ff0
|
||||||
|
|
||||||
/* The string sent by cygwin when it processes a signal.
|
/* The string sent by cygwin when it processes a signal.
|
||||||
FIXME: This should be in a cygwin include file. */
|
FIXME: This should be in a cygwin include file. */
|
||||||
#ifndef _CYGWIN_SIGNAL_STRING
|
#ifndef _CYGWIN_SIGNAL_STRING
|
||||||
#define _CYGWIN_SIGNAL_STRING "cYgSiGw00f"
|
#define _CYGWIN_SIGNAL_STRING "cYgSiGw00f"
|
||||||
#endif
|
#endif
|
||||||
|
@ -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. */
|
||||||
|
@ -206,7 +210,7 @@ thread_info;
|
||||||
|
|
||||||
static thread_info thread_head;
|
static thread_info thread_head;
|
||||||
|
|
||||||
/* The process and thread handles for the above context. */
|
/* The process and thread handles for the above context. */
|
||||||
|
|
||||||
static DEBUG_EVENT current_event; /* The current debug event from
|
static DEBUG_EVENT current_event; /* The current debug event from
|
||||||
WaitForDebugEvent */
|
WaitForDebugEvent */
|
||||||
|
@ -214,13 +218,13 @@ static HANDLE current_process_handle; /* Currently executing process */
|
||||||
static thread_info *current_thread; /* Info on currently selected thread */
|
static thread_info *current_thread; /* Info on currently selected thread */
|
||||||
static DWORD main_thread_id; /* Thread ID of the main thread */
|
static DWORD main_thread_id; /* Thread ID of the main thread */
|
||||||
|
|
||||||
/* Counts of things. */
|
/* Counts of things. */
|
||||||
static int exception_count = 0;
|
static int exception_count = 0;
|
||||||
static int event_count = 0;
|
static int event_count = 0;
|
||||||
static int saw_create;
|
static int saw_create;
|
||||||
static int open_process_used = 0;
|
static int open_process_used = 0;
|
||||||
|
|
||||||
/* User options. */
|
/* User options. */
|
||||||
static int new_console = 0;
|
static int new_console = 0;
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
static int cygwin_exceptions = 0;
|
static int cygwin_exceptions = 0;
|
||||||
|
@ -245,15 +249,15 @@ static int useshell = 0; /* use shell for subprocesses */
|
||||||
One day we could read a reg, we could inspect the context we
|
One day we could read a reg, we could inspect the context we
|
||||||
already have loaded, if it doesn't have the bit set that we need,
|
already have loaded, if it doesn't have the bit set that we need,
|
||||||
we read that set of registers in using GetThreadContext. If the
|
we read that set of registers in using GetThreadContext. If the
|
||||||
context already contains what we need, we just unpack it. Then to
|
context already contains what we need, we just unpack it. Then to
|
||||||
write a register, first we have to ensure that the context contains
|
write a register, first we have to ensure that the context contains
|
||||||
the other regs of the group, and then we copy the info in and set
|
the other regs of the group, and then we copy the info in and set
|
||||||
out bit. */
|
out bit. */
|
||||||
|
|
||||||
static const int *mappings;
|
static const int *mappings;
|
||||||
|
|
||||||
/* This vector maps the target's idea of an exception (extracted
|
/* This vector maps the target's idea of an exception (extracted
|
||||||
from the DEBUG_EVENT structure) to GDB's idea. */
|
from the DEBUG_EVENT structure) to GDB's idea. */
|
||||||
|
|
||||||
struct xlate_exception
|
struct xlate_exception
|
||||||
{
|
{
|
||||||
|
@ -363,7 +367,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear out any old thread list and reintialize it to a
|
/* Clear out any old thread list and reintialize it to a
|
||||||
pristine state. */
|
pristine state. */
|
||||||
static void
|
static void
|
||||||
windows_init_thread_list (void)
|
windows_init_thread_list (void)
|
||||||
{
|
{
|
||||||
|
@ -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 (¤t_thread->context, &saved_context, __COPY_CONTEXT_SIZE);
|
"saved_context. */
|
||||||
|
memcpy (¤t_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 *) ¤t_thread->context) + mappings[r]);
|
((char *) ¤t_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,43 +526,45 @@ 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
|
||||||
posix form. __PMAX is always enough
|
posix form. __PMAX is always enough
|
||||||
as long as SO_NAME_MAX_PATH_SIZE is defined
|
as long as SO_NAME_MAX_PATH_SIZE is defined
|
||||||
as 512. */
|
as 512. */
|
||||||
#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;
|
||||||
|
@ -591,7 +601,7 @@ struct safe_symbol_file_add_args
|
||||||
struct objfile *ret;
|
struct objfile *ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Maintain a linked list of "so" information. */
|
/* Maintain a linked list of "so" information. */
|
||||||
struct lm_info
|
struct lm_info
|
||||||
{
|
{
|
||||||
LPVOID load_addr;
|
LPVOID load_addr;
|
||||||
|
@ -600,7 +610,7 @@ struct lm_info
|
||||||
static struct so_list solib_start, *solib_end;
|
static struct so_list solib_start, *solib_end;
|
||||||
|
|
||||||
/* Call symbol_file_add with stderr redirected. We don't care if there
|
/* Call symbol_file_add with stderr redirected. We don't care if there
|
||||||
are errors. */
|
are errors. */
|
||||||
static int
|
static int
|
||||||
safe_symbol_file_add_stub (void *argv)
|
safe_symbol_file_add_stub (void *argv)
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -626,7 +636,7 @@ safe_symbol_file_add_cleanup (void *p)
|
||||||
#undef sp
|
#undef sp
|
||||||
}
|
}
|
||||||
|
|
||||||
/* symbol_file_add wrapper that prevents errors from being displayed. */
|
/* symbol_file_add wrapper that prevents errors from being displayed. */
|
||||||
static struct objfile *
|
static struct objfile *
|
||||||
safe_symbol_file_add (char *name, int from_tty,
|
safe_symbol_file_add (char *name, int from_tty,
|
||||||
struct section_addr_info *addrs,
|
struct section_addr_info *addrs,
|
||||||
|
@ -751,8 +761,9 @@ 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);
|
||||||
|
@ -778,17 +789,18 @@ get_image_name (HANDLE h, void *address, int unicode)
|
||||||
|
|
||||||
/* Attempt to read the name of the dll that was detected.
|
/* Attempt to read the name of the dll that was detected.
|
||||||
This is documented to work only when actively debugging
|
This is documented to work only when actively debugging
|
||||||
a program. It will not work for attached processes. */
|
a program. It will not work for attached processes. */
|
||||||
if (address == NULL)
|
if (address == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* 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;
|
||||||
|
@ -883,7 +895,7 @@ handle_unload_dll (void *dummy)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear list of loaded DLLs. */
|
/* Clear list of loaded DLLs. */
|
||||||
static void
|
static void
|
||||||
windows_clear_solib (void)
|
windows_clear_solib (void)
|
||||||
{
|
{
|
||||||
|
@ -891,7 +903,7 @@ windows_clear_solib (void)
|
||||||
solib_end = &solib_start;
|
solib_end = &solib_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load DLL symbol info. */
|
/* Load DLL symbol info. */
|
||||||
void
|
void
|
||||||
dll_symbol_command (char *args, int from_tty)
|
dll_symbol_command (char *args, int from_tty)
|
||||||
{
|
{
|
||||||
|
@ -915,7 +927,7 @@ dll_symbol_command (char *args, int from_tty)
|
||||||
|
|
||||||
/* Handle DEBUG_STRING output from child process.
|
/* Handle DEBUG_STRING output from child process.
|
||||||
Cygwin prepends its messages with a "cygwin:". Interpret this as
|
Cygwin prepends its messages with a "cygwin:". Interpret this as
|
||||||
a Cygwin signal. Otherwise just print the string as a warning. */
|
a Cygwin signal. Otherwise just print the string as a warning. */
|
||||||
static int
|
static int
|
||||||
handle_output_debug_string (struct target_waitstatus *ourstatus)
|
handle_output_debug_string (struct target_waitstatus *ourstatus)
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
within the text segment of the DLL itself. */
|
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. */
|
||||||
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
|
||||||
|
@ -1195,7 +1217,7 @@ handle_exception (struct target_waitstatus *ourstatus)
|
||||||
ourstatus->value.sig = TARGET_SIGNAL_ILL;
|
ourstatus->value.sig = TARGET_SIGNAL_ILL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Treat unhandled first chance exceptions specially. */
|
/* Treat unhandled first chance exceptions specially. */
|
||||||
if (current_event.u.Exception.dwFirstChance)
|
if (current_event.u.Exception.dwFirstChance)
|
||||||
return -1;
|
return -1;
|
||||||
printf_unfiltered ("gdb: unknown target exception 0x%08lx at %s\n",
|
printf_unfiltered ("gdb: unknown target exception 0x%08lx at %s\n",
|
||||||
|
@ -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,
|
||||||
|
@ -1365,7 +1387,7 @@ windows_resume (struct target_ops *ops,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allow continuing with the same signal that interrupted us.
|
/* Allow continuing with the same signal that interrupted us.
|
||||||
Otherwise complain. */
|
Otherwise complain. */
|
||||||
|
|
||||||
if (resume_all)
|
if (resume_all)
|
||||||
windows_continue (continue_status, -1);
|
windows_continue (continue_status, -1);
|
||||||
|
@ -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;
|
||||||
|
@ -1439,14 +1461,14 @@ get_windows_debug_event (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
/* Kludge around a Windows bug where first event is a create
|
/* Kludge around a Windows bug where first event is a create
|
||||||
thread event. Caused when attached process does not have
|
thread event. Caused when attached process does not have
|
||||||
a main thread. */
|
a main thread. */
|
||||||
retval = fake_create_process ();
|
retval = fake_create_process ();
|
||||||
if (retval)
|
if (retval)
|
||||||
saw_create++;
|
saw_create++;
|
||||||
}
|
}
|
||||||
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,
|
||||||
|
@ -1612,7 +1634,7 @@ windows_wait (struct target_ops *ops,
|
||||||
with a SPURIOUS because resume can try and step or modify things,
|
with a SPURIOUS because resume can try and step or modify things,
|
||||||
which needs a current_thread->h. But some of these exceptions mark
|
which needs a current_thread->h. But some of these exceptions mark
|
||||||
the birth or death of threads, which mean that the current thread
|
the birth or death of threads, which mean that the current thread
|
||||||
isn't necessarily what you think it is. */
|
isn't necessarily what you think it is. */
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -1625,8 +1647,8 @@ windows_wait (struct target_ops *ops,
|
||||||
- The debugger and the program do not share the console, in
|
- The debugger and the program do not share the console, in
|
||||||
which case the Ctrl-c event only reached the debugger.
|
which case the Ctrl-c event only reached the debugger.
|
||||||
In that case, the ctrl_c handler will take care of interrupting
|
In that case, the ctrl_c handler will take care of interrupting
|
||||||
the inferior. Note that this case is working starting with
|
the inferior. Note that this case is working starting with
|
||||||
Windows XP. For Windows 2000, Ctrl-C should be pressed in the
|
Windows XP. For Windows 2000, Ctrl-C should be pressed in the
|
||||||
inferior console.
|
inferior console.
|
||||||
|
|
||||||
- The debugger and the program share the same console, in which
|
- The debugger and the program share the same console, in which
|
||||||
|
@ -1727,7 +1749,7 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
|
||||||
|
|
||||||
This code is copied from the Cygwin source code and rearranged to allow
|
This code is copied from the Cygwin source code and rearranged to allow
|
||||||
dynamically loading of the needed symbols from advapi32 which is only
|
dynamically loading of the needed symbols from advapi32 which is only
|
||||||
available on NT/2K/XP. */
|
available on NT/2K/XP. */
|
||||||
static int
|
static int
|
||||||
set_process_privilege (const char *privilege, BOOL enable)
|
set_process_privilege (const char *privilege, BOOL enable)
|
||||||
{
|
{
|
||||||
|
@ -1755,9 +1777,9 @@ set_process_privilege (const char *privilege, BOOL enable)
|
||||||
#if 0
|
#if 0
|
||||||
/* Disabled, otherwise every `attach' in an unprivileged user session
|
/* Disabled, otherwise every `attach' in an unprivileged user session
|
||||||
would raise the "Failed to get SE_DEBUG_NAME privilege" warning in
|
would raise the "Failed to get SE_DEBUG_NAME privilege" warning in
|
||||||
windows_attach(). */
|
windows_attach(). */
|
||||||
/* AdjustTokenPrivileges returns TRUE even if the privilege could not
|
/* AdjustTokenPrivileges returns TRUE even if the privilege could not
|
||||||
be enabled. GetLastError () returns an correct error code, though. */
|
be enabled. GetLastError () returns an correct error code, though. */
|
||||||
if (enable && GetLastError () == ERROR_NOT_ALL_ASSIGNED)
|
if (enable && GetLastError () == ERROR_NOT_ALL_ASSIGNED)
|
||||||
goto out;
|
goto out;
|
||||||
#endif
|
#endif
|
||||||
|
@ -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);
|
||||||
|
@ -1874,7 +1897,7 @@ windows_pid_to_exec_file (int pid)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If we get here then either Cygwin is hosed, this isn't a Cygwin version
|
/* If we get here then either Cygwin is hosed, this isn't a Cygwin version
|
||||||
of gdb, or we're trying to debug a non-Cygwin windows executable. */
|
of gdb, or we're trying to debug a non-Cygwin windows executable. */
|
||||||
if (!get_module_name (0, path))
|
if (!get_module_name (0, path))
|
||||||
path[0] = '\0';
|
path[0] = '\0';
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -2163,7 +2187,7 @@ windows_mourn_inferior (struct target_ops *ops)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send a SIGINT to the process group. This acts just like the user typed a
|
/* Send a SIGINT to the process group. This acts just like the user typed a
|
||||||
^C on the controlling terminal. */
|
^C on the controlling terminal. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
windows_stop (ptid_t ptid)
|
windows_stop (ptid_t ptid)
|
||||||
|
@ -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
|
||||||
|
@ -2239,7 +2263,7 @@ windows_close (int x)
|
||||||
PIDGET (inferior_ptid)));
|
PIDGET (inferior_ptid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert pid to printable format. */
|
/* Convert pid to printable format. */
|
||||||
static char *
|
static char *
|
||||||
windows_pid_to_str (struct target_ops *ops, ptid_t ptid)
|
windows_pid_to_str (struct target_ops *ops, ptid_t ptid)
|
||||||
{
|
{
|
||||||
|
@ -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,
|
||||||
|
@ -2532,7 +2558,7 @@ cygwin_get_dr6 (void)
|
||||||
|
|
||||||
/* Determine if the thread referenced by "ptid" is alive
|
/* Determine if the thread referenced by "ptid" is alive
|
||||||
by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0
|
by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0
|
||||||
it means that the thread has died. Otherwise it is assumed to be alive. */
|
it means that the thread has died. Otherwise it is assumed to be alive. */
|
||||||
static int
|
static int
|
||||||
windows_thread_alive (struct target_ops *ops, ptid_t ptid)
|
windows_thread_alive (struct target_ops *ops, ptid_t ptid)
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
|
@ -2575,7 +2601,7 @@ _initialize_check_for_gdb_ini (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define dummy functions which always return error for the rare cases where
|
/* Define dummy functions which always return error for the rare cases where
|
||||||
these functions could not be found. */
|
these functions could not be found. */
|
||||||
static BOOL WINAPI
|
static BOOL WINAPI
|
||||||
bad_DebugActiveProcessStop (DWORD w)
|
bad_DebugActiveProcessStop (DWORD w)
|
||||||
{
|
{
|
||||||
|
@ -2639,7 +2665,7 @@ bad_GetConsoleFontSize (HANDLE w, DWORD nFont)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load any functions which may not be available in ancient versions
|
/* Load any functions which may not be available in ancient versions
|
||||||
of Windows. */
|
of Windows. */
|
||||||
void
|
void
|
||||||
_initialize_loadable (void)
|
_initialize_loadable (void)
|
||||||
{
|
{
|
||||||
|
@ -2661,7 +2687,7 @@ _initialize_loadable (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set variables to dummy versions of these processes if the function
|
/* Set variables to dummy versions of these processes if the function
|
||||||
wasn't found in kernel32.dll. */
|
wasn't found in kernel32.dll. */
|
||||||
if (!DebugBreakProcess)
|
if (!DebugBreakProcess)
|
||||||
DebugBreakProcess = bad_DebugBreakProcess;
|
DebugBreakProcess = bad_DebugBreakProcess;
|
||||||
if (!DebugActiveProcessStop || !DebugSetProcessKillOnExit)
|
if (!DebugActiveProcessStop || !DebugSetProcessKillOnExit)
|
||||||
|
@ -2675,7 +2701,7 @@ _initialize_loadable (void)
|
||||||
GetCurrentConsoleFont = bad_GetCurrentConsoleFont;
|
GetCurrentConsoleFont = bad_GetCurrentConsoleFont;
|
||||||
|
|
||||||
/* Load optional functions used for retrieving filename information
|
/* Load optional functions used for retrieving filename information
|
||||||
associated with the currently debugged process or its dlls. */
|
associated with the currently debugged process or its dlls. */
|
||||||
hm = LoadLibrary ("psapi.dll");
|
hm = LoadLibrary ("psapi.dll");
|
||||||
if (hm)
|
if (hm)
|
||||||
{
|
{
|
||||||
|
@ -2690,13 +2716,15 @@ _initialize_loadable (void)
|
||||||
if (!EnumProcessModules || !GetModuleInformation || !GetModuleFileNameEx)
|
if (!EnumProcessModules || !GetModuleInformation || !GetModuleFileNameEx)
|
||||||
{
|
{
|
||||||
/* Set variables to dummy versions of these processes if the function
|
/* Set variables to dummy versions of these processes if the function
|
||||||
wasn't found in psapi.dll. */
|
wasn't found in psapi.dll. */
|
||||||
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");
|
||||||
|
@ -2708,8 +2736,9 @@ _initialize_loadable (void)
|
||||||
AdjustTokenPrivileges = (void *)
|
AdjustTokenPrivileges = (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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 (¤t_target, TARGET_OBJECT_MEMORY,
|
if (target_read (¤t_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;
|
||||||
|
@ -388,7 +393,7 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
|
||||||
obstack_grow_str (obstack, "\"><segment address=\"");
|
obstack_grow_str (obstack, "\"><segment address=\"");
|
||||||
/* 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 file
|
offset from 0 of the first byte in an image - because of the file
|
||||||
header and the section alignment. */
|
header and the section alignment. */
|
||||||
obstack_grow_str (obstack, paddress (gdbarch, load_addr + 0x1000));
|
obstack_grow_str (obstack, paddress (gdbarch, load_addr + 0x1000));
|
||||||
obstack_grow_str (obstack, "\"/></library>");
|
obstack_grow_str (obstack, "\"/></library>");
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
207
gdb/xcoffread.c
207
gdb/xcoffread.c
|
@ -81,25 +81,25 @@ struct symloc
|
||||||
unsigned int lineno_off;
|
unsigned int lineno_off;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Remember what we deduced to be the source language of this psymtab. */
|
/* Remember what we deduced to be the source language of this psymtab. */
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ static bfd *symfile_bfd;
|
||||||
|
|
||||||
/* Core address of start and end of text of current source file.
|
/* Core address of start and end of text of current source file.
|
||||||
This is calculated from the first function seen after a C_FILE
|
This is calculated from the first function seen after a C_FILE
|
||||||
symbol. */
|
symbol. */
|
||||||
|
|
||||||
|
|
||||||
static CORE_ADDR cur_src_end_addr;
|
static CORE_ADDR cur_src_end_addr;
|
||||||
|
@ -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;
|
||||||
|
@ -288,7 +288,7 @@ secnum_to_bfd_section (int secnum, struct objfile *objfile)
|
||||||
return sect;
|
return sect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add a given stab string into given stab vector. */
|
/* add a given stab string into given stab vector. */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
@ -320,9 +320,9 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||||
Two reasons:
|
Two reasons:
|
||||||
|
|
||||||
1) xlc (IBM's native c compiler) postpones static function code
|
1) xlc (IBM's native c compiler) postpones static function code
|
||||||
emission to the end of a compilation unit. This way it can
|
emission to the end of a compilation unit. This way it can
|
||||||
determine if those functions (statics) are needed or not, and
|
determine if those functions (statics) are needed or not, and
|
||||||
can do some garbage collection (I think). This makes line
|
can do some garbage collection (I think). This makes line
|
||||||
numbers and corresponding addresses unordered, and we end up
|
numbers and corresponding addresses unordered, and we end up
|
||||||
with a line table like:
|
with a line table like:
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||||
60 0x900
|
60 0x900
|
||||||
|
|
||||||
and that breaks gdb's binary search on line numbers, if the
|
and that breaks gdb's binary search on line numbers, if the
|
||||||
above table is not sorted on line numbers. And that sort
|
above table is not sorted on line numbers. And that sort
|
||||||
should be on function based, since gcc can emit line numbers
|
should be on function based, since gcc can emit line numbers
|
||||||
like:
|
like:
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||||
30 0x300
|
30 0x300
|
||||||
10 0x400 - for the increment part of a for stmt.
|
10 0x400 - for the increment part of a for stmt.
|
||||||
|
|
||||||
arrange_linetable() will do this sorting.
|
arrange_linetable() will do this sorting.
|
||||||
|
|
||||||
2) aix symbol table might look like:
|
2) aix symbol table might look like:
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||||
.ei
|
.ei
|
||||||
|
|
||||||
basically, .bi/.ei pairs do not necessarily encapsulate
|
basically, .bi/.ei pairs do not necessarily encapsulate
|
||||||
their scope. They need to be recorded, and processed later
|
their scope. They need to be recorded, and processed later
|
||||||
on when we come the end of the compilation unit.
|
on when we come the end of the compilation unit.
|
||||||
Include table (inclTable) and process_linenos() handle
|
Include table (inclTable) and process_linenos() handle
|
||||||
that. */
|
that. */
|
||||||
|
@ -370,7 +370,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* compare line table entry addresses. */
|
/* compare line table entry addresses. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
compare_lte (const void *lte1p, const void *lte2p)
|
compare_lte (const void *lte1p, const void *lte2p)
|
||||||
|
@ -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,14 +430,14 @@ 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;
|
||||||
if (oldLineTb->item[0].line != 0)
|
if (oldLineTb->item[0].line != 0)
|
||||||
|
@ -444,7 +445,7 @@ arrange_linetable (struct linetable *oldLineTb)
|
||||||
newline < oldLineTb->nitems && oldLineTb->item[newline].line; ++newline)
|
newline < oldLineTb->nitems && oldLineTb->item[newline].line; ++newline)
|
||||||
newLineTb->item[newline] = oldLineTb->item[newline];
|
newLineTb->item[newline] = oldLineTb->item[newline];
|
||||||
|
|
||||||
/* Now copy function lines one by one. */
|
/* Now copy function lines one by one. */
|
||||||
|
|
||||||
for (ii = 0; ii < function_count; ++ii)
|
for (ii = 0; ii < function_count; ++ii)
|
||||||
{
|
{
|
||||||
|
@ -459,9 +460,9 @@ arrange_linetable (struct linetable *oldLineTb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* include file support: C_BINCL/C_EINCL pairs will be kept in the
|
/* include file support: C_BINCL/C_EINCL pairs will be kept in the
|
||||||
following `IncludeChain'. At the end of each symtab (end_symtab),
|
following `IncludeChain'. At the end of each symtab (end_symtab),
|
||||||
we will determine if we should create additional symtab's to
|
we will determine if we should create additional symtab's to
|
||||||
represent if (the include files. */
|
represent if (the include files. */
|
||||||
|
|
||||||
|
|
||||||
typedef struct _inclTable
|
typedef struct _inclTable
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -552,7 +553,7 @@ allocate_include_entry (void)
|
||||||
static struct partial_symtab *this_symtab_psymtab;
|
static struct partial_symtab *this_symtab_psymtab;
|
||||||
|
|
||||||
/* given the start and end addresses of a compilation unit (or a csect,
|
/* given the start and end addresses of a compilation unit (or a csect,
|
||||||
at times) process its lines and create appropriate line vectors. */
|
at times) process its lines and create appropriate line vectors. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_linenos (CORE_ADDR start, CORE_ADDR end)
|
process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||||
|
@ -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);
|
||||||
|
@ -610,7 +612,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||||
if (strcmp (inclTable[ii].name, last_source_file) == 0)
|
if (strcmp (inclTable[ii].name, last_source_file) == 0)
|
||||||
{
|
{
|
||||||
/* The entry in the include table refers to the main source
|
/* The entry in the include table refers to the main source
|
||||||
file. Add the lines to the main subfile. */
|
file. Add the lines to the main subfile. */
|
||||||
|
|
||||||
main_source_baseline = inclTable[ii].funStartLine;
|
main_source_baseline = inclTable[ii].funStartLine;
|
||||||
enter_line_range
|
enter_line_range
|
||||||
|
@ -653,8 +655,8 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||||
|
|
||||||
lv = main_subfile.line_vector;
|
lv = main_subfile.line_vector;
|
||||||
|
|
||||||
/* Line numbers are not necessarily ordered. xlc compilation will
|
/* Line numbers are not necessarily ordered. xlc compilation will
|
||||||
put static function to the end. */
|
put static function to the end. */
|
||||||
|
|
||||||
lineTb = arrange_linetable (lv);
|
lineTb = arrange_linetable (lv);
|
||||||
if (lv == lineTb)
|
if (lv == lineTb)
|
||||||
|
@ -685,8 +687,8 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||||
|
|
||||||
lv = (inclTable[ii].subfile)->line_vector;
|
lv = (inclTable[ii].subfile)->line_vector;
|
||||||
|
|
||||||
/* Line numbers are not necessarily ordered. xlc compilation will
|
/* Line numbers are not necessarily ordered. xlc compilation will
|
||||||
put static function to the end. */
|
put static function to the end. */
|
||||||
|
|
||||||
lineTb = arrange_linetable (lv);
|
lineTb = arrange_linetable (lv);
|
||||||
|
|
||||||
|
@ -701,7 +703,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||||
#include "foo.h"
|
#include "foo.h"
|
||||||
......
|
......
|
||||||
|
|
||||||
while foo.h including code in it. (stupid but possible)
|
while foo.h including code in it. (stupid but possible)
|
||||||
Since start_subfile() looks at the name and uses an
|
Since start_subfile() looks at the name and uses an
|
||||||
existing one if finds, we need to provide a fake name and
|
existing one if finds, we need to provide a fake name and
|
||||||
fool it. */
|
fool it. */
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -856,7 +858,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
|
||||||
(into the string table) but this does no harm. */
|
(into the string table) but this does no harm. */
|
||||||
|
|
||||||
/* Reading symbol table has to be fast! Keep the followings as macros, rather
|
/* Reading symbol table has to be fast! Keep the followings as macros, rather
|
||||||
than functions. */
|
than functions. */
|
||||||
|
|
||||||
#define RECORD_MINIMAL_SYMBOL(NAME, ADDR, TYPE, SECTION, OBJFILE) \
|
#define RECORD_MINIMAL_SYMBOL(NAME, ADDR, TYPE, SECTION, OBJFILE) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -871,9 +873,9 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* xcoff has static blocks marked in `.bs', `.es' pairs. They cannot be
|
/* xcoff has static blocks marked in `.bs', `.es' pairs. They cannot be
|
||||||
nested. At any given time, a symbol can only be in one static block.
|
nested. At any given time, a symbol can only be in one static block.
|
||||||
This is the base address of current static block, zero if non exists. */
|
This is the base address of current static block, zero if non exists. */
|
||||||
|
|
||||||
static int static_block_base = 0;
|
static int static_block_base = 0;
|
||||||
|
|
||||||
|
@ -881,7 +883,7 @@ static int static_block_base = 0;
|
||||||
|
|
||||||
static int static_block_section = -1;
|
static int static_block_section = -1;
|
||||||
|
|
||||||
/* true if space for symbol name has been allocated. */
|
/* true if space for symbol name has been allocated. */
|
||||||
|
|
||||||
static int symname_alloced = 0;
|
static int symname_alloced = 0;
|
||||||
|
|
||||||
|
@ -898,7 +900,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
|
||||||
struct internal_syment symbol;
|
struct internal_syment symbol;
|
||||||
char *retval;
|
char *retval;
|
||||||
|
|
||||||
/* FIXME: is this the same as the passed arg? */
|
/* FIXME: is this the same as the passed arg? */
|
||||||
if (this_symtab_psymtab)
|
if (this_symtab_psymtab)
|
||||||
objfile = this_symtab_psymtab->objfile;
|
objfile = this_symtab_psymtab->objfile;
|
||||||
|
|
||||||
|
@ -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 =
|
||||||
|
@ -958,20 +960,20 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
|
|
||||||
struct coff_symbol fcn_stab_saved = { 0 };
|
struct coff_symbol fcn_stab_saved = { 0 };
|
||||||
|
|
||||||
/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
|
/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
|
||||||
union internal_auxent fcn_aux_saved;
|
union internal_auxent fcn_aux_saved;
|
||||||
struct context_stack *new;
|
struct context_stack *new;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
this_symtab_psymtab = pst;
|
this_symtab_psymtab = pst;
|
||||||
|
|
||||||
/* Get the appropriate COFF "constants" related to the file we're
|
/* Get the appropriate COFF "constants" related to the file we're
|
||||||
handling. */
|
handling. */
|
||||||
local_symesz = coff_data (abfd)->local_symesz;
|
local_symesz = coff_data (abfd)->local_symesz;
|
||||||
|
|
||||||
last_source_file = NULL;
|
last_source_file = NULL;
|
||||||
|
@ -995,11 +997,11 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
QUIT; /* make this command interruptable. */
|
QUIT; /* make this command interruptable. */
|
||||||
|
|
||||||
/* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
|
/* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
|
||||||
/* read one symbol into `cs' structure. After processing the
|
/* read one symbol into `cs' structure. After processing the
|
||||||
whole symbol table, only string table will be kept in memory,
|
whole symbol table, only string table will be kept in memory,
|
||||||
symbol table and debug section of xcoff will be freed. Thus
|
symbol table and debug section of xcoff will be freed. Thus
|
||||||
we can mark symbols with names in string table as
|
we can mark symbols with names in string table as
|
||||||
`alloced'. */
|
`alloced'. */
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
|
@ -1058,7 +1060,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if symbol name starts with ".$" or "$", ignore it. */
|
/* if symbol name starts with ".$" or "$", ignore it. */
|
||||||
if (cs->c_name[0] == '$'
|
if (cs->c_name[0] == '$'
|
||||||
|| (cs->c_name[1] == '$' && cs->c_name[0] == '.'))
|
|| (cs->c_name[1] == '$' && cs->c_name[0] == '.'))
|
||||||
continue;
|
continue;
|
||||||
|
@ -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)
|
||||||
|
@ -1115,7 +1117,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
prefers one symtab for each source file. In case
|
prefers one symtab for each source file. In case
|
||||||
of AIX, one source file might include more than one
|
of AIX, one source file might include more than one
|
||||||
[PR] csect, and they don't have to be adjacent in
|
[PR] csect, and they don't have to be adjacent in
|
||||||
terms of the space they occupy in memory. Thus, one
|
terms of the space they occupy in memory. Thus, one
|
||||||
single source file might get fragmented in the
|
single source file might get fragmented in the
|
||||||
memory and gdb's file start and end address
|
memory and gdb's file start and end address
|
||||||
approach does not work! GCC (and I think xlc) seem
|
approach does not work! GCC (and I think xlc) seem
|
||||||
|
@ -1136,7 +1138,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is the very first csect seen,
|
/* If this is the very first csect seen,
|
||||||
basically `__start'. */
|
basically `__start'. */
|
||||||
if (just_started)
|
if (just_started)
|
||||||
{
|
{
|
||||||
first_object_file_end
|
first_object_file_end
|
||||||
|
@ -1184,19 +1186,19 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
switch (CSECT_SCLAS (&main_aux))
|
switch (CSECT_SCLAS (&main_aux))
|
||||||
{
|
{
|
||||||
case XMC_PR:
|
case XMC_PR:
|
||||||
/* a function entry point. */
|
/* a function entry point. */
|
||||||
function_entry_point:
|
function_entry_point:
|
||||||
|
|
||||||
fcn_start_addr = cs->c_value;
|
fcn_start_addr = cs->c_value;
|
||||||
|
|
||||||
/* save the function header info, which will be used
|
/* save the function header info, which will be used
|
||||||
when `.bf' is seen. */
|
when `.bf' is seen. */
|
||||||
fcn_cs_saved = *cs;
|
fcn_cs_saved = *cs;
|
||||||
fcn_aux_saved = main_aux;
|
fcn_aux_saved = main_aux;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case XMC_GL:
|
case XMC_GL:
|
||||||
/* shared library function trampoline code entry point. */
|
/* shared library function trampoline code entry point. */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case XMC_DS:
|
case XMC_DS:
|
||||||
|
@ -1208,7 +1210,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
/* xlc puts each variable in a separate csect, so we get
|
/* xlc puts each variable in a separate csect, so we get
|
||||||
an XTY_SD for each variable. But gcc puts several
|
an XTY_SD for each variable. But gcc puts several
|
||||||
variables in a csect, so that each variable only gets
|
variables in a csect, so that each variable only gets
|
||||||
an XTY_LD. This will typically be XMC_RW; I suspect
|
an XTY_LD. This will typically be XMC_RW; I suspect
|
||||||
XMC_RO and XMC_BS might be possible too.
|
XMC_RO and XMC_BS might be possible too.
|
||||||
These variables are put in the minimal symbol table
|
These variables are put in the minimal symbol table
|
||||||
only. */
|
only. */
|
||||||
|
@ -1240,12 +1242,12 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
case C_FILE:
|
case C_FILE:
|
||||||
|
|
||||||
/* c_value field contains symnum of next .file entry in table
|
/* c_value field contains symnum of next .file entry in table
|
||||||
or symnum of first global after last .file. */
|
or symnum of first global after last .file. */
|
||||||
|
|
||||||
next_file_symnum = cs->c_value;
|
next_file_symnum = cs->c_value;
|
||||||
|
|
||||||
/* Complete symbol table for last object file containing
|
/* Complete symbol table for last object file containing
|
||||||
debugging information. */
|
debugging information. */
|
||||||
|
|
||||||
/* Whether or not there was a csect in the previous file, we
|
/* Whether or not there was a csect in the previous file, we
|
||||||
have to call `end_stabs' and `start_stabs' to reset
|
have to call `end_stabs' and `start_stabs' to reset
|
||||||
|
@ -1276,9 +1278,9 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
record_debugformat (debugfmt);
|
record_debugformat (debugfmt);
|
||||||
last_csect_name = 0;
|
last_csect_name = 0;
|
||||||
|
|
||||||
/* reset file start and end addresses. A compilation unit
|
/* reset file start and end addresses. A compilation unit
|
||||||
with no text (only data) should have zero file
|
with no text (only data) should have zero file
|
||||||
boundaries. */
|
boundaries. */
|
||||||
file_start_addr = file_end_addr = 0;
|
file_start_addr = file_end_addr = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -1385,9 +1387,9 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
case C_BINCL:
|
case C_BINCL:
|
||||||
/* beginning of include file */
|
/* beginning of include file */
|
||||||
/* In xlc output, C_BINCL/C_EINCL pair doesn't show up in sorted
|
/* In xlc output, C_BINCL/C_EINCL pair doesn't show up in sorted
|
||||||
order. Thus, when wee see them, we might not know enough info
|
order. Thus, when wee see them, we might not know enough info
|
||||||
to process them. Thus, we'll be saving them into a table
|
to process them. Thus, we'll be saving them into a table
|
||||||
(inclTable) and postpone their processing. */
|
(inclTable) and postpone their processing. */
|
||||||
|
|
||||||
record_include_begin (cs);
|
record_include_begin (cs);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -1468,7 +1470,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||||
&objfile->objfile_obstack))
|
&objfile->objfile_obstack))
|
||||||
|
|
||||||
|
|
||||||
/* process one xcoff symbol. */
|
/* process one xcoff symbol. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct symbol *
|
||||||
process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
|
process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
|
||||||
|
@ -1524,7 +1526,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* In case we can't figure out the type, provide default. */
|
/* In case we can't figure out the type, provide default. */
|
||||||
SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_data_symbol;
|
SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_data_symbol;
|
||||||
|
|
||||||
switch (cs->c_sclass)
|
switch (cs->c_sclass)
|
||||||
|
@ -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));
|
||||||
|
|
||||||
|
@ -1887,7 +1889,7 @@ xcoff_symfile_init (struct objfile *objfile)
|
||||||
/* Perform any local cleanups required when we are done with a particular
|
/* Perform any local cleanups required when we are done with a particular
|
||||||
objfile. I.E, we are in the process of discarding all symbol information
|
objfile. I.E, we are in the process of discarding all symbol information
|
||||||
for an objfile, freeing up all memory held for it, and unlinking the
|
for an objfile, freeing up all memory held for it, and unlinking the
|
||||||
objfile struct from the global list of known objfiles. */
|
objfile struct from the global list of known objfiles. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xcoff_symfile_finish (struct objfile *objfile)
|
xcoff_symfile_finish (struct objfile *objfile)
|
||||||
|
@ -1931,8 +1933,8 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
|
||||||
if (val != sizeof lengthbuf || length < sizeof lengthbuf)
|
if (val != sizeof lengthbuf || length < sizeof lengthbuf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Allocate string table from objfile_obstack. We will need this table
|
/* Allocate string table from objfile_obstack. We will need this table
|
||||||
as long as we have its symbol table around. */
|
as long as we have its symbol table around. */
|
||||||
|
|
||||||
strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length);
|
strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length);
|
||||||
((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl
|
((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl
|
||||||
|
@ -1970,7 +1972,7 @@ static struct partial_symtab *xcoff_start_psymtab
|
||||||
|
|
||||||
SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
|
SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
|
||||||
is the address relative to which its symbols are (incremental) or 0
|
is the address relative to which its symbols are (incremental) or 0
|
||||||
(normal). */
|
(normal). */
|
||||||
|
|
||||||
static struct partial_symtab *
|
static struct partial_symtab *
|
||||||
xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum,
|
xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum,
|
||||||
|
@ -1989,7 +1991,7 @@ xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum,
|
||||||
((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
|
((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
|
||||||
result->read_symtab = xcoff_psymtab_to_symtab;
|
result->read_symtab = xcoff_psymtab_to_symtab;
|
||||||
|
|
||||||
/* Deduce the source language from the filename for this psymtab. */
|
/* Deduce the source language from the filename for this psymtab. */
|
||||||
psymtab_language = deduce_language_from_filename (filename);
|
psymtab_language = deduce_language_from_filename (filename);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1999,7 +2001,7 @@ static struct partial_symtab *xcoff_end_psymtab
|
||||||
(struct partial_symtab *, char **, int, int,
|
(struct partial_symtab *, char **, int, int,
|
||||||
struct partial_symtab **, int, int);
|
struct partial_symtab **, int, int);
|
||||||
|
|
||||||
/* Close off the current usage of PST.
|
/* Close off the current usage of PST.
|
||||||
Returns PST, or NULL if the partial symtab was empty and thrown away.
|
Returns PST, or NULL if the partial symtab was empty and thrown away.
|
||||||
|
|
||||||
CAPPING_SYMBOL_NUMBER is the end of pst (exclusive).
|
CAPPING_SYMBOL_NUMBER is the end of pst (exclusive).
|
||||||
|
@ -2160,7 +2162,7 @@ static void
|
||||||
scan_xcoff_symtab (struct objfile *objfile)
|
scan_xcoff_symtab (struct objfile *objfile)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||||
CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
|
CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
|
||||||
char *filestring = NULL;
|
char *filestring = NULL;
|
||||||
|
|
||||||
char *namestring;
|
char *namestring;
|
||||||
|
@ -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;
|
||||||
|
@ -2263,7 +2265,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||||
if (last_csect_name)
|
if (last_csect_name)
|
||||||
{
|
{
|
||||||
/* If no misc. function recorded in the last
|
/* If no misc. function recorded in the last
|
||||||
seen csect, enter it as a function. This
|
seen csect, enter it as a function. This
|
||||||
will take care of functions like strcmp()
|
will take care of functions like strcmp()
|
||||||
compiled by xlc. */
|
compiled by xlc. */
|
||||||
|
|
||||||
|
@ -2372,12 +2374,12 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||||
|
|
||||||
case XMC_GL:
|
case XMC_GL:
|
||||||
/* shared library function trampoline code entry
|
/* shared library function trampoline code entry
|
||||||
point. */
|
point. */
|
||||||
|
|
||||||
/* record trampoline code entries as
|
/* record trampoline code entries as
|
||||||
mst_solib_trampoline symbol. When we lookup mst
|
mst_solib_trampoline symbol. When we lookup mst
|
||||||
symbols, we will choose mst_text over
|
symbols, we will choose mst_text over
|
||||||
mst_solib_trampoline. */
|
mst_solib_trampoline. */
|
||||||
RECORD_MINIMAL_SYMBOL
|
RECORD_MINIMAL_SYMBOL
|
||||||
(namestring, symbol.n_value,
|
(namestring, symbol.n_value,
|
||||||
mst_solib_trampoline,
|
mst_solib_trampoline,
|
||||||
|
@ -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,
|
||||||
|
@ -2565,7 +2567,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||||
|
|
||||||
/* In C++, one may expect the same filename to come round many
|
/* In C++, one may expect the same filename to come round many
|
||||||
times, when code is coming alternately from the main file
|
times, when code is coming alternately from the main file
|
||||||
and from inline functions in other files. So I check to see
|
and from inline functions in other files. So I check to see
|
||||||
if this is a file we've seen before -- either the main
|
if this is a file we've seen before -- either the main
|
||||||
source file, or a previously included file.
|
source file, or a previously included file.
|
||||||
|
|
||||||
|
@ -2649,7 +2651,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||||
symbol.n_value += ANOFFSET (objfile->section_offsets,
|
symbol.n_value += ANOFFSET (objfile->section_offsets,
|
||||||
SECT_OFF_DATA (objfile));
|
SECT_OFF_DATA (objfile));
|
||||||
/* The addresses in these entries are reported to be
|
/* The addresses in these entries are reported to be
|
||||||
wrong. See the code that reads 'G's for symtabs. */
|
wrong. See the code that reads 'G's for symtabs. */
|
||||||
add_psymbol_to_list (namestring, p - namestring, 1,
|
add_psymbol_to_list (namestring, p - namestring, 1,
|
||||||
VAR_DOMAIN, LOC_STATIC,
|
VAR_DOMAIN, LOC_STATIC,
|
||||||
&objfile->global_psymbols,
|
&objfile->global_psymbols,
|
||||||
|
@ -2687,7 +2689,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||||
goto check_enum;
|
goto check_enum;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
if (p != namestring) /* a name is there, not just :T... */
|
if (p != namestring) /* a name is there, not just :T... */
|
||||||
{
|
{
|
||||||
add_psymbol_to_list (namestring, p - namestring, 1,
|
add_psymbol_to_list (namestring, p - namestring, 1,
|
||||||
VAR_DOMAIN, LOC_TYPEDEF,
|
VAR_DOMAIN, LOC_TYPEDEF,
|
||||||
|
@ -2812,9 +2814,9 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need only the minimal symbols for these
|
/* We need only the minimal symbols for these
|
||||||
loader-generated definitions. Keeping the global
|
loader-generated definitions. Keeping the global
|
||||||
symbols leads to "in psymbols but not in symbols"
|
symbols leads to "in psymbols but not in symbols"
|
||||||
errors. */
|
errors. */
|
||||||
if (strncmp (namestring, "@FIX", 4) == 0)
|
if (strncmp (namestring, "@FIX", 4) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
@ -3011,7 +3014,7 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
|
||||||
scan_xcoff_symtab (objfile);
|
scan_xcoff_symtab (objfile);
|
||||||
|
|
||||||
/* Install any minimal symbols that have been collected as the current
|
/* Install any minimal symbols that have been collected as the current
|
||||||
minimal symbols for this objfile. */
|
minimal symbols for this objfile. */
|
||||||
|
|
||||||
install_minimal_symbols (objfile);
|
install_minimal_symbols (objfile);
|
||||||
|
|
||||||
|
@ -3030,7 +3033,7 @@ xcoff_symfile_offsets (struct objfile *objfile,
|
||||||
obstack_alloc (&objfile->objfile_obstack,
|
obstack_alloc (&objfile->objfile_obstack,
|
||||||
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
|
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
|
||||||
|
|
||||||
/* Initialize the section indexes for future use. */
|
/* Initialize the section indexes for future use. */
|
||||||
sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
||||||
if (sect)
|
if (sect)
|
||||||
objfile->sect_index_text = sect->index;
|
objfile->sect_index_text = sect->index;
|
||||||
|
|
|
@ -124,7 +124,7 @@ sharedlibrary_command (char *pattern, int from_tty)
|
||||||
if (!vp)
|
if (!vp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* skip over the first vmap, it is the main program, always loaded. */
|
/* skip over the first vmap, it is the main program, always loaded. */
|
||||||
for (vp = vp->nxt; vp; vp = vp->nxt)
|
for (vp = vp->nxt; vp; vp = vp->nxt)
|
||||||
if (! pattern
|
if (! pattern
|
||||||
|| re_exec (vp->name)
|
|| re_exec (vp->name)
|
||||||
|
|
|
@ -339,7 +339,7 @@ gdb_xml_end_element (void *data, const XML_Char *name)
|
||||||
gdb_xml_error (parser, _("Required element <%s> is missing"),
|
gdb_xml_error (parser, _("Required element <%s> is missing"),
|
||||||
element->name);
|
element->name);
|
||||||
|
|
||||||
/* Call the element processor. */
|
/* Call the element processor. */
|
||||||
if (scope->element != NULL && scope->element->end_handler)
|
if (scope->element != NULL && scope->element->end_handler)
|
||||||
{
|
{
|
||||||
char *body;
|
char *body;
|
||||||
|
|
|
@ -44,10 +44,10 @@ enum gdb_regnum
|
||||||
/* Xstormy16 has 16 general purpose registers (R0-R15) plus PC.
|
/* Xstormy16 has 16 general purpose registers (R0-R15) plus PC.
|
||||||
Functions will return their values in register R2-R7 as they fit.
|
Functions will return their values in register R2-R7 as they fit.
|
||||||
Otherwise a hidden pointer to an big enough area is given as argument
|
Otherwise a hidden pointer to an big enough area is given as argument
|
||||||
to the function in r2. Further arguments are beginning in r3 then.
|
to the function in r2. Further arguments are beginning in r3 then.
|
||||||
R13 is used as frame pointer when GCC compiles w/o optimization
|
R13 is used as frame pointer when GCC compiles w/o optimization
|
||||||
R14 is used as "PSW", displaying the CPU status.
|
R14 is used as "PSW", displaying the CPU status.
|
||||||
R15 is used implicitely as stack pointer. */
|
R15 is used implicitely as stack pointer. */
|
||||||
E_R0_REGNUM,
|
E_R0_REGNUM,
|
||||||
E_R1_REGNUM,
|
E_R1_REGNUM,
|
||||||
E_R2_REGNUM, E_1ST_ARG_REGNUM = E_R2_REGNUM, E_PTR_RET_REGNUM = E_R2_REGNUM,
|
E_R2_REGNUM, E_1ST_ARG_REGNUM = E_R2_REGNUM, E_PTR_RET_REGNUM = E_R2_REGNUM,
|
||||||
|
@ -82,7 +82,7 @@ struct xstormy16_frame_cache
|
||||||
CORE_ADDR saved_sp;
|
CORE_ADDR saved_sp;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Size of instructions, registers, etc. */
|
/* Size of instructions, registers, etc. */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
xstormy16_inst_size = 2,
|
xstormy16_inst_size = 2,
|
||||||
|
@ -90,11 +90,11 @@ enum
|
||||||
xstormy16_pc_size = 4
|
xstormy16_pc_size = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Size of return datatype which fits into the remaining return registers. */
|
/* Size of return datatype which fits into the remaining return registers. */
|
||||||
#define E_MAX_RETTYPE_SIZE(regnum) ((E_LST_ARG_REGNUM - (regnum) + 1) \
|
#define E_MAX_RETTYPE_SIZE(regnum) ((E_LST_ARG_REGNUM - (regnum) + 1) \
|
||||||
* xstormy16_reg_size)
|
* xstormy16_reg_size)
|
||||||
|
|
||||||
/* Size of return datatype which fits into all return registers. */
|
/* Size of return datatype which fits into all return registers. */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
E_MAX_RETTYPE_SIZE_IN_REGS = E_MAX_RETTYPE_SIZE (E_R2_REGNUM)
|
E_MAX_RETTYPE_SIZE_IN_REGS = E_MAX_RETTYPE_SIZE (E_R2_REGNUM)
|
||||||
|
@ -181,7 +181,7 @@ xstormy16_store_return_value (struct type *type, struct regcache *regcache,
|
||||||
{
|
{
|
||||||
if (TYPE_LENGTH (type) == 1)
|
if (TYPE_LENGTH (type) == 1)
|
||||||
{
|
{
|
||||||
/* Add leading zeros to the value. */
|
/* Add leading zeros to the value. */
|
||||||
char buf[xstormy16_reg_size];
|
char buf[xstormy16_reg_size];
|
||||||
memset (buf, 0, xstormy16_reg_size);
|
memset (buf, 0, xstormy16_reg_size);
|
||||||
memcpy (buf, valbuf, 1);
|
memcpy (buf, valbuf, 1);
|
||||||
|
@ -249,7 +249,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
||||||
argreg++;
|
argreg++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Arguments are passed in R2-R7 as they fit. If an argument doesn't
|
/* Arguments are passed in R2-R7 as they fit. If an argument doesn't
|
||||||
fit in the remaining registers we're switching over to the stack.
|
fit in the remaining registers we're switching over to the stack.
|
||||||
No argument is put on stack partially and as soon as we switched
|
No argument is put on stack partially and as soon as we switched
|
||||||
over to stack no further argument is put in a register even if it
|
over to stack no further argument is put in a register even if it
|
||||||
|
@ -260,7 +260,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
||||||
if (typelen > E_MAX_RETTYPE_SIZE (argreg))
|
if (typelen > E_MAX_RETTYPE_SIZE (argreg))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Put argument into registers wordwise. */
|
/* Put argument into registers wordwise. */
|
||||||
val = value_contents (args[i]);
|
val = value_contents (args[i]);
|
||||||
for (j = 0; j < typelen; j += xstormy16_reg_size)
|
for (j = 0; j < typelen; j += xstormy16_reg_size)
|
||||||
regcache_cooked_write_unsigned (regcache, argreg++,
|
regcache_cooked_write_unsigned (regcache, argreg++,
|
||||||
|
@ -286,7 +286,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
||||||
memcpy (val, value_contents (args[j]), typelen);
|
memcpy (val, value_contents (args[j]), typelen);
|
||||||
memset (val + typelen, 0, slacklen);
|
memset (val + typelen, 0, slacklen);
|
||||||
|
|
||||||
/* Now write this data to the stack. The stack grows upwards. */
|
/* Now write this data to the stack. The stack grows upwards. */
|
||||||
write_memory (stack_dest, val, typelen + slacklen);
|
write_memory (stack_dest, val, typelen + slacklen);
|
||||||
stack_dest += typelen + slacklen;
|
stack_dest += typelen + slacklen;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
|
||||||
LONGEST offset;
|
LONGEST offset;
|
||||||
int regnum;
|
int regnum;
|
||||||
|
|
||||||
/* Initialize framesize with size of PC put on stack by CALLF inst. */
|
/* Initialize framesize with size of PC put on stack by CALLF inst. */
|
||||||
cache->saved_regs[E_PC_REGNUM] = 0;
|
cache->saved_regs[E_PC_REGNUM] = 0;
|
||||||
cache->framesize = xstormy16_pc_size;
|
cache->framesize = xstormy16_pc_size;
|
||||||
|
|
||||||
|
@ -344,8 +344,8 @@ 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,8 +356,8 @@ 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;
|
||||||
next_addr += xstormy16_inst_size;
|
next_addr += xstormy16_inst_size;
|
||||||
|
@ -368,21 +368,22 @@ 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)
|
||||||
{
|
{
|
||||||
regnum = inst & 0x0007;
|
regnum = inst & 0x0007;
|
||||||
/* Only 12 of 16 bits of the argument are used for the
|
/* Only 12 of 16 bits of the argument are used for the
|
||||||
signed offset. */
|
signed offset. */
|
||||||
offset = (LONGEST) (inst2 & 0x0fff);
|
offset = (LONGEST) (inst2 & 0x0fff);
|
||||||
if (offset & 0x0800)
|
if (offset & 0x0800)
|
||||||
offset -= 0x1000;
|
offset -= 0x1000;
|
||||||
|
@ -391,7 +392,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
|
||||||
next_addr += xstormy16_inst_size;
|
next_addr += xstormy16_inst_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
else /* Not a prologue instruction. */
|
else /* Not a prologue instruction. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +424,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||||
|
|
||||||
memset (&cache, 0, sizeof cache);
|
memset (&cache, 0, sizeof cache);
|
||||||
|
|
||||||
/* Don't trust line number debug info in frameless functions. */
|
/* Don't trust line number debug info in frameless functions. */
|
||||||
plg_end = xstormy16_analyze_prologue (gdbarch, func_addr, func_end,
|
plg_end = xstormy16_analyze_prologue (gdbarch, func_addr, func_end,
|
||||||
&cache, NULL);
|
&cache, NULL);
|
||||||
if (!cache.uses_fp)
|
if (!cache.uses_fp)
|
||||||
|
@ -431,7 +432,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||||
|
|
||||||
/* Found a function. */
|
/* Found a function. */
|
||||||
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
|
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
|
||||||
/* Don't use line number debug info for assembly source files. */
|
/* Don't use line number debug info for assembly source files. */
|
||||||
if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
|
if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
|
||||||
{
|
{
|
||||||
sal = find_pc_line (func_addr, 0);
|
sal = find_pc_line (func_addr, 0);
|
||||||
|
@ -441,18 +442,18 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||||
return sal.end;
|
return sal.end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* No useable line symbol. Use result of prologue parsing method. */
|
/* No useable line symbol. Use result of prologue parsing method. */
|
||||||
return plg_end;
|
return plg_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No function symbol -- just return the PC. */
|
/* No function symbol -- just return the PC. */
|
||||||
|
|
||||||
return (CORE_ADDR) pc;
|
return (CORE_ADDR) pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The epilogue is defined here as the area at the end of a function,
|
/* The epilogue is defined here as the area at the end of a function,
|
||||||
either on the `ret' instruction itself or after an instruction which
|
either on the `ret' instruction itself or after an instruction which
|
||||||
destroys the function's stack frame. */
|
destroys the function's stack frame. */
|
||||||
static int
|
static int
|
||||||
xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||||
{
|
{
|
||||||
|
@ -464,12 +465,12 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||||
ULONGEST inst, inst2;
|
ULONGEST inst, inst2;
|
||||||
CORE_ADDR addr = func_end - xstormy16_inst_size;
|
CORE_ADDR addr = func_end - xstormy16_inst_size;
|
||||||
|
|
||||||
/* The Xstormy16 epilogue is max. 14 bytes long. */
|
/* The Xstormy16 epilogue is max. 14 bytes long. */
|
||||||
if (pc < func_end - 7 * xstormy16_inst_size)
|
if (pc < func_end - 7 * xstormy16_inst_size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Check if we're on a `ret' instruction. Otherwise it's
|
/* Check if we're on a `ret' instruction. Otherwise it's
|
||||||
too dangerous to proceed. */
|
too dangerous to proceed. */
|
||||||
inst = read_memory_unsigned_integer (addr,
|
inst = read_memory_unsigned_integer (addr,
|
||||||
xstormy16_inst_size, byte_order);
|
xstormy16_inst_size, byte_order);
|
||||||
if (inst != 0x0003)
|
if (inst != 0x0003)
|
||||||
|
@ -478,14 +479,16 @@ 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,
|
||||||
if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
|
byte_order);
|
||||||
|
if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
|
||||||
{
|
{
|
||||||
addr -= xstormy16_inst_size;
|
addr -= xstormy16_inst_size;
|
||||||
break;
|
break;
|
||||||
|
@ -508,7 +511,7 @@ xstormy16_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a pointer to a jump table entry, return the address
|
/* Given a pointer to a jump table entry, return the address
|
||||||
of the function it jumps to. Return 0 if not found. */
|
of the function it jumps to. Return 0 if not found. */
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
xstormy16_resolve_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
|
xstormy16_resolve_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
|
||||||
{
|
{
|
||||||
|
@ -520,7 +523,7 @@ xstormy16_resolve_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
|
||||||
LONGEST inst, inst2, addr;
|
LONGEST inst, inst2, addr;
|
||||||
char buf[2 * xstormy16_inst_size];
|
char buf[2 * xstormy16_inst_size];
|
||||||
|
|
||||||
/* Return faddr if it's not pointing into the jump table. */
|
/* Return faddr if it's not pointing into the jump table. */
|
||||||
if (strcmp (faddr_sect->the_bfd_section->name, ".plt"))
|
if (strcmp (faddr_sect->the_bfd_section->name, ".plt"))
|
||||||
return faddr;
|
return faddr;
|
||||||
|
|
||||||
|
@ -539,7 +542,7 @@ xstormy16_resolve_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
|
||||||
|
|
||||||
/* Given a function's address, attempt to find (and return) the
|
/* Given a function's address, attempt to find (and return) the
|
||||||
address of the corresponding jump table entry. Return 0 if
|
address of the corresponding jump table entry. Return 0 if
|
||||||
not found. */
|
not found. */
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
|
xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
|
||||||
{
|
{
|
||||||
|
@ -550,7 +553,7 @@ xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
|
||||||
{
|
{
|
||||||
struct obj_section *osect;
|
struct obj_section *osect;
|
||||||
|
|
||||||
/* Return faddr if it's already a pointer to a jump table entry. */
|
/* Return faddr if it's already a pointer to a jump table entry. */
|
||||||
if (!strcmp (faddr_sect->the_bfd_section->name, ".plt"))
|
if (!strcmp (faddr_sect->the_bfd_section->name, ".plt"))
|
||||||
return faddr;
|
return faddr;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -772,14 +777,14 @@ xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
|
|
||||||
/* Function: xstormy16_gdbarch_init
|
/* Function: xstormy16_gdbarch_init
|
||||||
Initializer function for the xstormy16 gdbarch vector.
|
Initializer function for the xstormy16 gdbarch vector.
|
||||||
Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
|
Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
|
||||||
|
|
||||||
static struct gdbarch *
|
static struct gdbarch *
|
||||||
xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch;
|
struct gdbarch *gdbarch;
|
||||||
|
|
||||||
/* find a candidate among the list of pre-declared architectures. */
|
/* find a candidate among the list of pre-declared architectures. */
|
||||||
arches = gdbarch_list_lookup_by_info (arches, &info);
|
arches = gdbarch_list_lookup_by_info (arches, &info);
|
||||||
if (arches != NULL)
|
if (arches != NULL)
|
||||||
return (arches->gdbarch);
|
return (arches->gdbarch);
|
||||||
|
@ -814,7 +819,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||||
set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
|
set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
|
||||||
set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
|
set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
|
||||||
|
|
||||||
/* Stack grows up. */
|
/* Stack grows up. */
|
||||||
set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
|
set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -849,9 +854,10 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||||
|
|
||||||
/* Function: _initialize_xstormy16_tdep
|
/* Function: _initialize_xstormy16_tdep
|
||||||
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)
|
||||||
|
|
|
@ -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. */
|
||||||
|
@ -1116,7 +1121,7 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
|
||||||
unsigned int register_operand;
|
unsigned int register_operand;
|
||||||
|
|
||||||
/* Possible candidate for setting frame pointer
|
/* Possible candidate for setting frame pointer
|
||||||
from A1. This is what we are looking for. */
|
from A1. This is what we are looking for. */
|
||||||
|
|
||||||
if (xtensa_operand_get_field (isa, opc, 1, ifmt,
|
if (xtensa_operand_get_field (isa, opc, 1, ifmt,
|
||||||
is, slot, ®ister_operand) != 0)
|
is, slot, ®ister_operand) != 0)
|
||||||
|
@ -1132,7 +1137,8 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
|
||||||
®ister_operand) != 0)
|
®ister_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,
|
||||||
|
|
|
@ -82,7 +82,7 @@ typedef enum
|
||||||
} xtensa_target_flags_t;
|
} xtensa_target_flags_t;
|
||||||
|
|
||||||
|
|
||||||
/* Xtensa ELF core file register set representation ('.reg' section).
|
/* Xtensa ELF core file register set representation ('.reg' section).
|
||||||
Copied from target-side ELF header <xtensa/elf.h>. */
|
Copied from target-side ELF header <xtensa/elf.h>. */
|
||||||
|
|
||||||
typedef unsigned long xtensa_elf_greg_t;
|
typedef unsigned long xtensa_elf_greg_t;
|
||||||
|
@ -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},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue