mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
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
@ -61,6 +61,35 @@
|
||||
* trad-frame.h: 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>
|
||||
|
||||
* breakpoint.c (resources_needed_watchpoint): Fix indentation.
|
||||
|
@ -18,7 +18,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
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 "ui-file.h"
|
||||
@ -108,8 +108,8 @@ null_file_write (struct ui_file *file,
|
||||
long sizeof_buf)
|
||||
{
|
||||
if (file->to_fputs == null_file_fputs)
|
||||
/* Both the write and fputs methods are null. Discard the
|
||||
request. */
|
||||
/* Both the write and fputs methods are null. Discard the
|
||||
request. */
|
||||
return;
|
||||
else
|
||||
{
|
||||
@ -144,12 +144,12 @@ static void
|
||||
null_file_fputs (const char *buf, struct ui_file *file)
|
||||
{
|
||||
if (file->to_write == null_file_write)
|
||||
/* Both the write and fputs methods are null. Discard the
|
||||
request. */
|
||||
/* Both the write and fputs methods are null. Discard the
|
||||
request. */
|
||||
return;
|
||||
else
|
||||
{
|
||||
/* The write method was implemented, use that. */
|
||||
/* The write method was implemented, use that. */
|
||||
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
|
||||
a memory buffer. */
|
||||
a memory buffer. */
|
||||
|
||||
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
|
||||
buffer. The buffers accumulated contents are available via
|
||||
ui_file_put(). */
|
||||
buffer. The buffers accumulated contents are available via
|
||||
ui_file_put(). */
|
||||
|
||||
struct mem_file
|
||||
{
|
||||
@ -434,7 +434,7 @@ mem_file_write (struct ui_file *file,
|
||||
}
|
||||
|
||||
/* ``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_fputs_ftype stdio_file_fputs;
|
||||
@ -559,7 +559,7 @@ stdio_file_isatty (struct ui_file *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 *
|
||||
stdio_fileopen (FILE *file)
|
||||
|
@ -23,19 +23,19 @@
|
||||
struct obstack;
|
||||
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);
|
||||
|
||||
/* Override methods used by specific implementations of a UI_FILE
|
||||
object. */
|
||||
object. */
|
||||
|
||||
typedef void (ui_file_flush_ftype) (struct ui_file *stream);
|
||||
extern void set_ui_file_flush (struct ui_file *stream,
|
||||
ui_file_flush_ftype *flush);
|
||||
|
||||
/* NOTE: Both fputs and write methods are available. Default
|
||||
implementations that mapping one onto the other are included. */
|
||||
/* NOTE: Both fputs and write methods are available. Default
|
||||
implementations that mapping one onto the other are included. */
|
||||
typedef void (ui_file_write_ftype) (struct ui_file *stream,
|
||||
const char *buf, long length_buf);
|
||||
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,
|
||||
long length_buf);
|
||||
|
||||
/* NOTE: copies left to right */
|
||||
/* NOTE: copies left to right. */
|
||||
extern void ui_file_put (struct ui_file *src,
|
||||
ui_file_put_method_ftype *write, void *dest);
|
||||
|
||||
/* Returns a freshly allocated buffer containing the entire contents
|
||||
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
|
||||
minus that appended NUL. */
|
||||
minus that appended NUL. */
|
||||
extern char *ui_file_xstrdup (struct ui_file *file, long *length);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Create/open a memory based file. Can be used as a scratch buffer
|
||||
for collecting output. */
|
||||
/* Create/open a memory based file. Can be used as a scratch buffer
|
||||
for collecting output. */
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* 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
|
||||
is always available. Stack/nested level 0 is reserved for the
|
||||
top-level result. */
|
||||
top-level result. */
|
||||
|
||||
enum { MAX_UI_OUT_LEVELS = 8 };
|
||||
|
||||
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;
|
||||
/* The type of this level. */
|
||||
/* The type of this level. */
|
||||
enum ui_out_type type;
|
||||
};
|
||||
|
||||
@ -93,12 +93,12 @@ struct ui_out_table
|
||||
|
||||
/* The ui_out structure */
|
||||
/* 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
|
||||
{
|
||||
int flags;
|
||||
/* specific implementation of ui-out */
|
||||
/* Specific implementation of ui-out. */
|
||||
struct ui_out_impl *impl;
|
||||
void *data;
|
||||
|
||||
@ -110,14 +110,14 @@ struct ui_out
|
||||
struct ui_out_table table;
|
||||
};
|
||||
|
||||
/* The current (inner most) level. */
|
||||
/* The current (inner most) level. */
|
||||
static struct ui_out_level *
|
||||
current_level (struct ui_out *uiout)
|
||||
{
|
||||
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
|
||||
push_level (struct ui_out *uiout,
|
||||
enum ui_out_type type,
|
||||
@ -125,7 +125,7 @@ push_level (struct ui_out *uiout,
|
||||
{
|
||||
struct ui_out_level *current;
|
||||
|
||||
/* We had better not overflow the buffer. */
|
||||
/* We had better not overflow the buffer. */
|
||||
uiout->level++;
|
||||
gdb_assert (uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS);
|
||||
current = current_level (uiout);
|
||||
@ -135,12 +135,12 @@ push_level (struct ui_out *uiout,
|
||||
}
|
||||
|
||||
/* 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
|
||||
pop_level (struct ui_out *uiout,
|
||||
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 (current_level (uiout)->type == type);
|
||||
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,
|
||||
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_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 =
|
||||
{
|
||||
@ -220,11 +220,11 @@ struct ui_out def_uiout =
|
||||
|
||||
/* Pointer to current ui_out */
|
||||
/* 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;
|
||||
|
||||
/* 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,
|
||||
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) */
|
||||
|
||||
/* Mark beginning of a table */
|
||||
/* Mark beginning of a table. */
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
/* used to ommit a field */
|
||||
/* Used to omit a field. */
|
||||
|
||||
void
|
||||
ui_out_field_skip (struct ui_out *uiout,
|
||||
@ -566,7 +566,7 @@ ui_out_field_fmt (struct ui_out *uiout,
|
||||
int width;
|
||||
int align;
|
||||
|
||||
/* will not align, but has to call anyway */
|
||||
/* Will not align, but has to call anyway. */
|
||||
verify_field (uiout, &fldno, &width, &align);
|
||||
|
||||
va_start (args, format);
|
||||
@ -649,7 +649,7 @@ ui_out_redirect (struct ui_out *uiout, struct ui_file *outstream)
|
||||
return uo_redirect (uiout, outstream);
|
||||
}
|
||||
|
||||
/* set the flags specified by the mask given */
|
||||
/* Set the flags specified by the mask given. */
|
||||
int
|
||||
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;
|
||||
}
|
||||
|
||||
/* clear the flags specified by the mask given */
|
||||
/* Clear the flags specified by the mask given. */
|
||||
int
|
||||
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;
|
||||
}
|
||||
|
||||
/* test the flags against the mask given */
|
||||
/* Test the flags against the mask given. */
|
||||
int
|
||||
ui_out_test_flags (struct ui_out *uiout, int mask)
|
||||
{
|
||||
return (uiout->flags & mask);
|
||||
}
|
||||
|
||||
/* obtain the current verbosity level (as stablished by the
|
||||
'set verbositylevel' command */
|
||||
/* Obtain the current verbosity level (as stablished by the
|
||||
'set verbositylevel' command. */
|
||||
|
||||
int
|
||||
ui_out_get_verblvl (struct ui_out *uiout)
|
||||
{
|
||||
/* FIXME: not implemented yet */
|
||||
/* FIXME: not implemented yet. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -747,7 +747,7 @@ ui_out_is_mi_like_p (struct ui_out *uiout)
|
||||
return uiout->impl->is_mi_like_p;
|
||||
}
|
||||
|
||||
/* default gdb-out hook functions */
|
||||
/* Default gdb-out hook functions. */
|
||||
|
||||
static void
|
||||
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
|
||||
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 */
|
||||
|
||||
/* list of column headers manipulation routines */
|
||||
/* List of column headers manipulation routines. */
|
||||
|
||||
static void
|
||||
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
|
||||
ui_out_get_field_separator (struct ui_out *uiout)
|
||||
{
|
||||
}
|
||||
|
||||
/* Access to ui-out members data */
|
||||
/* Access to ui-out members data. */
|
||||
|
||||
void *
|
||||
ui_out_data (struct ui_out *uiout)
|
||||
@ -1141,7 +1141,7 @@ ui_out_data (struct ui_out *uiout)
|
||||
return uiout->data;
|
||||
}
|
||||
|
||||
/* initalize private members at startup */
|
||||
/* Initalize private members at startup. */
|
||||
|
||||
struct ui_out *
|
||||
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;
|
||||
}
|
||||
|
||||
/* standard gdb initialization hook */
|
||||
/* Standard gdb initialization hook. */
|
||||
|
||||
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 */
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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
|
||||
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
|
||||
tuples. */
|
||||
tuples. */
|
||||
|
||||
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
|
||||
implied structure: ``table = { hdr = { header, ... } , body = [ {
|
||||
field, ... }, ... ] }''. If NR_ROWS is negative then there is at
|
||||
least one row. */
|
||||
field, ... }, ... ] }''. If NR_ROWS is negative then there is at
|
||||
least one row. */
|
||||
extern void ui_out_table_header (struct ui_out *uiout, int width,
|
||||
enum ui_align align, const char *col_name,
|
||||
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
|
||||
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 */
|
||||
|
||||
/* Type definition of all implementation functions. */
|
||||
/* Type definition of all implementation functions. */
|
||||
|
||||
typedef void (table_begin_ftype) (struct ui_out * uiout,
|
||||
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,
|
||||
const char *colhdr);
|
||||
/* 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,
|
||||
enum ui_out_type type,
|
||||
int level, const char *id);
|
||||
@ -240,7 +240,7 @@ typedef int (redirect_ftype) (struct ui_out * uiout,
|
||||
/* ui-out-impl */
|
||||
|
||||
/* 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
|
||||
{
|
||||
|
82
gdb/utils.c
82
gdb/utils.c
@ -38,7 +38,7 @@
|
||||
#include <pc.h>
|
||||
#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
|
||||
#undef reg
|
||||
#endif
|
||||
@ -113,7 +113,7 @@ static int debug_timestamp = 0;
|
||||
static struct cleanup *cleanup_chain; /* cleaned up after a failed command */
|
||||
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;
|
||||
|
||||
@ -584,7 +584,7 @@ free_current_contents (void *ptr)
|
||||
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().
|
||||
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
|
||||
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
|
||||
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
|
||||
to be called as a cleanup. */
|
||||
must be a pointer to a struct cmd_stat. This function is intended
|
||||
to be called as a cleanup. */
|
||||
static void
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
global beginning of list as our iteration pointer.*/
|
||||
global beginning of list as our iteration pointer. */
|
||||
static int
|
||||
do_all_intermediate_continuations_thread_callback (struct thread_info *thread,
|
||||
void *data)
|
||||
@ -963,7 +963,7 @@ vwarning (const char *string, va_list args)
|
||||
else
|
||||
{
|
||||
target_terminal_ours ();
|
||||
wrap_here (""); /* Force out any buffered output */
|
||||
wrap_here (""); /* Force out any buffered output. */
|
||||
gdb_flush (gdb_stdout);
|
||||
if (warning_pre_print)
|
||||
fputs_unfiltered (warning_pre_print, gdb_stderr);
|
||||
@ -1092,7 +1092,7 @@ static const char *internal_problem_modes[] =
|
||||
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
|
||||
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
|
||||
may clear errno but not know about bfd_error. Doing this here is not
|
||||
unreasonable. */
|
||||
unreasonable. */
|
||||
bfd_set_error (bfd_error_no_error);
|
||||
errno = 0;
|
||||
|
||||
@ -1435,7 +1435,7 @@ quit (void)
|
||||
|
||||
|
||||
/* Called when a memory allocation fails, with the number of bytes of
|
||||
memory requested in SIZE. */
|
||||
memory requested in SIZE. */
|
||||
|
||||
void
|
||||
nomem (long size)
|
||||
@ -1533,7 +1533,7 @@ xfree (void *ptr)
|
||||
|
||||
|
||||
/* Like asprintf/vasprintf but get an internal_error if the call
|
||||
fails. */
|
||||
fails. */
|
||||
|
||||
char *
|
||||
xstrprintf (const char *format, ...)
|
||||
@ -1721,7 +1721,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
|
||||
|
||||
while (1)
|
||||
{
|
||||
wrap_here (""); /* Flush any buffered output */
|
||||
wrap_here (""); /* Flush any buffered output. */
|
||||
gdb_flush (gdb_stdout);
|
||||
|
||||
if (annotation_level > 1)
|
||||
@ -1763,7 +1763,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
|
||||
retval = def_value;
|
||||
break;
|
||||
}
|
||||
/* Eat rest of input line, to EOF or newline */
|
||||
/* Eat rest of input line, to EOF or newline. */
|
||||
if (answer != '\n')
|
||||
do
|
||||
{
|
||||
@ -1897,7 +1897,7 @@ host_char_to_target (struct gdbarch *gdbarch, int c, int *target_c)
|
||||
int
|
||||
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)++;
|
||||
|
||||
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
|
||||
string whose delimiter is QUOTER. Note that this routine should only
|
||||
be call for printing things which are independent of the language
|
||||
of the program being debugged. */
|
||||
of the program being debugged. */
|
||||
|
||||
static void
|
||||
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
|
||||
literal string whose delimiter is QUOTER. Note that these routines
|
||||
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
|
||||
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. */
|
||||
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. */
|
||||
@ -2323,7 +2323,7 @@ reinitialize_more_filter (void)
|
||||
}
|
||||
|
||||
/* 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
|
||||
wrapped part on the next line. INDENT must remain accessible until
|
||||
the next call to wrap_here() or until a newline is printed through
|
||||
@ -2346,7 +2346,7 @@ reinitialize_more_filter (void)
|
||||
void
|
||||
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)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("failed internal consistency check"));
|
||||
@ -2380,11 +2380,11 @@ wrap_here (char *indent)
|
||||
}
|
||||
|
||||
/* 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
|
||||
trailing spaces. String should never be longer than
|
||||
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
|
||||
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
|
||||
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
|
||||
line. Otherwise do nothing. */
|
||||
line. Otherwise do nothing. */
|
||||
|
||||
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)
|
||||
prompt_for_continue ();
|
||||
|
||||
/* Now output indentation and wrapped string */
|
||||
/* Now output indentation and wrapped string. */
|
||||
if (wrap_column)
|
||||
{
|
||||
fputs_unfiltered (wrap_indent, stream);
|
||||
*wrap_pointer = '\0'; /* Null-terminate saved stuff */
|
||||
fputs_unfiltered (wrap_buffer, stream); /* and eject it */
|
||||
*wrap_pointer = '\0'; /* Null-terminate saved stuff, */
|
||||
fputs_unfiltered (wrap_buffer, stream); /* and eject it. */
|
||||
/* FIXME, this strlen is what prevents wrap_indent from
|
||||
containing tabs. However, if we recurse to print it
|
||||
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
|
||||
if we are printing a long string. */
|
||||
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
|
||||
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
|
||||
demangling is off, the name is printed in its "raw" form. */
|
||||
demangling is off, the name is printed in its "raw" form. */
|
||||
|
||||
void
|
||||
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".
|
||||
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++
|
||||
function). */
|
||||
function). */
|
||||
|
||||
int
|
||||
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);
|
||||
}
|
||||
|
||||
/* Machine specific function to handle SIGWINCH signal. */
|
||||
/* Machine specific function to handle SIGWINCH signal. */
|
||||
|
||||
#ifdef SIGWINCH_HANDLER_BODY
|
||||
SIGWINCH_HANDLER_BODY
|
||||
#endif
|
||||
/* print routines to handle variable size regs, etc. */
|
||||
/* temporary storage using circular buffer */
|
||||
/* Print routines to handle variable size regs, etc. */
|
||||
/* Temporary storage using circular buffer. */
|
||||
#define NUMCELLS 16
|
||||
#define CELLSIZE 50
|
||||
static char *
|
||||
@ -3174,7 +3174,7 @@ paddress (struct gdbarch *gdbarch, CORE_ADDR addr)
|
||||
/* Truncate address to the size of a target address, avoiding shifts
|
||||
larger or equal than the width of a CORE_ADDR. The local
|
||||
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
|
||||
kept in the least significant bits of ADDR - the upper bits were
|
||||
either zero or sign extended. Should gdbarch_address_to_pointer or
|
||||
@ -3191,7 +3191,7 @@ static char *
|
||||
decimal2str (char *sign, ULONGEST addr, int width)
|
||||
{
|
||||
/* 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];
|
||||
char *str = get_cell ();
|
||||
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,
|
||||
* 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'
|
||||
* 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 *
|
||||
int_string (LONGEST val, int radix, int is_signed, int width,
|
||||
@ -3594,14 +3594,14 @@ xfullpath (const char *filename)
|
||||
char *result;
|
||||
|
||||
/* 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)
|
||||
return xstrdup (filename);
|
||||
|
||||
dir_name = alloca ((size_t) (base_name - filename + 2));
|
||||
/* Allocate enough space to store the dir_name + plus one extra
|
||||
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);
|
||||
dir_name[base_name - filename] = '\000';
|
||||
|
||||
@ -3616,7 +3616,7 @@ xfullpath (const char *filename)
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
real_path = gdb_realpath (dir_name);
|
||||
if (IS_DIR_SEPARATOR (real_path[strlen (real_path) - 1]))
|
||||
|
@ -250,8 +250,9 @@ v850_use_struct_convention (struct type *type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The value is a union which contains at least one field which would be
|
||||
returned in registers according to these rules -> returned in register. */
|
||||
/* The value is a union which contains at least one field which
|
||||
would be returned in registers according to these rules ->
|
||||
returned in register. */
|
||||
if (TYPE_CODE (type) == TYPE_CODE_UNION)
|
||||
{
|
||||
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
|
||||
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
|
||||
|| (reg >= E_R20_REGNUM && reg <= E_R29_REGNUM)
|
||||
|| reg == E_R31_REGNUM;
|
||||
@ -492,7 +493,7 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
|
||||
|
||||
insn = read_memory_integer (current_pc, 2, byte_order);
|
||||
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);
|
||||
current_pc += 2;
|
||||
@ -558,7 +559,7 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
|
||||
|| (insn & 0xffe0) == 0x0060 /* jmp */
|
||||
|| (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))
|
||||
@ -628,7 +629,7 @@ v850_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -644,7 +645,8 @@ v850_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR 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;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "exceptions.h"
|
||||
|
||||
/* 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
|
||||
#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 target type is incomplete, then error out.
|
||||
This isn't a general purpose function, but just a
|
||||
helper for value_ptradd.
|
||||
*/
|
||||
helper for value_ptradd. */
|
||||
|
||||
static LONGEST
|
||||
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
|
||||
doing lower bounds adjustment here rather than there.
|
||||
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 *
|
||||
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;
|
||||
|
||||
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++)
|
||||
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[3] = 0;
|
||||
|
||||
/* make the right function name up */
|
||||
/* Make the right function name up. */
|
||||
strcpy (tstr, "operator__");
|
||||
ptr = tstr + 8;
|
||||
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
|
||||
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)
|
||||
and return that value (where '@' is (almost) any unary operator which
|
||||
is legal for GNU C++). */
|
||||
@ -582,7 +581,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
|
||||
|
||||
nargs = 1;
|
||||
|
||||
/* make the right function name up */
|
||||
/* Make the right function name up. */
|
||||
strcpy (tstr, "operator__");
|
||||
ptr = tstr + 8;
|
||||
strcpy (mangle_tstr, "__");
|
||||
@ -675,8 +674,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
|
||||
values of length 1.
|
||||
|
||||
(3) Character values are also allowed and are treated as character
|
||||
string values of length 1.
|
||||
*/
|
||||
string values of length 1. */
|
||||
|
||||
struct value *
|
||||
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
|
||||
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
|
||||
repeated. */
|
||||
repeated. */
|
||||
|
||||
if (TYPE_CODE (type2) == TYPE_CODE_INT)
|
||||
{
|
||||
@ -713,12 +711,12 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||
inval2 = arg2;
|
||||
}
|
||||
|
||||
/* Now process the input values. */
|
||||
/* Now process the input values. */
|
||||
|
||||
if (TYPE_CODE (type1) == TYPE_CODE_INT)
|
||||
{
|
||||
/* 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
|
||||
|| 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
|
||||
|| 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
|
||||
&& 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
|
||||
|| 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
|
||||
&& TYPE_CODE (type2) != TYPE_CODE_BOOL)
|
||||
{
|
||||
@ -807,7 +805,7 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We don't know how to concatenate these operands. */
|
||||
/* We don't know how to concatenate these operands. */
|
||||
error (_("illegal operands for concatenation."));
|
||||
}
|
||||
return (outval);
|
||||
@ -815,6 +813,7 @@ value_concat (struct value *arg1, struct value *arg2)
|
||||
|
||||
/* Integer exponentiation: V1**V2, where both arguments are
|
||||
integers. Requires V1 != 0 if V2 < 0. Returns 1 for 0 ** 0. */
|
||||
|
||||
static LONGEST
|
||||
integer_pow (LONGEST v1, LONGEST v2)
|
||||
{
|
||||
@ -827,7 +826,7 @@ integer_pow (LONGEST v1, LONGEST v2)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The Russian Peasant's Algorithm */
|
||||
/* The Russian Peasant's Algorithm. */
|
||||
LONGEST v;
|
||||
|
||||
v = 1;
|
||||
@ -845,6 +844,7 @@ integer_pow (LONGEST v1, LONGEST v2)
|
||||
|
||||
/* Integer exponentiation: V1**V2, where both arguments are
|
||||
integers. Requires V1 != 0 if V2 < 0. Returns 1 for 0 ** 0. */
|
||||
|
||||
static ULONGEST
|
||||
uinteger_pow (ULONGEST v1, LONGEST v2)
|
||||
{
|
||||
@ -857,7 +857,7 @@ uinteger_pow (ULONGEST v1, LONGEST v2)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The Russian Peasant's Algorithm */
|
||||
/* The Russian Peasant's Algorithm. */
|
||||
ULONGEST v;
|
||||
|
||||
v = 1;
|
||||
@ -1175,7 +1175,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||
|
||||
case BINOP_MOD:
|
||||
/* 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)
|
||||
{
|
||||
v = v1;
|
||||
@ -1183,7 +1183,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||
else
|
||||
{
|
||||
v = v1 / v2;
|
||||
/* Note floor(v1/v2) == v1/v2 for unsigned. */
|
||||
/* Note floor(v1/v2) == v1/v2 for unsigned. */
|
||||
v = v1 - (v2 * v);
|
||||
}
|
||||
break;
|
||||
@ -1301,7 +1301,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||
|
||||
case BINOP_MOD:
|
||||
/* 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)
|
||||
{
|
||||
v = v1;
|
||||
@ -1309,7 +1309,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
||||
else
|
||||
{
|
||||
v = v1 / v2;
|
||||
/* Compute floor. */
|
||||
/* Compute floor. */
|
||||
if (TRUNCATION_TOWARDS_ZERO && (v < 0) && ((v1 % v2) != 0))
|
||||
{
|
||||
v--;
|
||||
@ -1511,7 +1511,7 @@ value_logical_not (struct value *arg1)
|
||||
}
|
||||
|
||||
/* 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
|
||||
value_strcmp (struct value *arg1, struct value *arg2)
|
||||
@ -1617,7 +1617,7 @@ value_equal (struct value *arg1, struct value *arg2)
|
||||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
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);
|
||||
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);
|
||||
|
||||
@ -1787,7 +1787,7 @@ value_neg (struct value *arg1)
|
||||
else
|
||||
{
|
||||
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,
|
||||
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
|
||||
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)
|
||||
{
|
||||
/* 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. */
|
||||
struct type *t1 = check_typedef (type);
|
||||
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;
|
||||
|
||||
/* 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);
|
||||
|
||||
@ -1528,8 +1528,7 @@ value_coerce_to_target (struct value *val)
|
||||
other than array subscripting, where the caller would get back a
|
||||
value that had an address somewhere before the actual first element
|
||||
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 *
|
||||
value_coerce_array (struct value *arg1)
|
||||
@ -1593,7 +1592,7 @@ value_addr (struct value *arg1)
|
||||
if (VALUE_LVAL (arg1) != lval_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)),
|
||||
(value_address (arg1)
|
||||
+ value_embedded_offset (arg1)));
|
||||
@ -1667,7 +1666,7 @@ value_ind (struct value *arg1)
|
||||
arg2 = value_at_lazy (enc_type,
|
||||
find_function_addr (arg1, NULL));
|
||||
else
|
||||
/* Retrieve the enclosing object pointed to */
|
||||
/* Retrieve the enclosing object pointed to. */
|
||||
arg2 = value_at_lazy (enc_type,
|
||||
(value_as_address (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
|
||||
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
|
||||
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"));
|
||||
|
||||
/* 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. */
|
||||
|
||||
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
|
||||
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
|
||||
TYPE.
|
||||
|
||||
@ -2073,7 +2072,7 @@ search_struct_method (const char *name, struct value **arg1p,
|
||||
{
|
||||
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 ||
|
||||
strncmp (t_field_name, "op", 2) == 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;
|
||||
|
||||
/* 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. */
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
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.
|
||||
BASETYPE is set to the actual type of the subobject where the
|
||||
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 *
|
||||
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.
|
||||
BASETYPE is set to the type of the base subobject that defines the
|
||||
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 *
|
||||
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.
|
||||
BOTH: used for overload resolution of operators where the
|
||||
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
|
||||
target object, and will be dereferenced when attempting the
|
||||
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
|
||||
overload_resolution. Caller must check it to see whether overload
|
||||
resolution is permitted.
|
||||
*/
|
||||
resolution is permitted. */
|
||||
|
||||
int
|
||||
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_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 (qualified_name[next_namespace_len] == ':')
|
||||
@ -3103,7 +3099,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
|
||||
++start;
|
||||
|
||||
/* If skipping artificial fields, find the first real field
|
||||
in T1. */
|
||||
in T1. */
|
||||
if (skip_artificial)
|
||||
{
|
||||
while (start < TYPE_NFIELDS (t1)
|
||||
@ -3111,7 +3107,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
|
||||
++start;
|
||||
}
|
||||
|
||||
/* Now compare parameters */
|
||||
/* Now compare parameters. */
|
||||
|
||||
/* Special case: a method taking void. T1 will contain no
|
||||
non-artificial fields, and T2 will contain TYPE_CODE_VOID. */
|
||||
@ -3464,7 +3460,7 @@ value_full_object (struct value *argp,
|
||||
return argp;
|
||||
}
|
||||
|
||||
/* Check if object is in memory */
|
||||
/* Check if object is in memory. */
|
||||
if (VALUE_LVAL (argp) != lval_memory)
|
||||
{
|
||||
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);
|
||||
|
||||
#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 =
|
||||
{
|
||||
@ -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
|
||||
element in an array. Referenced by the low level language dependent
|
||||
print routines. */
|
||||
print routines. */
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
/* If nonzero, stops printing of char arrays at first null. */
|
||||
/* If nonzero, stops printing of char arrays at first null. */
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
/* Controls pretty printing of structures. */
|
||||
/* Controls pretty printing of structures. */
|
||||
|
||||
static void
|
||||
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
|
||||
printed. */
|
||||
printed. */
|
||||
|
||||
static void
|
||||
show_unionprint (struct ui_file *file, int from_tty,
|
||||
@ -210,7 +210,7 @@ show_unionprint (struct ui_file *file, int from_tty,
|
||||
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
|
||||
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
|
||||
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
|
||||
to the host byte ordering, whichever is more convenient. */
|
||||
to the host byte ordering, whichever is more convenient. */
|
||||
|
||||
|
||||
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.
|
||||
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
|
||||
format.
|
||||
format.
|
||||
|
||||
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
|
||||
@ -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
|
||||
parameter remains to preserve the information of what things might
|
||||
be printed with language-specific format, should we ever resurrect
|
||||
that capability. */
|
||||
that capability. */
|
||||
|
||||
void
|
||||
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
|
||||
longest_to_int (LONGEST arg)
|
||||
{
|
||||
/* Let the compiler do the work */
|
||||
/* Let the compiler do the work. */
|
||||
int rtnval = (int) arg;
|
||||
|
||||
/* Check for overflows or underflows */
|
||||
/* Check for overflows or underflows. */
|
||||
if (sizeof (LONGEST) > sizeof (int))
|
||||
{
|
||||
if (rtnval != arg)
|
||||
@ -685,8 +685,8 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
int b;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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++)
|
||||
{
|
||||
/* 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++)
|
||||
{
|
||||
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.
|
||||
* Print it in octal on stream or format it in buf.
|
||||
*/
|
||||
Print it in octal on stream or format it in buf. */
|
||||
|
||||
void
|
||||
print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
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
|
||||
|
||||
/* 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;
|
||||
carry = 0;
|
||||
|
||||
@ -787,8 +787,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
switch (cycle)
|
||||
{
|
||||
case 0:
|
||||
/* No carry in, carry out two bits.
|
||||
*/
|
||||
/* No carry in, carry out two bits. */
|
||||
|
||||
octa1 = (HIGH_ZERO & *p) >> 5;
|
||||
octa2 = (LOW_ZERO & *p) >> 2;
|
||||
carry = (CARRY_ZERO & *p);
|
||||
@ -797,8 +797,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
break;
|
||||
|
||||
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);
|
||||
octa2 = (MID_ONE & *p) >> 4;
|
||||
octa3 = (LOW_ONE & *p) >> 1;
|
||||
@ -809,8 +809,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Carry in one bit, no carry out.
|
||||
*/
|
||||
/* Carry in one bit, no carry out. */
|
||||
|
||||
octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
|
||||
octa2 = (MID_TWO & *p) >> 3;
|
||||
octa3 = (LOW_TWO & *p);
|
||||
@ -838,6 +838,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
{
|
||||
case 0:
|
||||
/* Carry out, no carry in */
|
||||
|
||||
octa1 = (HIGH_ZERO & *p) >> 5;
|
||||
octa2 = (LOW_ZERO & *p) >> 2;
|
||||
carry = (CARRY_ZERO & *p);
|
||||
@ -847,6 +848,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
|
||||
case 1:
|
||||
/* Carry in, carry out */
|
||||
|
||||
octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7);
|
||||
octa2 = (MID_ONE & *p) >> 4;
|
||||
octa3 = (LOW_ONE & *p) >> 1;
|
||||
@ -858,6 +860,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
|
||||
case 2:
|
||||
/* Carry in, no carry out */
|
||||
|
||||
octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
|
||||
octa2 = (MID_TWO & *p) >> 3;
|
||||
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.
|
||||
* Print it in decimal on stream or format it in buf.
|
||||
*/
|
||||
Print it in decimal on stream or format it in buf. */
|
||||
|
||||
void
|
||||
print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
unsigned len, enum bfd_endian byte_order)
|
||||
@ -901,8 +904,8 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
int flip;
|
||||
|
||||
/* 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;
|
||||
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 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
|
||||
* LSD end.
|
||||
@ -947,15 +950,15 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
*/
|
||||
if (flip == 0)
|
||||
{
|
||||
/* Take top nibble.
|
||||
*/
|
||||
/* Take top nibble. */
|
||||
|
||||
digits[0] += HIGH_NIBBLE (*p);
|
||||
flip = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Take low nibble and bump our pointer "p".
|
||||
*/
|
||||
/* Take low nibble and bump our pointer "p". */
|
||||
|
||||
digits[0] += LOW_NIBBLE (*p);
|
||||
if (byte_order == BFD_ENDIAN_BIG)
|
||||
p++;
|
||||
@ -1001,8 +1004,8 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
|
||||
}
|
||||
|
||||
/* 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--)
|
||||
{
|
||||
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.
|
||||
Print it out in appropriate language form on stream.
|
||||
Print it out in appropriate language form on stream.
|
||||
Omit any leading zero chars. */
|
||||
|
||||
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
|
||||
for all languages currently handled.
|
||||
(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
|
||||
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
|
||||
results in GDB's memory at MYADDR. Returns a count of the bytes
|
||||
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
|
||||
function be eliminated. */
|
||||
@ -1214,24 +1216,24 @@ static int
|
||||
partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
|
||||
int len, int *errnoptr)
|
||||
{
|
||||
int nread; /* Number of bytes actually read. */
|
||||
int errcode; /* Error from last read. */
|
||||
int nread; /* Number of bytes actually read. */
|
||||
int errcode; /* Error from last read. */
|
||||
|
||||
/* First try a complete read. */
|
||||
/* First try a complete read. */
|
||||
errcode = target_read_memory (memaddr, myaddr, len);
|
||||
if (errcode == 0)
|
||||
{
|
||||
/* Got it all. */
|
||||
/* Got it all. */
|
||||
nread = len;
|
||||
}
|
||||
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--)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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,
|
||||
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
|
||||
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 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. */
|
||||
int bytes_read;
|
||||
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
|
||||
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.
|
||||
(FIXME). */
|
||||
(FIXME). */
|
||||
|
||||
if (radix < 2)
|
||||
{
|
||||
@ -1540,7 +1542,7 @@ static void
|
||||
set_output_radix_1 (int from_tty, unsigned radix)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
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
|
||||
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
|
||||
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
|
||||
show_radix (char *arg, int from_tty)
|
||||
@ -1638,7 +1640,7 @@ _initialize_valprint (void)
|
||||
_("Generic command for setting how things print."),
|
||||
&setprintlist, "set print ", 0, &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_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
|
||||
independent variables to be either set or shown with a single
|
||||
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
|
||||
longer true - show can display anything. */
|
||||
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
|
||||
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
|
||||
"unlimited". */
|
||||
"unlimited". */
|
||||
unsigned int print_max;
|
||||
|
||||
/* 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"
|
||||
|
||||
/* Prototypes for exported functions. */
|
||||
/* Prototypes for exported functions. */
|
||||
|
||||
void _initialize_values (void);
|
||||
|
||||
@ -107,7 +107,7 @@ struct value
|
||||
|
||||
/* 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=1 targets, it is the position of the MSB. */
|
||||
gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
|
||||
int bitpos;
|
||||
|
||||
/* Only used for bitfields; the containing value. This allows a
|
||||
@ -214,7 +214,7 @@ struct value
|
||||
int reference_count;
|
||||
};
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
/* Prototypes for local functions. */
|
||||
|
||||
static void show_values (char *, int);
|
||||
|
||||
@ -239,7 +239,7 @@ struct value_history_chunk
|
||||
|
||||
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
|
||||
@ -1672,7 +1672,7 @@ value_as_double (struct value *val)
|
||||
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
|
||||
handles all the cases. */
|
||||
CORE_ADDR
|
||||
@ -1851,7 +1851,7 @@ unpack_double (struct type *type, const gdb_byte *valaddr, int *invp)
|
||||
int len;
|
||||
int nosign;
|
||||
|
||||
*invp = 0; /* Assume valid. */
|
||||
*invp = 0; /* Assume valid. */
|
||||
CHECK_TYPEDEF (type);
|
||||
code = TYPE_CODE (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
|
||||
TYPE. Return NULL if the field doesn't exist or has been
|
||||
optimized out. */
|
||||
optimized out. */
|
||||
|
||||
struct value *
|
||||
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:
|
||||
{
|
||||
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);
|
||||
|
||||
if (sym == NULL)
|
||||
{
|
||||
/* 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,
|
||||
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)
|
||||
of a struct or union type ARG_TYPE,
|
||||
extract and return the value of one of its (non-static) fields.
|
||||
FIELDNO says which field. */
|
||||
FIELDNO says which field. */
|
||||
|
||||
struct value *
|
||||
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,
|
||||
extract and return the value of one of its (non-static) fields.
|
||||
FIELDNO says which field. */
|
||||
FIELDNO says which field. */
|
||||
|
||||
struct value *
|
||||
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.
|
||||
|
||||
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 *
|
||||
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)));
|
||||
|
||||
/* Move the `this' pointer according to the offset.
|
||||
VALUE_OFFSET (*arg1p) += offset;
|
||||
*/
|
||||
VALUE_OFFSET (*arg1p) += offset; */
|
||||
}
|
||||
|
||||
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
|
||||
bitfield.
|
||||
|
||||
If the field is signed, we also do sign extension. */
|
||||
If the field is signed, we also do sign extension. */
|
||||
|
||||
LONGEST
|
||||
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,
|
||||
bytes_read, byte_order);
|
||||
|
||||
/* Extract bits. See comment above. */
|
||||
/* Extract bits. See comment above. */
|
||||
|
||||
if (gdbarch_bits_big_endian (get_type_arch (field_type)))
|
||||
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;
|
||||
|
||||
/* 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)))
|
||||
{
|
||||
@ -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
|
||||
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
|
||||
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
|
||||
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);
|
||||
|
||||
/* 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. */
|
||||
extern int value_initialized (struct value *);
|
||||
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
|
||||
{
|
||||
USE_SPECIFIED_FRAME, /* Use the frame passed to varobj_create */
|
||||
USE_CURRENT_FRAME, /* Use the current frame */
|
||||
USE_SELECTED_FRAME /* Always reevaluate in selected frame */
|
||||
USE_SPECIFIED_FRAME, /* Use the frame passed to varobj_create. */
|
||||
USE_CURRENT_FRAME, /* Use the current frame. */
|
||||
USE_SELECTED_FRAME /* Always reevaluate in selected frame. */
|
||||
};
|
||||
|
||||
/* Enumerator describing if a variable object is in scope. */
|
||||
@ -50,19 +50,19 @@ enum varobj_scope_status
|
||||
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[];
|
||||
|
||||
/* Languages supported by this variable objects system. */
|
||||
/* Languages supported by this variable objects system. */
|
||||
enum varobj_languages
|
||||
{
|
||||
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[];
|
||||
|
||||
/* Struct thar describes a variable object instance */
|
||||
/* Struct thar describes a variable object instance. */
|
||||
struct varobj;
|
||||
|
||||
typedef struct varobj *varobj_p;
|
||||
@ -77,7 +77,7 @@ typedef struct varobj_update_result_t
|
||||
enum varobj_scope_status status;
|
||||
/* This variable is used internally by varobj_update to indicate if the
|
||||
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;
|
||||
|
||||
/* 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
|
||||
register REGNUM. */
|
||||
register REGNUM. */
|
||||
|
||||
static struct type *
|
||||
vax_register_type (struct gdbarch *gdbarch, int regnum)
|
||||
|
@ -56,7 +56,7 @@ calculate_allocation (const struct vec_prefix *pfx, int reserve)
|
||||
alloc = num + -reserve;
|
||||
else
|
||||
{
|
||||
/* Exponential growth. */
|
||||
/* Exponential growth. */
|
||||
if (!alloc)
|
||||
alloc = 4;
|
||||
else if (alloc < 16)
|
||||
@ -66,7 +66,7 @@ calculate_allocation (const struct vec_prefix *pfx, int reserve)
|
||||
/* Grow slower when large. */
|
||||
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)
|
||||
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
|
||||
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 *
|
||||
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.
|
||||
|
||||
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
|
||||
operations allow you to change elements in the middle of 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
|
||||
|
||||
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
|
||||
be sufficient space in the vector. */
|
||||
|
||||
@ -252,7 +252,7 @@
|
||||
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
|
||||
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. */
|
||||
|
||||
#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
|
||||
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. */
|
||||
|
||||
#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
|
||||
|
||||
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
|
||||
NULL, in which case no overwriting of the slot is actually
|
||||
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); // 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
|
||||
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) \
|
||||
(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); // 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
|
||||
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) \
|
||||
(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
|
||||
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
|
||||
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
|
||||
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
|
||||
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_) \
|
||||
{ \
|
||||
/* We must request exact size allocation, hence the negation. */ \
|
||||
/* We must request exact size allocation, hence the negation. */ \
|
||||
new_vec_ = (VEC (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_) \
|
||||
{ \
|
||||
/* 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_->num = len_; \
|
||||
@ -965,7 +965,7 @@ static inline VEC(T) *VEC_OP (T,copy) (VEC(T) *vec_) \
|
||||
\
|
||||
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_o_reserve (NULL, -len_, offsetof (VEC(T),vec), sizeof (T)); \
|
||||
\
|
||||
|
@ -23,10 +23,10 @@
|
||||
/* Version number of GDB, as a string. */
|
||||
extern const char version[];
|
||||
|
||||
/* Canonical host name as a string. */
|
||||
/* Canonical host name as a string. */
|
||||
extern const char host_name[];
|
||||
|
||||
/* Canonical target name as a string. */
|
||||
/* Canonical target name as a string. */
|
||||
extern const char target_name[];
|
||||
|
||||
#endif /* #ifndef VERSION_H */
|
||||
|
@ -89,7 +89,8 @@ static BOOL WINAPI (*GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO,
|
||||
DWORD);
|
||||
static BOOL WINAPI (*LookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID);
|
||||
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 struct target_ops windows_ops;
|
||||
@ -107,13 +108,14 @@ static struct target_ops windows_ops;
|
||||
# define bad_GetModuleFileNameEx bad_GetModuleFileNameExA
|
||||
#else
|
||||
# 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_end;
|
||||
# if CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API_MINOR) >= 181
|
||||
# define __USEWIDE
|
||||
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 CreateProcess CreateProcessW
|
||||
# define GetModuleFileNameEx_name "GetModuleFileNameExW"
|
||||
@ -135,12 +137,14 @@ static struct target_ops windows_ops;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static int have_saved_context; /* True if we've saved context from a cygwin signal. */
|
||||
static CONTEXT saved_context; /* Containes the saved context from a cygwin signal. */
|
||||
static int have_saved_context; /* True if we've saved context from a
|
||||
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
|
||||
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
|
||||
enum
|
||||
{
|
||||
@ -166,7 +170,7 @@ static int windows_initialization_done;
|
||||
#define DR6_CLEAR_VALUE 0xffff0ff0
|
||||
|
||||
/* 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
|
||||
#define _CYGWIN_SIGNAL_STRING "cYgSiGw00f"
|
||||
#endif
|
||||
@ -186,7 +190,7 @@ static void cygwin_set_dr7 (unsigned long val);
|
||||
static unsigned long cygwin_get_dr6 (void);
|
||||
|
||||
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
|
||||
not available in gdb's thread structure. */
|
||||
@ -206,7 +210,7 @@ thread_info;
|
||||
|
||||
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
|
||||
WaitForDebugEvent */
|
||||
@ -214,13 +218,13 @@ static HANDLE current_process_handle; /* Currently executing process */
|
||||
static thread_info *current_thread; /* Info on currently selected 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 event_count = 0;
|
||||
static int saw_create;
|
||||
static int open_process_used = 0;
|
||||
|
||||
/* User options. */
|
||||
/* User options. */
|
||||
static int new_console = 0;
|
||||
#ifdef __CYGWIN__
|
||||
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
|
||||
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
|
||||
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
|
||||
the other regs of the group, and then we copy the info in and set
|
||||
out bit. */
|
||||
out bit. */
|
||||
|
||||
static const int *mappings;
|
||||
|
||||
/* 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
|
||||
{
|
||||
@ -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
|
||||
pristine state. */
|
||||
pristine state. */
|
||||
static void
|
||||
windows_init_thread_list (void)
|
||||
{
|
||||
@ -380,7 +384,7 @@ windows_init_thread_list (void)
|
||||
thread_head.next = NULL;
|
||||
}
|
||||
|
||||
/* Delete a thread from the list of threads */
|
||||
/* Delete a thread from the list of threads. */
|
||||
static void
|
||||
windows_delete_thread (ptid_t ptid)
|
||||
{
|
||||
@ -418,17 +422,19 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
|
||||
|
||||
if (!current_thread)
|
||||
return; /* Windows sometimes uses a non-existent thread id in its
|
||||
events */
|
||||
events. */
|
||||
|
||||
if (current_thread->reload_context)
|
||||
{
|
||||
#ifdef __COPY_CONTEXT_SIZE
|
||||
if (have_saved_context)
|
||||
{
|
||||
/* Lie about where the program actually is stopped since cygwin has informed us that
|
||||
we should consider the signal to have occurred at another location which is stored
|
||||
in "saved_context. */
|
||||
memcpy (¤t_thread->context, &saved_context, __COPY_CONTEXT_SIZE);
|
||||
/* Lie about where the program actually is stopped since
|
||||
cygwin has informed us that we should consider the signal
|
||||
to have occurred at another location which is stored in
|
||||
"saved_context. */
|
||||
memcpy (¤t_thread->context, &saved_context,
|
||||
__COPY_CONTEXT_SIZE);
|
||||
have_saved_context = 0;
|
||||
}
|
||||
else
|
||||
@ -438,7 +444,8 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
|
||||
th->context.ContextFlags = CONTEXT_DEBUGGER_DR;
|
||||
GetThreadContext (th->h, &th->context);
|
||||
/* 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)
|
||||
{
|
||||
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);
|
||||
/* Check if current_thread exists. Windows sometimes uses a non-existent
|
||||
thread id in its events */
|
||||
thread id in its events. */
|
||||
if (current_thread)
|
||||
do_windows_fetch_inferior_registers (regcache, r);
|
||||
}
|
||||
@ -486,7 +493,7 @@ static void
|
||||
do_windows_store_inferior_registers (const struct regcache *regcache, int r)
|
||||
{
|
||||
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)
|
||||
regcache_raw_collect (regcache, 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
|
||||
windows_store_inferior_registers (struct target_ops *ops,
|
||||
struct regcache *regcache, int r)
|
||||
{
|
||||
current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE);
|
||||
/* Check if current_thread exists. Windows sometimes uses a non-existent
|
||||
thread id in its events */
|
||||
thread id in its events. */
|
||||
if (current_thread)
|
||||
do_windows_store_inferior_registers (regcache, r);
|
||||
}
|
||||
@ -519,43 +526,45 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
|
||||
MODULEINFO mi;
|
||||
int i;
|
||||
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;
|
||||
#ifdef __CYGWIN__
|
||||
cygwin_buf_t pathbuf[__PMAX]; /* Temporary storage prior to converting to
|
||||
posix form. __PMAX is always enough
|
||||
as long as SO_NAME_MAX_PATH_SIZE is defined
|
||||
as 512. */
|
||||
as 512. */
|
||||
#endif
|
||||
|
||||
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,
|
||||
sizeof (HMODULE), &cbNeeded) || !cbNeeded)
|
||||
goto failed;
|
||||
|
||||
/* Allocate correct amount of space for module list */
|
||||
/* Allocate correct amount of space for module list. */
|
||||
DllHandle = (HMODULE *) alloca (cbNeeded);
|
||||
if (!DllHandle)
|
||||
goto failed;
|
||||
|
||||
/* Get the list of modules */
|
||||
/* Get the list of modules. */
|
||||
if (!EnumProcessModules (current_process_handle, DllHandle, cbNeeded,
|
||||
&cbNeeded))
|
||||
goto failed;
|
||||
|
||||
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],
|
||||
&mi, sizeof (mi)))
|
||||
error (_("Can't get module info"));
|
||||
|
||||
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__
|
||||
/* 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,
|
||||
DllHandle[i], pathbuf, __PMAX);
|
||||
if (len == 0)
|
||||
@ -567,7 +576,8 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
|
||||
len = GetModuleFileNameEx (current_process_handle,
|
||||
DllHandle[i], dll_name_ret, __PMAX);
|
||||
if (len == 0)
|
||||
error (_("Error getting dll name: %u."), (unsigned) GetLastError ());
|
||||
error (_("Error getting dll name: %u."),
|
||||
(unsigned) GetLastError ());
|
||||
#endif
|
||||
return 1; /* success */
|
||||
}
|
||||
@ -579,7 +589,7 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
|
||||
}
|
||||
|
||||
/* Encapsulate the information required in a call to
|
||||
symbol_file_add_args */
|
||||
symbol_file_add_args. */
|
||||
struct safe_symbol_file_add_args
|
||||
{
|
||||
char *name;
|
||||
@ -591,7 +601,7 @@ struct safe_symbol_file_add_args
|
||||
struct objfile *ret;
|
||||
};
|
||||
|
||||
/* Maintain a linked list of "so" information. */
|
||||
/* Maintain a linked list of "so" information. */
|
||||
struct lm_info
|
||||
{
|
||||
LPVOID load_addr;
|
||||
@ -600,7 +610,7 @@ struct lm_info
|
||||
static struct so_list solib_start, *solib_end;
|
||||
|
||||
/* Call symbol_file_add with stderr redirected. We don't care if there
|
||||
are errors. */
|
||||
are errors. */
|
||||
static int
|
||||
safe_symbol_file_add_stub (void *argv)
|
||||
{
|
||||
@ -612,7 +622,7 @@ safe_symbol_file_add_stub (void *argv)
|
||||
#undef p
|
||||
}
|
||||
|
||||
/* Restore gdb's stderr after calling symbol_file_add */
|
||||
/* Restore gdb's stderr after calling symbol_file_add. */
|
||||
static void
|
||||
safe_symbol_file_add_cleanup (void *p)
|
||||
{
|
||||
@ -626,7 +636,7 @@ safe_symbol_file_add_cleanup (void *p)
|
||||
#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 *
|
||||
safe_symbol_file_add (char *name, int from_tty,
|
||||
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
|
||||
offset from 0 of the first byte in an image - because of the
|
||||
file header and the section alignment. */
|
||||
cygwin_load_start = (CORE_ADDR) (uintptr_t) ((char *) load_addr + 0x1000);
|
||||
file header and the section alignment. */
|
||||
cygwin_load_start = (CORE_ADDR) (uintptr_t) ((char *)
|
||||
load_addr + 0x1000);
|
||||
cygwin_load_end = cygwin_load_start + bfd_section_size (abfd, text);
|
||||
|
||||
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.
|
||||
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)
|
||||
return NULL;
|
||||
|
||||
/* See if we could read the address of a string, and that the
|
||||
address isn't null. */
|
||||
if (!ReadProcessMemory (h, address, &address_ptr, sizeof (address_ptr), &done)
|
||||
address isn't null. */
|
||||
if (!ReadProcessMemory (h, address, &address_ptr,
|
||||
sizeof (address_ptr), &done)
|
||||
|| done != sizeof (address_ptr) || !address_ptr)
|
||||
return NULL;
|
||||
|
||||
/* Find the length of the string */
|
||||
/* Find the length of the string. */
|
||||
while (ReadProcessMemory (h, address_ptr + len++ * size, &b, size, &done)
|
||||
&& (b[0] != 0 || b[size - 1] != 0) && done == size)
|
||||
continue;
|
||||
@ -883,7 +895,7 @@ handle_unload_dll (void *dummy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Clear list of loaded DLLs. */
|
||||
/* Clear list of loaded DLLs. */
|
||||
static void
|
||||
windows_clear_solib (void)
|
||||
{
|
||||
@ -891,7 +903,7 @@ windows_clear_solib (void)
|
||||
solib_end = &solib_start;
|
||||
}
|
||||
|
||||
/* Load DLL symbol info. */
|
||||
/* Load DLL symbol info. */
|
||||
void
|
||||
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.
|
||||
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
|
||||
handle_output_debug_string (struct target_waitstatus *ourstatus)
|
||||
{
|
||||
@ -927,7 +939,8 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
|
||||
&s, 1024, 0)
|
||||
|| !s || !*s)
|
||||
/* 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__
|
||||
if (strncmp (s, "cYg", 3) != 0)
|
||||
@ -937,11 +950,13 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
|
||||
#ifdef __COPY_CONTEXT_SIZE
|
||||
else
|
||||
{
|
||||
/* Got a cygwin signal marker. A cygwin signal is followed by the signal number
|
||||
itself and then optionally followed by the thread id and address to saved context
|
||||
within the DLL. If these are supplied, then the given thread is assumed to have
|
||||
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. */
|
||||
/* Got a cygwin signal marker. A cygwin signal is followed by
|
||||
the signal number itself and then optionally followed by the
|
||||
thread id and address to saved context within the DLL. If
|
||||
these are supplied, then the given thread is assumed to have
|
||||
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;
|
||||
int sig = strtol (s + sizeof (_CYGWIN_SIGNAL_STRING) - 1, &p, 0);
|
||||
int gotasig = target_signal_from_host (sig);
|
||||
@ -956,7 +971,8 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
|
||||
retval = main_thread_id;
|
||||
else if ((x = (LPCVOID) strtoul (p, &p, 0))
|
||||
&& ReadProcessMemory (current_process_handle, x,
|
||||
&saved_context, __COPY_CONTEXT_SIZE, &n)
|
||||
&saved_context,
|
||||
__COPY_CONTEXT_SIZE, &n)
|
||||
&& n == __COPY_CONTEXT_SIZE)
|
||||
have_saved_context = 1;
|
||||
current_event.dwThreadId = retval;
|
||||
@ -1097,7 +1113,7 @@ handle_exception (struct target_waitstatus *ourstatus)
|
||||
|
||||
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);
|
||||
|
||||
switch (code)
|
||||
@ -1107,17 +1123,23 @@ handle_exception (struct target_waitstatus *ourstatus)
|
||||
ourstatus->value.sig = TARGET_SIGNAL_SEGV;
|
||||
#ifdef __CYGWIN__
|
||||
{
|
||||
/* See if the access violation happened within the cygwin DLL itself. Cygwin uses
|
||||
a kind of exception handling to deal with passed-in invalid addresses. gdb
|
||||
should not treat these as real SEGVs since they will be silently handled by
|
||||
cygwin. A real SEGV will (theoretically) be caught by cygwin later in the process
|
||||
and will be sent as a cygwin-specific-signal. So, ignore SEGVs if they show up
|
||||
within the text segment of the DLL itself. */
|
||||
/* See if the access violation happened within the cygwin DLL
|
||||
itself. Cygwin uses a kind of exception handling to deal
|
||||
with passed-in invalid addresses. gdb should not treat
|
||||
these as real SEGVs since they will be silently handled by
|
||||
cygwin. A real SEGV will (theoretically) be caught by
|
||||
cygwin later in the process and will be sent as a
|
||||
cygwin-specific-signal. So, ignore SEGVs if they show up
|
||||
within the text segment of the DLL itself. */
|
||||
char *fn;
|
||||
CORE_ADDR addr = (CORE_ADDR) (uintptr_t) current_event.u.Exception.ExceptionRecord.ExceptionAddress;
|
||||
if ((!cygwin_exceptions && (addr >= cygwin_load_start && addr < cygwin_load_end))
|
||||
CORE_ADDR addr = (CORE_ADDR) (uintptr_t)
|
||||
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)
|
||||
&& strncmp (fn, "KERNEL32!IsBad", strlen ("KERNEL32!IsBad")) == 0))
|
||||
&& strncmp (fn, "KERNEL32!IsBad",
|
||||
strlen ("KERNEL32!IsBad")) == 0))
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -1195,7 +1217,7 @@ handle_exception (struct target_waitstatus *ourstatus)
|
||||
ourstatus->value.sig = TARGET_SIGNAL_ILL;
|
||||
break;
|
||||
default:
|
||||
/* Treat unhandled first chance exceptions specially. */
|
||||
/* Treat unhandled first chance exceptions specially. */
|
||||
if (current_event.u.Exception.dwFirstChance)
|
||||
return -1;
|
||||
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
|
||||
execution */
|
||||
execution. */
|
||||
static BOOL
|
||||
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++)
|
||||
if (xlate[i].us == sig)
|
||||
{
|
||||
current_event.u.Exception.ExceptionRecord.ExceptionCode =
|
||||
xlate[i].them;
|
||||
current_event.u.Exception.ExceptionRecord.ExceptionCode
|
||||
= xlate[i].them;
|
||||
continue_status = DBG_EXCEPTION_NOT_HANDLED;
|
||||
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",
|
||||
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);
|
||||
if (th)
|
||||
{
|
||||
if (step)
|
||||
{
|
||||
/* Single step by setting t bit */
|
||||
/* Single step by setting t bit. */
|
||||
struct regcache *regcache = get_current_regcache ();
|
||||
struct gdbarch *gdbarch = get_regcache_arch (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.
|
||||
Otherwise complain. */
|
||||
Otherwise complain. */
|
||||
|
||||
if (resume_all)
|
||||
windows_continue (continue_status, -1);
|
||||
@ -1392,8 +1414,8 @@ ctrl_c_handler (DWORD event_type)
|
||||
return TRUE;
|
||||
|
||||
if (!DebugBreakProcess (current_process_handle))
|
||||
warning (_("\
|
||||
Could not interrupt program. Press Ctrl-c in the program console."));
|
||||
warning (_("Could not interrupt program. "
|
||||
"Press Ctrl-c in the program console."));
|
||||
|
||||
/* Return true to tell that Ctrl-C has been handled. */
|
||||
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
|
||||
thread event. Caused when attached process does not have
|
||||
a main thread. */
|
||||
a main thread. */
|
||||
retval = fake_create_process ();
|
||||
if (retval)
|
||||
saw_create++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* Record the existence of this thread */
|
||||
/* Record the existence of this thread. */
|
||||
retval = current_event.dwThreadId;
|
||||
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
|
||||
current_event.dwThreadId),
|
||||
@ -1483,7 +1505,7 @@ get_windows_debug_event (struct target_ops *ops,
|
||||
windows_delete_thread (ptid_build (current_event.dwProcessId, 0,
|
||||
main_thread_id));
|
||||
main_thread_id = current_event.dwThreadId;
|
||||
/* Add the main thread */
|
||||
/* Add the main thread. */
|
||||
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
|
||||
current_event.dwThreadId),
|
||||
current_event.u.CreateProcessInfo.hThread,
|
||||
@ -1560,7 +1582,7 @@ get_windows_debug_event (struct target_ops *ops,
|
||||
}
|
||||
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",
|
||||
(unsigned) current_event.dwProcessId,
|
||||
(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,
|
||||
which needs a current_thread->h. But some of these exceptions mark
|
||||
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)
|
||||
{
|
||||
@ -1625,8 +1647,8 @@ windows_wait (struct target_ops *ops,
|
||||
- The debugger and the program do not share the console, in
|
||||
which case the Ctrl-c event only reached the debugger.
|
||||
In that case, the ctrl_c handler will take care of interrupting
|
||||
the inferior. Note that this case is working starting with
|
||||
Windows XP. For Windows 2000, Ctrl-C should be pressed in the
|
||||
the inferior. Note that this case is working starting with
|
||||
Windows XP. For Windows 2000, Ctrl-C should be pressed in the
|
||||
inferior console.
|
||||
|
||||
- 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
|
||||
dynamically loading of the needed symbols from advapi32 which is only
|
||||
available on NT/2K/XP. */
|
||||
available on NT/2K/XP. */
|
||||
static int
|
||||
set_process_privilege (const char *privilege, BOOL enable)
|
||||
{
|
||||
@ -1755,9 +1777,9 @@ set_process_privilege (const char *privilege, BOOL enable)
|
||||
#if 0
|
||||
/* Disabled, otherwise every `attach' in an unprivileged user session
|
||||
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
|
||||
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)
|
||||
goto out;
|
||||
#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)
|
||||
{
|
||||
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 ();
|
||||
@ -1793,7 +1816,7 @@ windows_attach (struct target_ops *ops, char *args, int from_tty)
|
||||
#ifdef __CYGWIN__
|
||||
if (!ok)
|
||||
{
|
||||
/* Try fall back to Cygwin pid */
|
||||
/* Try fall back to Cygwin pid. */
|
||||
pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
|
||||
|
||||
if (pid > 0)
|
||||
@ -1861,7 +1884,7 @@ windows_pid_to_exec_file (int pid)
|
||||
{
|
||||
static char path[__PMAX];
|
||||
#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;
|
||||
char procexe[sizeof ("/proc/4294967295/exe")];
|
||||
sprintf (procexe, "/proc/%u/exe", pid);
|
||||
@ -1874,7 +1897,7 @@ windows_pid_to_exec_file (int pid)
|
||||
#endif
|
||||
|
||||
/* 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))
|
||||
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));
|
||||
swprintf (cygallargs, len, L" -c 'exec %s %s'", exec_file, allargs);
|
||||
#else
|
||||
cygallargs = (char *) alloca (sizeof (" -c 'exec '") + strlen (exec_file)
|
||||
cygallargs = (char *)
|
||||
alloca (sizeof (" -c 'exec '") + strlen (exec_file)
|
||||
+ strlen (allargs) + 2);
|
||||
sprintf (cygallargs, " -c 'exec %s %s'", exec_file, allargs);
|
||||
#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
|
||||
^C on the controlling terminal. */
|
||||
^C on the controlling terminal. */
|
||||
|
||||
static void
|
||||
windows_stop (ptid_t ptid)
|
||||
@ -2217,13 +2241,13 @@ windows_kill_inferior (struct target_ops *ops)
|
||||
break;
|
||||
}
|
||||
|
||||
target_mourn_inferior (); /* or just windows_mourn_inferior? */
|
||||
target_mourn_inferior (); /* Or just windows_mourn_inferior? */
|
||||
}
|
||||
|
||||
static void
|
||||
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
|
||||
@ -2239,7 +2263,7 @@ windows_close (int x)
|
||||
PIDGET (inferior_ptid)));
|
||||
}
|
||||
|
||||
/* Convert pid to printable format. */
|
||||
/* Convert pid to printable format. */
|
||||
static char *
|
||||
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_grow_str (&obstack, "<library-list>\n");
|
||||
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);
|
||||
obstack_grow_str0 (&obstack, "</library-list>\n");
|
||||
|
||||
@ -2434,7 +2459,8 @@ Show use of shell to start subprocess."), NULL,
|
||||
NULL, /* FIXME: i18n: */
|
||||
&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."), _("\
|
||||
Show whether gdb breaks on exceptions in the Cygwin DLL itself."), NULL,
|
||||
NULL,
|
||||
@ -2532,7 +2558,7 @@ cygwin_get_dr6 (void)
|
||||
|
||||
/* Determine if the thread referenced by "ptid" is alive
|
||||
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
|
||||
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);
|
||||
tid = ptid_get_tid (ptid);
|
||||
|
||||
return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0 ?
|
||||
FALSE : TRUE;
|
||||
return WaitForSingleObject (thread_rec (tid, FALSE)->h, 0) == WAIT_OBJECT_0
|
||||
? FALSE : TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -2575,7 +2601,7 @@ _initialize_check_for_gdb_ini (void)
|
||||
}
|
||||
|
||||
/* 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
|
||||
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
|
||||
of Windows. */
|
||||
of Windows. */
|
||||
void
|
||||
_initialize_loadable (void)
|
||||
{
|
||||
@ -2661,7 +2687,7 @@ _initialize_loadable (void)
|
||||
}
|
||||
|
||||
/* 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)
|
||||
DebugBreakProcess = bad_DebugBreakProcess;
|
||||
if (!DebugActiveProcessStop || !DebugSetProcessKillOnExit)
|
||||
@ -2675,7 +2701,7 @@ _initialize_loadable (void)
|
||||
GetCurrentConsoleFont = bad_GetCurrentConsoleFont;
|
||||
|
||||
/* 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");
|
||||
if (hm)
|
||||
{
|
||||
@ -2690,13 +2716,15 @@ _initialize_loadable (void)
|
||||
if (!EnumProcessModules || !GetModuleInformation || !GetModuleFileNameEx)
|
||||
{
|
||||
/* 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;
|
||||
GetModuleInformation = bad_GetModuleInformation;
|
||||
GetModuleFileNameEx = bad_GetModuleFileNameEx;
|
||||
/* This will probably fail on Windows 9x/Me. Let the user know 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."));
|
||||
/* This will probably fail on Windows 9x/Me. Let the user know
|
||||
that we're missing some functionality. */
|
||||
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");
|
||||
@ -2708,8 +2736,9 @@ _initialize_loadable (void)
|
||||
AdjustTokenPrivileges = (void *)
|
||||
GetProcAddress (hm, "AdjustTokenPrivileges");
|
||||
/* Only need to set one of these since if OpenProcessToken fails nothing
|
||||
else is needed. */
|
||||
if (!OpenProcessToken || !LookupPrivilegeValueA || !AdjustTokenPrivileges)
|
||||
else is needed. */
|
||||
if (!OpenProcessToken || !LookupPrivilegeValueA
|
||||
|| !AdjustTokenPrivileges)
|
||||
OpenProcessToken = bad_OpenProcessToken;
|
||||
}
|
||||
}
|
||||
|
@ -86,8 +86,10 @@ static const char* TIB_NAME[] =
|
||||
" last_error_number " /* %fs:0x0034 */
|
||||
};
|
||||
|
||||
static const int MAX_TIB32 = sizeof (thread_information_32) / sizeof (uint32_t);
|
||||
static const int MAX_TIB64 = sizeof (thread_information_64) / sizeof (uint64_t);
|
||||
static const int MAX_TIB32 =
|
||||
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 int maint_display_all_tib = 0;
|
||||
@ -125,7 +127,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
|
||||
|
||||
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",
|
||||
module_list_ptr_type);
|
||||
|
||||
@ -184,7 +187,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
|
||||
/* uint32_t current_seh; %fs:0x0000 */
|
||||
append_composite_type_field (tib_type, "current_seh", seh_ptr_type);
|
||||
/* 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 */
|
||||
append_composite_type_field (tib_type, "current_bottom_of_stack",
|
||||
void_ptr_type);
|
||||
@ -206,7 +210,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
|
||||
/* uint32_t active_rpc_handle; %fs:0x0028 */
|
||||
append_composite_type_field (tib_type, "active_rpc_handle", dword_ptr_type);
|
||||
/* 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 */
|
||||
append_composite_type_field (tib_type, "process_environment_block",
|
||||
peb_ptr_type);
|
||||
@ -320,8 +325,8 @@ display_one_tib (ptid_t ptid)
|
||||
if (target_read (¤t_target, TARGET_OBJECT_MEMORY,
|
||||
NULL, tib, thread_local_base, tib_size) != tib_size)
|
||||
{
|
||||
printf_filtered (_("Unable to read thread information block for %s at \
|
||||
address %s\n"),
|
||||
printf_filtered (_("Unable to read thread information "
|
||||
"block for %s at address %s\n"),
|
||||
target_pid_to_str (ptid),
|
||||
paddress (target_gdbarch, thread_local_base));
|
||||
return -1;
|
||||
@ -388,7 +393,7 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
|
||||
obstack_grow_str (obstack, "\"><segment address=\"");
|
||||
/* 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
|
||||
header and the section alignment. */
|
||||
header and the section alignment. */
|
||||
obstack_grow_str (obstack, paddress (gdbarch, load_addr + 0x1000));
|
||||
obstack_grow_str (obstack, "\"/></library>");
|
||||
}
|
||||
@ -397,8 +402,8 @@ static void
|
||||
show_maint_show_all_tib (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
{
|
||||
fprintf_filtered (file, _("Show all non-zero elements of Thread Information \
|
||||
Block is %s.\n"), value);
|
||||
fprintf_filtered (file, _("Show all non-zero elements of "
|
||||
"Thread Information Block is %s.\n"), value);
|
||||
}
|
||||
|
||||
static void
|
||||
|
207
gdb/xcoffread.c
207
gdb/xcoffread.c
@ -81,25 +81,25 @@ struct symloc
|
||||
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;
|
||||
|
||||
|
||||
/* Simplified internal version of coff symbol table information */
|
||||
/* Simplified internal version of coff symbol table information. */
|
||||
|
||||
struct coff_symbol
|
||||
{
|
||||
char *c_name;
|
||||
int c_symnum; /* symbol number of this entry */
|
||||
int c_naux; /* 0 if syment only, 1 if syment + auxent */
|
||||
int c_symnum; /* Symbol number of this entry. */
|
||||
int c_naux; /* 0 if syment only, 1 if syment + auxent. */
|
||||
long c_value;
|
||||
unsigned char c_sclass;
|
||||
int c_secnum;
|
||||
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;
|
||||
|
||||
@ -107,7 +107,7 @@ static bfd *symfile_bfd;
|
||||
|
||||
/* Core address of start and end of text of current source file.
|
||||
This is calculated from the first function seen after a C_FILE
|
||||
symbol. */
|
||||
symbol. */
|
||||
|
||||
|
||||
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;
|
||||
|
||||
/* initial symbol-table-debug-string vector length */
|
||||
/* Initial symbol-table-debug-string vector length. */
|
||||
|
||||
#define INITIAL_STABVECTOR_LENGTH 40
|
||||
|
||||
@ -133,8 +133,8 @@ static unsigned local_symesz;
|
||||
|
||||
struct coff_symfile_info
|
||||
{
|
||||
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 min_lineno_offset; /* Where in file lowest line#s are. */
|
||||
file_ptr max_lineno_offset; /* 1+last byte of line#s in file. */
|
||||
|
||||
/* Pointer to the string table. */
|
||||
char *strtbl;
|
||||
@ -288,7 +288,7 @@ secnum_to_bfd_section (int secnum, struct objfile *objfile)
|
||||
return sect;
|
||||
}
|
||||
|
||||
/* add a given stab string into given stab vector. */
|
||||
/* add a given stab string into given stab vector. */
|
||||
|
||||
#if 0
|
||||
|
||||
@ -320,9 +320,9 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||
Two reasons:
|
||||
|
||||
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
|
||||
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
|
||||
with a line table like:
|
||||
|
||||
@ -342,7 +342,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||
60 0x900
|
||||
|
||||
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
|
||||
like:
|
||||
|
||||
@ -351,7 +351,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||
30 0x300
|
||||
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:
|
||||
|
||||
@ -362,7 +362,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
|
||||
.ei
|
||||
|
||||
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.
|
||||
Include table (inclTable) and process_linenos() handle
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
/* Given a line table with function entries are marked, arrange its functions
|
||||
in ascending order and strip off function entry markers and return it in
|
||||
a newly created table. If the old one is good enough, return the old one. */
|
||||
/* Given a line table with function entries are marked, arrange its
|
||||
functions in ascending order and strip off function entry markers
|
||||
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
|
||||
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)
|
||||
{
|
||||
if (oldLineTb->item[ii].line == 0)
|
||||
{ /* function entry found. */
|
||||
{ /* Function entry found. */
|
||||
if (function_count >= fentry_size)
|
||||
{ /* make sure you have room. */
|
||||
{ /* Make sure you have room. */
|
||||
fentry_size *= 2;
|
||||
fentry = (struct linetable_entry *)
|
||||
xrealloc (fentry,
|
||||
@ -429,14 +430,14 @@ arrange_linetable (struct linetable *oldLineTb)
|
||||
qsort (fentry, function_count,
|
||||
sizeof (struct linetable_entry), compare_lte);
|
||||
|
||||
/* allocate a new line table. */
|
||||
/* Allocate a new line table. */
|
||||
newLineTb = (struct linetable *)
|
||||
xmalloc
|
||||
(sizeof (struct linetable) +
|
||||
(oldLineTb->nitems - function_count) * sizeof (struct linetable_entry));
|
||||
|
||||
/* if line table does not start with a function beginning, copy up until
|
||||
a function begin. */
|
||||
/* If line table does not start with a function beginning, copy up until
|
||||
a function begin. */
|
||||
|
||||
newline = 0;
|
||||
if (oldLineTb->item[0].line != 0)
|
||||
@ -444,7 +445,7 @@ arrange_linetable (struct linetable *oldLineTb)
|
||||
newline < oldLineTb->nitems && oldLineTb->item[newline].line; ++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)
|
||||
{
|
||||
@ -459,9 +460,9 @@ arrange_linetable (struct linetable *oldLineTb)
|
||||
}
|
||||
|
||||
/* 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
|
||||
represent if (the include files. */
|
||||
represent if (the include files. */
|
||||
|
||||
|
||||
typedef struct _inclTable
|
||||
@ -473,7 +474,7 @@ typedef struct _inclTable
|
||||
int begin, end;
|
||||
|
||||
struct subfile *subfile;
|
||||
unsigned funStartLine; /* start line # of its function */
|
||||
unsigned funStartLine; /* Start line # of its function. */
|
||||
}
|
||||
InclTable;
|
||||
|
||||
@ -552,7 +553,7 @@ allocate_include_entry (void)
|
||||
static struct partial_symtab *this_symtab_psymtab;
|
||||
|
||||
/* 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
|
||||
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));
|
||||
|
||||
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,
|
||||
&main_source_baseline);
|
||||
@ -610,7 +612,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
if (strcmp (inclTable[ii].name, last_source_file) == 0)
|
||||
{
|
||||
/* 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;
|
||||
enter_line_range
|
||||
@ -653,8 +655,8 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
|
||||
lv = main_subfile.line_vector;
|
||||
|
||||
/* Line numbers are not necessarily ordered. xlc compilation will
|
||||
put static function to the end. */
|
||||
/* Line numbers are not necessarily ordered. xlc compilation will
|
||||
put static function to the end. */
|
||||
|
||||
lineTb = arrange_linetable (lv);
|
||||
if (lv == lineTb)
|
||||
@ -685,8 +687,8 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
|
||||
lv = (inclTable[ii].subfile)->line_vector;
|
||||
|
||||
/* Line numbers are not necessarily ordered. xlc compilation will
|
||||
put static function to the end. */
|
||||
/* Line numbers are not necessarily ordered. xlc compilation will
|
||||
put static function to the end. */
|
||||
|
||||
lineTb = arrange_linetable (lv);
|
||||
|
||||
@ -701,7 +703,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
#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
|
||||
existing one if finds, we need to provide a fake name and
|
||||
fool it. */
|
||||
@ -755,7 +757,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
static 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);
|
||||
}
|
||||
|
||||
@ -856,7 +858,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
|
||||
(into the string table) but this does no harm. */
|
||||
|
||||
/* 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) \
|
||||
{ \
|
||||
@ -871,9 +873,9 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
|
||||
}
|
||||
|
||||
|
||||
/* 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.
|
||||
This is the base address of current static block, zero if non exists. */
|
||||
/* 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.
|
||||
This is the base address of current static block, zero if non exists. */
|
||||
|
||||
static int static_block_base = 0;
|
||||
|
||||
@ -881,7 +883,7 @@ static int static_block_base = 0;
|
||||
|
||||
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;
|
||||
|
||||
@ -898,7 +900,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
|
||||
struct internal_syment symbol;
|
||||
char *retval;
|
||||
|
||||
/* FIXME: is this the same as the passed arg? */
|
||||
/* FIXME: is this the same as the passed arg? */
|
||||
if (this_symtab_psymtab)
|
||||
objfile = this_symtab_psymtab->objfile;
|
||||
|
||||
@ -937,7 +939,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
{
|
||||
struct objfile *objfile = pst->objfile;
|
||||
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 =
|
||||
((struct coff_symfile_info *) objfile->deprecated_sym_private)->strtbl;
|
||||
char *debugsec =
|
||||
@ -958,20 +960,20 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
|
||||
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;
|
||||
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;
|
||||
int last_csect_sec;
|
||||
|
||||
this_symtab_psymtab = pst;
|
||||
|
||||
/* Get the appropriate COFF "constants" related to the file we're
|
||||
handling. */
|
||||
handling. */
|
||||
local_symesz = coff_data (abfd)->local_symesz;
|
||||
|
||||
last_source_file = NULL;
|
||||
@ -995,11 +997,11 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
QUIT; /* make this command interruptable. */
|
||||
|
||||
/* 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,
|
||||
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
|
||||
`alloced'. */
|
||||
`alloced'. */
|
||||
{
|
||||
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] == '$'
|
||||
|| (cs->c_name[1] == '$' && cs->c_name[0] == '.'))
|
||||
continue;
|
||||
@ -1076,7 +1078,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
start_symtab ("_globals_", (char *) NULL, (CORE_ADDR) 0);
|
||||
record_debugformat (debugfmt);
|
||||
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)
|
||||
@ -1115,7 +1117,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
prefers one symtab for each source file. In case
|
||||
of AIX, one source file might include more than one
|
||||
[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
|
||||
memory and gdb's file start and end address
|
||||
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,
|
||||
basically `__start'. */
|
||||
basically `__start'. */
|
||||
if (just_started)
|
||||
{
|
||||
first_object_file_end
|
||||
@ -1184,19 +1186,19 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
switch (CSECT_SCLAS (&main_aux))
|
||||
{
|
||||
case XMC_PR:
|
||||
/* a function entry point. */
|
||||
/* a function entry point. */
|
||||
function_entry_point:
|
||||
|
||||
fcn_start_addr = cs->c_value;
|
||||
|
||||
/* save the function header info, which will be used
|
||||
when `.bf' is seen. */
|
||||
when `.bf' is seen. */
|
||||
fcn_cs_saved = *cs;
|
||||
fcn_aux_saved = main_aux;
|
||||
continue;
|
||||
|
||||
case XMC_GL:
|
||||
/* shared library function trampoline code entry point. */
|
||||
/* shared library function trampoline code entry point. */
|
||||
continue;
|
||||
|
||||
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
|
||||
an XTY_SD for each variable. But gcc puts several
|
||||
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.
|
||||
These variables are put in the minimal symbol table
|
||||
only. */
|
||||
@ -1240,12 +1242,12 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
case C_FILE:
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Complete symbol table for last object file containing
|
||||
debugging information. */
|
||||
debugging information. */
|
||||
|
||||
/* Whether or not there was a csect in the previous file, we
|
||||
have to call `end_stabs' and `start_stabs' to reset
|
||||
@ -1276,9 +1278,9 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
record_debugformat (debugfmt);
|
||||
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
|
||||
boundaries. */
|
||||
boundaries. */
|
||||
file_start_addr = file_end_addr = 0;
|
||||
break;
|
||||
|
||||
@ -1316,7 +1318,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
contains number of lines to '}' */
|
||||
|
||||
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);
|
||||
within_function = 0;
|
||||
break;
|
||||
@ -1385,9 +1387,9 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
case C_BINCL:
|
||||
/* beginning of include file */
|
||||
/* 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
|
||||
to process them. Thus, we'll be saving them into a table
|
||||
(inclTable) and postpone their processing. */
|
||||
order. Thus, when wee see them, we might not know enough info
|
||||
to process them. Thus, we'll be saving them into a table
|
||||
(inclTable) and postpone their processing. */
|
||||
|
||||
record_include_begin (cs);
|
||||
break;
|
||||
@ -1410,7 +1412,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
else if (strcmp (cs->c_name, ".eb") == 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);
|
||||
break;
|
||||
}
|
||||
@ -1468,7 +1470,7 @@ read_xcoff_symtab (struct partial_symtab *pst)
|
||||
&objfile->objfile_obstack))
|
||||
|
||||
|
||||
/* process one xcoff symbol. */
|
||||
/* process one xcoff symbol. */
|
||||
|
||||
static struct symbol *
|
||||
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
|
||||
{
|
||||
/* 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;
|
||||
|
||||
switch (cs->c_sclass)
|
||||
@ -1717,7 +1719,7 @@ read_symbol_lineno (int symno)
|
||||
return 0;
|
||||
|
||||
gotit:
|
||||
/* take aux entry and return its lineno */
|
||||
/* Take aux entry and return its lineno. */
|
||||
symno++;
|
||||
bfd_coff_swap_aux_in (objfile->obfd, stbl + symno * local_symesz,
|
||||
symbol->n_type, symbol->n_sclass,
|
||||
@ -1726,7 +1728,7 @@ read_symbol_lineno (int symno)
|
||||
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
|
||||
* 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;
|
||||
}
|
||||
|
||||
/* 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++)
|
||||
if (!pst->dependencies[i]->readin)
|
||||
{
|
||||
@ -1872,7 +1874,7 @@ xcoff_new_init (struct objfile *objfile)
|
||||
static void
|
||||
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
|
||||
= 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
|
||||
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
|
||||
objfile struct from the global list of known objfiles. */
|
||||
objfile struct from the global list of known objfiles. */
|
||||
|
||||
static void
|
||||
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)
|
||||
return;
|
||||
|
||||
/* Allocate string table from objfile_obstack. We will need this table
|
||||
as long as we have its symbol table around. */
|
||||
/* Allocate string table from objfile_obstack. We will need this table
|
||||
as long as we have its symbol table around. */
|
||||
|
||||
strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length);
|
||||
((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
|
||||
is the address relative to which its symbols are (incremental) or 0
|
||||
(normal). */
|
||||
(normal). */
|
||||
|
||||
static struct partial_symtab *
|
||||
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;
|
||||
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);
|
||||
|
||||
return result;
|
||||
@ -1999,7 +2001,7 @@ static struct partial_symtab *xcoff_end_psymtab
|
||||
(struct partial_symtab *, char **, 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.
|
||||
|
||||
CAPPING_SYMBOL_NUMBER is the end of pst (exclusive).
|
||||
@ -2160,7 +2162,7 @@ static void
|
||||
scan_xcoff_symtab (struct objfile *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 *namestring;
|
||||
@ -2172,12 +2174,12 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
/* Current partial symtab */
|
||||
struct partial_symtab *pst;
|
||||
|
||||
/* List of current psymtab's include files */
|
||||
/* List of current psymtab's include files. */
|
||||
char **psymtab_include_list;
|
||||
int includes_allocated;
|
||||
int includes_used;
|
||||
|
||||
/* Index within current psymtab dependency list */
|
||||
/* Index within current psymtab dependency list. */
|
||||
struct partial_symtab **dependency_list;
|
||||
int dependencies_used, dependencies_allocated;
|
||||
|
||||
@ -2186,10 +2188,10 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
union internal_auxent main_aux[5];
|
||||
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;
|
||||
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;
|
||||
|
||||
pst = (struct partial_symtab *) 0;
|
||||
@ -2263,7 +2265,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
if (last_csect_name)
|
||||
{
|
||||
/* 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()
|
||||
compiled by xlc. */
|
||||
|
||||
@ -2372,12 +2374,12 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
|
||||
case XMC_GL:
|
||||
/* shared library function trampoline code entry
|
||||
point. */
|
||||
point. */
|
||||
|
||||
/* record trampoline code entries as
|
||||
mst_solib_trampoline symbol. When we lookup mst
|
||||
symbols, we will choose mst_text over
|
||||
mst_solib_trampoline. */
|
||||
mst_solib_trampoline. */
|
||||
RECORD_MINIMAL_SYMBOL
|
||||
(namestring, symbol.n_value,
|
||||
mst_solib_trampoline,
|
||||
@ -2546,7 +2548,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
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
|
||||
source file, or a previously included file.
|
||||
|
||||
@ -2649,7 +2651,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
symbol.n_value += ANOFFSET (objfile->section_offsets,
|
||||
SECT_OFF_DATA (objfile));
|
||||
/* 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,
|
||||
VAR_DOMAIN, LOC_STATIC,
|
||||
&objfile->global_psymbols,
|
||||
@ -2687,7 +2689,7 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
goto check_enum;
|
||||
|
||||
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,
|
||||
VAR_DOMAIN, LOC_TYPEDEF,
|
||||
@ -2812,9 +2814,9 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
}
|
||||
|
||||
/* 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"
|
||||
errors. */
|
||||
errors. */
|
||||
if (strncmp (namestring, "@FIX", 4) == 0)
|
||||
continue;
|
||||
|
||||
@ -2884,9 +2886,10 @@ scan_xcoff_symtab (struct objfile *objfile)
|
||||
dependencies_used, textlow_not_set);
|
||||
}
|
||||
|
||||
/* Record the toc offset value of this symbol table into objfile structure.
|
||||
If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain
|
||||
this information would be file auxiliary header. */
|
||||
/* Record the toc offset value of this symbol table into objfile
|
||||
structure. If no XMC_TC0 is found, toc_offset should be zero.
|
||||
Another place to obtain this information would be file auxiliary
|
||||
header. */
|
||||
|
||||
((struct coff_symfile_info *) objfile->deprecated_sym_private)->toc_offset
|
||||
= toc_offset;
|
||||
@ -2909,8 +2912,8 @@ xcoff_get_toc_offset (struct objfile *objfile)
|
||||
hung off the objfile structure.
|
||||
|
||||
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
|
||||
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)
|
||||
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)
|
||||
/* 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,
|
||||
@ -3011,7 +3014,7 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
|
||||
scan_xcoff_symtab (objfile);
|
||||
|
||||
/* 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);
|
||||
|
||||
@ -3030,7 +3033,7 @@ xcoff_symfile_offsets (struct objfile *objfile,
|
||||
obstack_alloc (&objfile->objfile_obstack,
|
||||
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");
|
||||
if (sect)
|
||||
objfile->sect_index_text = sect->index;
|
||||
|
@ -124,7 +124,7 @@ sharedlibrary_command (char *pattern, int from_tty)
|
||||
if (!vp)
|
||||
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)
|
||||
if (! pattern
|
||||
|| 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"),
|
||||
element->name);
|
||||
|
||||
/* Call the element processor. */
|
||||
/* Call the element processor. */
|
||||
if (scope->element != NULL && scope->element->end_handler)
|
||||
{
|
||||
char *body;
|
||||
|
@ -44,10 +44,10 @@ enum gdb_regnum
|
||||
/* Xstormy16 has 16 general purpose registers (R0-R15) plus PC.
|
||||
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
|
||||
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
|
||||
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_R1_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;
|
||||
};
|
||||
|
||||
/* Size of instructions, registers, etc. */
|
||||
/* Size of instructions, registers, etc. */
|
||||
enum
|
||||
{
|
||||
xstormy16_inst_size = 2,
|
||||
@ -90,11 +90,11 @@ enum
|
||||
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) \
|
||||
* xstormy16_reg_size)
|
||||
|
||||
/* Size of return datatype which fits into all return registers. */
|
||||
/* Size of return datatype which fits into all return registers. */
|
||||
enum
|
||||
{
|
||||
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)
|
||||
{
|
||||
/* Add leading zeros to the value. */
|
||||
/* Add leading zeros to the value. */
|
||||
char buf[xstormy16_reg_size];
|
||||
memset (buf, 0, xstormy16_reg_size);
|
||||
memcpy (buf, valbuf, 1);
|
||||
@ -249,7 +249,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
||||
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.
|
||||
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
|
||||
@ -260,7 +260,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
||||
if (typelen > E_MAX_RETTYPE_SIZE (argreg))
|
||||
break;
|
||||
|
||||
/* Put argument into registers wordwise. */
|
||||
/* Put argument into registers wordwise. */
|
||||
val = value_contents (args[i]);
|
||||
for (j = 0; j < typelen; j += xstormy16_reg_size)
|
||||
regcache_cooked_write_unsigned (regcache, argreg++,
|
||||
@ -286,7 +286,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
||||
memcpy (val, value_contents (args[j]), typelen);
|
||||
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);
|
||||
stack_dest += typelen + slacklen;
|
||||
}
|
||||
@ -322,7 +322,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
|
||||
LONGEST offset;
|
||||
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->framesize = xstormy16_pc_size;
|
||||
|
||||
@ -344,8 +344,8 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
|
||||
cache->framesize += xstormy16_reg_size;
|
||||
}
|
||||
|
||||
/* optional stack allocation for args and local vars <= 4 byte */
|
||||
else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */
|
||||
/* Optional stack allocation for args and local vars <= 4 byte. */
|
||||
else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */
|
||||
{
|
||||
cache->framesize += ((inst & 0x0030) >> 4) + 1;
|
||||
}
|
||||
@ -356,8 +356,8 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
|
||||
cache->framesize += (inst & 0x00f0) >> 4;
|
||||
}
|
||||
|
||||
/* optional stack allocation for args and local vars >= 16 byte */
|
||||
else if (inst == 0x314f && inst2 >= 0x0010) /* 314f HHHH add r15, #0xH */
|
||||
/* Optional stack allocation for args and local vars >= 16 byte. */
|
||||
else if (inst == 0x314f && inst2 >= 0x0010) /* 314f HHHH add r15, #0xH */
|
||||
{
|
||||
cache->framesize += inst2;
|
||||
next_addr += xstormy16_inst_size;
|
||||
@ -368,21 +368,22 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
|
||||
cache->uses_fp = 1;
|
||||
}
|
||||
|
||||
/* optional copying of args in r2-r7 to r10-r13 */
|
||||
/* Probably only in optimized case but legal action for prologue */
|
||||
/* optional copying of args in r2-r7 to r10-r13. */
|
||||
/* Probably only in optimized case but legal action for prologue. */
|
||||
else if ((inst & 0xff00) == 0x4600 /* 46SD mov rD, rS */
|
||||
&& (inst & 0x00f0) >= 0x0020 && (inst & 0x00f0) <= 0x0070
|
||||
&& (inst & 0x000f) >= 0x00a0 && (inst & 0x000f) <= 0x000d)
|
||||
;
|
||||
|
||||
/* optional copying of args in r2-r7 to stack */
|
||||
/* 72DS HHHH mov.b (rD, 0xHHHH), r(S-8) (bit3 always 1, bit2-0 = reg) */
|
||||
/* Optional copying of args in r2-r7 to stack. */
|
||||
/* 72DS HHHH mov.b (rD, 0xHHHH), r(S-8)
|
||||
(bit3 always 1, bit2-0 = reg) */
|
||||
/* 73DS HHHH mov.w (rD, 0xHHHH), r(S-8) */
|
||||
else if ((inst & 0xfed8) == 0x72d8 && (inst & 0x0007) >= 2)
|
||||
{
|
||||
regnum = inst & 0x0007;
|
||||
/* Only 12 of 16 bits of the argument are used for the
|
||||
signed offset. */
|
||||
signed offset. */
|
||||
offset = (LONGEST) (inst2 & 0x0fff);
|
||||
if (offset & 0x0800)
|
||||
offset -= 0x1000;
|
||||
@ -391,7 +392,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
|
||||
next_addr += xstormy16_inst_size;
|
||||
}
|
||||
|
||||
else /* Not a prologue instruction. */
|
||||
else /* Not a prologue instruction. */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -423,7 +424,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
|
||||
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,
|
||||
&cache, NULL);
|
||||
if (!cache.uses_fp)
|
||||
@ -431,7 +432,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
|
||||
/* Found a function. */
|
||||
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)
|
||||
{
|
||||
sal = find_pc_line (func_addr, 0);
|
||||
@ -441,18 +442,18 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
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;
|
||||
}
|
||||
|
||||
/* No function symbol -- just return the PC. */
|
||||
/* No function symbol -- just return the PC. */
|
||||
|
||||
return (CORE_ADDR) pc;
|
||||
}
|
||||
|
||||
/* 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
|
||||
destroys the function's stack frame. */
|
||||
destroys the function's stack frame. */
|
||||
static int
|
||||
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;
|
||||
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)
|
||||
return 0;
|
||||
|
||||
/* 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,
|
||||
xstormy16_inst_size, byte_order);
|
||||
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)
|
||||
{
|
||||
inst = read_memory_unsigned_integer (addr,
|
||||
xstormy16_inst_size, byte_order);
|
||||
xstormy16_inst_size,
|
||||
byte_order);
|
||||
if (inst >= 0x009a && inst <= 0x009d) /* pop r10...r13 */
|
||||
continue;
|
||||
if (inst == 0x305f || inst == 0x307f) /* dec r15, #0x1/#0x3 */
|
||||
break;
|
||||
inst2 = read_memory_unsigned_integer (addr - xstormy16_inst_size,
|
||||
xstormy16_inst_size, byte_order);
|
||||
if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
|
||||
xstormy16_inst_size,
|
||||
byte_order);
|
||||
if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
|
||||
{
|
||||
addr -= xstormy16_inst_size;
|
||||
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
|
||||
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
|
||||
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;
|
||||
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"))
|
||||
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
|
||||
address of the corresponding jump table entry. Return 0 if
|
||||
not found. */
|
||||
not found. */
|
||||
static CORE_ADDR
|
||||
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;
|
||||
|
||||
/* 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"))
|
||||
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))
|
||||
return 0;
|
||||
inst = extract_unsigned_integer (buf,
|
||||
xstormy16_inst_size, byte_order);
|
||||
xstormy16_inst_size,
|
||||
byte_order);
|
||||
inst2 = extract_unsigned_integer (buf + xstormy16_inst_size,
|
||||
xstormy16_inst_size, byte_order);
|
||||
xstormy16_inst_size,
|
||||
byte_order);
|
||||
faddr2 = inst2 << 8 | (inst & 0xff);
|
||||
if (faddr == faddr2)
|
||||
return addr;
|
||||
@ -772,14 +777,14 @@ xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||
|
||||
/* Function: xstormy16_gdbarch_init
|
||||
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 *
|
||||
xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
{
|
||||
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);
|
||||
if (arches != NULL)
|
||||
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_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
|
||||
|
||||
/* Stack grows up. */
|
||||
/* Stack grows up. */
|
||||
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
|
||||
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
|
||||
_initialize_xstormy16_tdep (void)
|
||||
|
@ -116,7 +116,8 @@ static int xtensa_debug_level = 0;
|
||||
#define PS_WOE (1<<18)
|
||||
#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
|
||||
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 callsize; /* Call size of this frame. */
|
||||
int ws; /* WINDOWSTART of the previous frame. It keeps track of
|
||||
life windows only. If there is no bit set for the
|
||||
window, that means it had been already spilled
|
||||
because of window overflow. */
|
||||
int ws; /* WINDOWSTART of the previous frame. It
|
||||
keeps track of life windows only. If there
|
||||
is no bit set for the window, that means it
|
||||
had been already spilled because of window
|
||||
overflow. */
|
||||
|
||||
/* Spilled A-registers from the previous frame.
|
||||
AREGS[i] == -1, if corresponding AR is alive. */
|
||||
@ -902,7 +904,8 @@ typedef struct xtensa_windowed_frame_cache
|
||||
|
||||
/* 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_CLESV 12 /* Callee-saved registers are here and up. */
|
||||
#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
|
||||
is derived, or C0_CONST, or C0_INEXP. */
|
||||
int fr_ofs; /* constant offset from reg, or immediate value. */
|
||||
int to_stk; /* offset from original SP to register (4-byte aligned),
|
||||
or C0_NOSTK if register has not been saved. */
|
||||
int to_stk; /* offset from original SP to register (4-byte
|
||||
aligned), or C0_NOSTK if register has not
|
||||
been saved. */
|
||||
} xtensa_c0reg_t;
|
||||
|
||||
|
||||
@ -938,7 +942,8 @@ typedef struct xtensa_c0reg
|
||||
typedef struct xtensa_call0_frame_cache
|
||||
{
|
||||
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 c0_fp; /* Actual value of frame pointer. */
|
||||
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;
|
||||
|
||||
/* 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,
|
||||
is, slot, ®ister_operand) != 0)
|
||||
@ -1132,7 +1137,8 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
|
||||
®ister_operand) != 0)
|
||||
RETURN_FP;
|
||||
|
||||
fp_regnum = gdbarch_tdep (gdbarch)->a0_base + register_operand;
|
||||
fp_regnum
|
||||
= gdbarch_tdep (gdbarch)->a0_base + register_operand;
|
||||
RETURN_FP;
|
||||
}
|
||||
}
|
||||
@ -1166,8 +1172,7 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
|
||||
|
||||
cache->base = SP (or best guess about FP) of this frame;
|
||||
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
|
||||
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 RA is equal to 0 this frame is an outermost frame. Leave
|
||||
cache->prev_sp unchanged marking the boundary of the frame stack. */
|
||||
/* If RA is equal to 0 this frame is an outermost frame.
|
||||
Leave cache->prev_sp unchanged marking the boundary of the
|
||||
frame stack. */
|
||||
{
|
||||
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,
|
||||
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
|
||||
- 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). */
|
||||
if (len > (callsize > 8 ? 8 : 16))
|
||||
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
|
||||
register (A2) in the caller window. */
|
||||
@ -1612,8 +1621,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
|
||||
int align; /* alignment */
|
||||
union
|
||||
{
|
||||
int offset; /* stack offset if on stack */
|
||||
int regno; /* regno if in register */
|
||||
int offset; /* stack offset if on stack. */
|
||||
int regno; /* regno if in register. */
|
||||
} u;
|
||||
};
|
||||
|
||||
@ -1912,7 +1921,8 @@ typedef enum {
|
||||
c0opc_mov, /* Moving a register to a register. */
|
||||
c0opc_movi, /* Moving an immediate to a register. */
|
||||
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. */
|
||||
} xtensa_insn_kind;
|
||||
|
||||
@ -2216,7 +2226,8 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
|
||||
goto done;
|
||||
|
||||
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);
|
||||
if (opc == XTENSA_UNDEFINED)
|
||||
opclass = c0opc_illegal;
|
||||
@ -2302,7 +2313,8 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
|
||||
|
||||
static void
|
||||
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);
|
||||
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
|
||||
&& cache->c0.c0_rt[C0_RA].fr_ofs == 0)
|
||||
{
|
||||
/* Special case for terminating backtrace at a function that wants to
|
||||
be seen as the outermost. Such a function will clear it's RA (A0)
|
||||
register to 0 in the prologue instead of saving its original value. */
|
||||
/* Special case for terminating backtrace at a function that
|
||||
wants to be seen as the outermost. Such a function will
|
||||
clear it's RA (A0) register to 0 in the prologue instead of
|
||||
saving its original value. */
|
||||
ra = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* RA was copied to another register or (before any function call) may
|
||||
still be in the original RA register. This is not always reliable:
|
||||
even in a leaf function, register tracking stops after prologue, and
|
||||
even in prologue, non-prologue instructions (not tracked) may overwrite
|
||||
RA or any register it was copied to. If likely in prologue or before
|
||||
any call, use retracking info and hope for the best (compiler should
|
||||
have saved RA in stack if not in a leaf function). If not in prologue,
|
||||
too bad. */
|
||||
/* RA was copied to another register or (before any function
|
||||
call) may still be in the original RA register. This is not
|
||||
always reliable: even in a leaf function, register tracking
|
||||
stops after prologue, and even in prologue, non-prologue
|
||||
instructions (not tracked) may overwrite RA or any register
|
||||
it was copied to. If likely in prologue or before any call,
|
||||
use retracking info and hope for the best (compiler should
|
||||
have saved RA in stack if not in a leaf function). If not in
|
||||
prologue, too bad. */
|
||||
|
||||
int i;
|
||||
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_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_believe_pcc_promotion (gdbarch, 1);
|
||||
@ -2736,9 +2750,9 @@ _initialize_xtensa_tdep (void)
|
||||
|
||||
add_setshow_zinteger_cmd ("xtensa",
|
||||
class_maintenance,
|
||||
&xtensa_debug_level, _("\
|
||||
Set Xtensa debugging."), _("\
|
||||
Show Xtensa debugging."), _("\
|
||||
&xtensa_debug_level,
|
||||
_("Set Xtensa debugging."),
|
||||
_("Show Xtensa debugging."), _("\
|
||||
When non-zero, Xtensa-specific debugging is enabled. \
|
||||
Can be 1, 2, 3, or 4 indicating the level of debugging."),
|
||||
NULL,
|
||||
|
@ -82,7 +82,7 @@ typedef enum
|
||||
} 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>. */
|
||||
|
||||
typedef unsigned long xtensa_elf_greg_t;
|
||||
@ -145,7 +145,7 @@ typedef struct
|
||||
|
||||
/* 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) \
|
||||
{#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},
|
||||
#define XTREG_END {0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user