From 581e13c1888512fde1bd3ff9e46f1a3ec4c337d7 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Wed, 12 Jan 2011 01:23:29 +0000 Subject: [PATCH] 2011-01-11 Michael Snyder * 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. --- gdb/ChangeLog | 29 ++++ gdb/ui-file.c | 22 +-- gdb/ui-file.h | 20 +-- gdb/ui-out.c | 60 ++++---- gdb/ui-out.h | 20 +-- gdb/utils.c | 82 +++++------ gdb/v850-tdep.c | 16 ++- gdb/valarith.c | 56 ++++---- gdb/valops.c | 42 +++--- gdb/valprint.c | 112 +++++++-------- gdb/valprint.h | 2 +- gdb/value.c | 36 +++-- gdb/value.h | 2 +- gdb/varobj.c | 317 ++++++++++++++++++++++--------------------- gdb/varobj.h | 16 +-- gdb/vax-tdep.c | 2 +- gdb/vec.c | 6 +- gdb/vec.h | 28 ++-- gdb/version.h | 4 +- gdb/windows-nat.c | 247 ++++++++++++++++++--------------- gdb/windows-tdep.c | 25 ++-- gdb/xcoffread.c | 207 ++++++++++++++-------------- gdb/xcoffsolib.c | 2 +- gdb/xml-support.c | 2 +- gdb/xstormy16-tdep.c | 88 ++++++------ gdb/xtensa-tdep.c | 90 ++++++------ gdb/xtensa-tdep.h | 4 +- 27 files changed, 811 insertions(+), 726 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9d670a986e7..83c7230756d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -61,6 +61,35 @@ * trad-frame.h: Ditto. * typeprint.c: Ditto. +2011-01-11 Michael Snyder + + * 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 * breakpoint.c (resources_needed_watchpoint): Fix indentation. diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 8adcf891e35..aea71038004 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* 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 - 's FILE. */ + '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) diff --git a/gdb/ui-file.h b/gdb/ui-file.h index 873b48cae1e..01cee1f1b85 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -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 diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 1e4ff4e7a1c..53ad963a648 100644 --- a/gdb/ui-out.c +++ b/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) diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 654733a8fd3..4ad0651ad37 100644 --- a/gdb/ui-out.h +++ b/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 { diff --git a/gdb/utils.c b/gdb/utils.c index 985f2191614..c23c4d490e7 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -38,7 +38,7 @@ #include #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 --- 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])) diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 523db187153..620536f1f82 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -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; } diff --git a/gdb/valarith.c b/gdb/valarith.c index bbf018a996d..a2bf7b0eb56 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -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) diff --git a/gdb/valops.c b/gdb/valops.c index 52a1d4ec9d7..9dc51eef269 100644 --- a/gdb/valops.c +++ b/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 " diff --git a/gdb/valprint.c b/gdb/valprint.c index d78df5c7ca0..f65fe27d723 100644 --- a/gdb/valprint.c +++ b/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, _("\ diff --git a/gdb/valprint.h b/gdb/valprint.h index f12b2595d09..3764aca4c73 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -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 diff --git a/gdb/value.c b/gdb/value.c index ffc85d67c86..9769d83dd7b 100644 --- a/gdb/value.c +++ b/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. */ diff --git a/gdb/value.h b/gdb/value.h index e6378422e1f..16f4646af09 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -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); diff --git a/gdb/varobj.c b/gdb/varobj.c index 1792c2eaf4a..0c90645ea64 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -53,11 +53,11 @@ show_varobjdebug (struct ui_file *file, int from_tty, fprintf_filtered (file, _("Varobj debugging is %s.\n"), value); } -/* String representations of gdb's format codes */ +/* String representations of gdb's format codes. */ char *varobj_format_string[] = { "natural", "binary", "decimal", "hexadecimal", "octal" }; -/* String representations of gdb's known languages */ +/* String representations of gdb's known languages. */ char *varobj_language_string[] = { "unknown", "C", "C++", "Java" }; /* True if we want to allow Python-based pretty-printing. */ @@ -72,14 +72,14 @@ varobj_enable_pretty_printing (void) /* Data structures */ /* Every root variable has one of these structures saved in its - varobj. Members which must be free'd are noted. */ + varobj. Members which must be free'd are noted. */ struct varobj_root { - /* Alloc'd expression for this parent. */ + /* Alloc'd expression for this parent. */ struct expression *exp; - /* Block for which this expression is valid */ + /* Block for which this expression is valid. */ struct block *valid_block; /* The frame for this expression. This field is set iff valid_block is @@ -87,7 +87,7 @@ struct varobj_root struct frame_id frame; /* The thread ID that this varobj_root belong to. This field - is only valid if valid_block is not NULL. + is only valid if valid_block is not NULL. When not 0, indicates which thread 'frame' belongs to. When 0, indicates that the thread list was empty when the varobj_root was created. */ @@ -95,17 +95,17 @@ struct varobj_root /* If 1, the -var-update always recomputes the value in the current thread and frame. Otherwise, variable object is - always updated in the specific scope/thread/frame */ + always updated in the specific scope/thread/frame. */ int floating; /* Flag that indicates validity: set to 0 when this varobj_root refers to symbols that do not exist anymore. */ int is_valid; - /* Language info for this variable and its children */ + /* Language info for this variable and its children. */ struct language_specific *lang; - /* The varobj for this root node. */ + /* The varobj for this root node. */ struct varobj *rootvar; /* Next root variable */ @@ -113,26 +113,26 @@ struct varobj_root }; /* Every variable in the system has a structure of this type defined - for it. This structure holds all information necessary to manipulate - a particular object variable. Members which must be freed are noted. */ + for it. This structure holds all information necessary to manipulate + a particular object variable. Members which must be freed are noted. */ struct varobj { - /* Alloc'd name of the variable for this object.. If this variable is a + /* Alloc'd name of the variable for this object. If this variable is a child, then this name will be the child's source name. - (bar, not foo.bar) */ - /* NOTE: This is the "expression" */ + (bar, not foo.bar). */ + /* NOTE: This is the "expression". */ char *name; /* Alloc'd expression for this child. Can be used to create a root variable corresponding to this child. */ char *path_expr; - /* The alloc'd name for this variable's object. This is here for - convenience when constructing this object's children. */ + /* The alloc'd name for this variable's object. This is here for + convenience when constructing this object's children. */ char *obj_name; - /* Index of this variable in its parent or -1 */ + /* Index of this variable in its parent or -1. */ int index; /* The type of this variable. This can be NULL @@ -146,10 +146,10 @@ struct varobj the value is either NULL, or not lazy. */ struct value *value; - /* The number of (immediate) children this variable has */ + /* The number of (immediate) children this variable has. */ int num_children; - /* If this object is a child, this points to its immediate parent. */ + /* If this object is a child, this points to its immediate parent. */ struct varobj *parent; /* Children of this object. */ @@ -161,13 +161,14 @@ struct varobj can avoid that. */ int children_requested; - /* Description of the root variable. Points to root variable for children. */ + /* Description of the root variable. Points to root variable for + children. */ struct varobj_root *root; - /* The format of the output for this object */ + /* The format of the output for this object. */ enum varobj_display_formats format; - /* Was this variable updated via a varobj_set_value operation */ + /* Was this variable updated via a varobj_set_value operation. */ int updated; /* Last print value. */ @@ -226,7 +227,7 @@ struct vlist /* Private function prototypes */ -/* Helper functions for the above subcommands. */ +/* Helper functions for the above subcommands. */ static int delete_variable (struct cpstack **, struct varobj *, int); @@ -268,7 +269,7 @@ static char *cppop (struct cpstack **pstack); static int install_new_value (struct varobj *var, struct value *value, int initial); -/* Language-specific routines. */ +/* Language-specific routines. */ static enum varobj_languages variable_language (struct varobj *var); @@ -364,39 +365,39 @@ static char *java_value_of_variable (struct varobj *var, struct language_specific { - /* The language of this variable */ + /* The language of this variable. */ enum varobj_languages language; - /* The number of children of PARENT. */ + /* The number of children of PARENT. */ int (*number_of_children) (struct varobj * parent); - /* The name (expression) of a root varobj. */ + /* The name (expression) of a root varobj. */ char *(*name_of_variable) (struct varobj * parent); - /* The name of the INDEX'th child of PARENT. */ + /* The name of the INDEX'th child of PARENT. */ char *(*name_of_child) (struct varobj * parent, int index); /* Returns the rooted expression of CHILD, which is a variable obtain that has some parent. */ char *(*path_expr_of_child) (struct varobj * child); - /* The ``struct value *'' of the root variable ROOT. */ + /* The ``struct value *'' of the root variable ROOT. */ struct value *(*value_of_root) (struct varobj ** root_handle); - /* The ``struct value *'' of the INDEX'th child of PARENT. */ + /* The ``struct value *'' of the INDEX'th child of PARENT. */ struct value *(*value_of_child) (struct varobj * parent, int index); - /* The type of the INDEX'th child of PARENT. */ + /* The type of the INDEX'th child of PARENT. */ struct type *(*type_of_child) (struct varobj * parent, int index); - /* The current value of VAR. */ + /* The current value of VAR. */ char *(*value_of_variable) (struct varobj * var, enum varobj_display_formats format); }; -/* Array of known source language routines. */ +/* Array of known source language routines. */ static struct language_specific languages[vlang_end] = { - /* Unknown (try treating as C */ + /* Unknown (try treating as C). */ { vlang_unknown, c_number_of_children, @@ -445,7 +446,7 @@ static struct language_specific languages[vlang_end] = { java_value_of_variable} }; -/* A little convenience enum for dealing with C++/Java */ +/* A little convenience enum for dealing with C++/Java. */ enum vsections { v_public = 0, v_private, v_protected @@ -453,20 +454,20 @@ enum vsections /* Private data */ -/* Mappings of varobj_display_formats enums to gdb's format codes */ +/* Mappings of varobj_display_formats enums to gdb's format codes. */ static int format_code[] = { 0, 't', 'd', 'x', 'o' }; -/* Header of the list of root variable objects */ +/* Header of the list of root variable objects. */ static struct varobj_root *rootlist; -/* Prime number indicating the number of buckets in the hash table */ -/* A prime large enough to avoid too many colisions */ +/* Prime number indicating the number of buckets in the hash table. */ +/* A prime large enough to avoid too many colisions. */ #define VAROBJ_TABLE_SIZE 227 -/* Pointer to the varobj hash table (built at run time) */ +/* Pointer to the varobj hash table (built at run time). */ static struct vlist **varobj_table; -/* Is the variable X one of our "fake" children? */ +/* Is the variable X one of our "fake" children? */ #define CPLUS_FAKE_CHILD(x) \ ((x) != NULL && (x)->type == NULL && (x)->value == NULL) @@ -489,7 +490,7 @@ varobj_ensure_python_env (struct varobj *var) } #endif -/* Creates a varobj (not its children) */ +/* Creates a varobj (not its children). */ /* Return the full FRAME which corresponds to the given CORE_ADDR or NULL if no FRAME on the chain corresponds to CORE_ADDR. */ @@ -530,7 +531,7 @@ varobj_create (char *objname, struct varobj *var; struct cleanup *old_chain; - /* Fill out a varobj structure for the (root) variable being constructed. */ + /* Fill out a varobj structure for the (root) variable being constructed. */ var = new_root_variable (); old_chain = make_cleanup_free_variable (var); @@ -548,7 +549,7 @@ varobj_create (char *objname, if (has_stack_frames ()) { - /* Allow creator to specify context of variable */ + /* Allow creator to specify context of variable. */ if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME)) fi = get_selected_frame (NULL); else @@ -564,7 +565,7 @@ varobj_create (char *objname, else fi = NULL; - /* frame = -2 means always use selected frame */ + /* frame = -2 means always use selected frame. */ if (type == USE_SELECTED_FRAME) var->root->floating = 1; @@ -575,13 +576,13 @@ varobj_create (char *objname, p = expression; innermost_block = NULL; /* Wrap the call to parse expression, so we can - return a sensible error. */ + return a sensible error. */ if (!gdb_parse_exp_1 (&p, block, 0, &var->root->exp)) { return NULL; } - /* Don't allow variables to be created for types. */ + /* Don't allow variables to be created for types. */ if (var->root->exp->elts[0].opcode == OP_TYPE) { do_cleanups (old_chain); @@ -599,7 +600,7 @@ varobj_create (char *objname, /* When the frame is different from the current frame, we must select the appropriate frame before parsing the expression, otherwise the value will not be current. - Since select_frame is so benign, just call it for all cases. */ + Since select_frame is so benign, just call it for all cases. */ if (innermost_block) { /* User could specify explicit FRAME-ADDR which was not found but @@ -617,7 +618,7 @@ varobj_create (char *objname, /* We definitely need to catch errors here. If evaluate_expression succeeds we got the value we wanted. - But if it fails, we still go on with a call to evaluate_type() */ + But if it fails, we still go on with a call to evaluate_type(). */ if (!gdb_evaluate_expression (var->root->exp, &value)) { /* Error getting the value. Try to at least get the @@ -635,23 +636,23 @@ varobj_create (char *objname, lang = variable_language (var); var->root->lang = &languages[lang]; - /* Set ourselves as our root */ + /* Set ourselves as our root. */ var->root->rootvar = var; - /* Reset the selected frame */ + /* Reset the selected frame. */ if (frame_id_p (old_id)) select_frame (frame_find_by_id (old_id)); } /* If the variable object name is null, that means this - is a temporary variable, so don't install it. */ + is a temporary variable, so don't install it. */ if ((var != NULL) && (objname != NULL)) { var->obj_name = xstrdup (objname); /* If a varobj name is duplicated, the install will fail so - we must clenup */ + we must cleanup. */ if (!install_variable (var)) { do_cleanups (old_chain); @@ -663,7 +664,7 @@ varobj_create (char *objname, return var; } -/* Generates an unique name that can be used for a varobj */ +/* Generates an unique name that can be used for a varobj. */ char * varobj_gen_name (void) @@ -671,7 +672,7 @@ varobj_gen_name (void) static int id = 0; char *obj_name; - /* generate a name for this object */ + /* Generate a name for this object. */ id++; obj_name = xstrprintf ("var%d", id); @@ -704,7 +705,7 @@ varobj_get_handle (char *objname) return cv->var; } -/* Given the handle, return the name of the object */ +/* Given the handle, return the name of the object. */ char * varobj_get_objname (struct varobj *var) @@ -712,7 +713,7 @@ varobj_get_objname (struct varobj *var) return var->obj_name; } -/* Given the handle, return the expression represented by the object */ +/* Given the handle, return the expression represented by the object. */ char * varobj_get_expression (struct varobj *var) @@ -723,7 +724,7 @@ varobj_get_expression (struct varobj *var) /* Deletes a varobj and all its children if only_children == 0, otherwise deletes only the children; returns a malloc'ed list of all the (malloc'ed) names of the variables that have been deleted - (NULL terminated) */ + (NULL terminated). */ int varobj_delete (struct varobj *var, char ***dellist, int only_children) @@ -733,17 +734,17 @@ varobj_delete (struct varobj *var, char ***dellist, int only_children) struct cpstack *result = NULL; char **cp; - /* Initialize a stack for temporary results */ + /* Initialize a stack for temporary results. */ cppush (&result, NULL); if (only_children) - /* Delete only the variable children */ + /* Delete only the variable children. */ delcount = delete_variable (&result, var, 1 /* only the children */ ); else - /* Delete the variable and all its children */ + /* Delete the variable and all its children. */ delcount = delete_variable (&result, var, 0 /* parent+children */ ); - /* We may have been asked to return a list of what has been deleted */ + /* We may have been asked to return a list of what has been deleted. */ if (dellist != NULL) { *dellist = xmalloc ((delcount + 1) * sizeof (char *)); @@ -788,7 +789,7 @@ instantiate_pretty_printer (PyObject *constructor, struct value *value) #endif -/* Set/Get variable object display format */ +/* Set/Get variable object display format. */ enum varobj_display_formats varobj_set_display_format (struct varobj *var, @@ -855,7 +856,7 @@ varobj_has_more (struct varobj *var, int to) /* If the variable object is bound to a specific thread, that is its evaluation can always be done in context of a frame inside that thread, returns GDB id of the thread -- which - is always positive. Otherwise, returns -1. */ + is always positive. Otherwise, returns -1. */ int varobj_get_thread_id (struct varobj *var) { @@ -1119,7 +1120,7 @@ varobj_get_num_children (struct varobj *var) } /* Creates a list of the immediate children of a variable object; - the return code is the number of such children or -1 on error */ + the return code is the number of such children or -1 on error. */ VEC (varobj_p)* varobj_list_children (struct varobj *var, int *from, int *to) @@ -1187,12 +1188,12 @@ varobj_add_child (struct varobj *var, const char *name, struct value *value) #endif /* HAVE_PYTHON */ /* Obtain the type of an object Variable as a string similar to the one gdb - prints on the console */ + prints on the console. */ char * varobj_get_type (struct varobj *var) { - /* For the "fake" variables, do not return a type. (It's type is + /* For the "fake" variables, do not return a type. (It's type is NULL, too.) Do not return a type for invalid variables as well. */ if (CPLUS_FAKE_CHILD (var) || !var->root->is_valid) @@ -1238,7 +1239,7 @@ varobj_get_attributes (struct varobj *var) int attributes = 0; if (varobj_editable_p (var)) - /* FIXME: define masks for attributes */ + /* FIXME: define masks for attributes. */ attributes |= 0x00000001; /* Editable */ return attributes; @@ -1264,8 +1265,8 @@ varobj_get_value (struct varobj *var) } /* Set the value of an object variable (if it is editable) to the - value of the given expression */ -/* Note: Invokes functions that can call error() */ + value of the given expression. */ +/* Note: Invokes functions that can call error(). */ int varobj_set_value (struct varobj *var, char *expression) @@ -1273,8 +1274,8 @@ varobj_set_value (struct varobj *var, char *expression) struct value *val; /* The argument "expression" contains the variable's new value. - We need to first construct a legal expression for this -- ugh! */ - /* Does this cover all the bases? */ + We need to first construct a legal expression for this -- ugh! */ + /* Does this cover all the bases? */ struct expression *exp; struct value *value; int saved_input_radix = input_radix; @@ -1282,11 +1283,11 @@ varobj_set_value (struct varobj *var, char *expression) gdb_assert (varobj_editable_p (var)); - input_radix = 10; /* ALWAYS reset to decimal temporarily */ + input_radix = 10; /* ALWAYS reset to decimal temporarily. */ exp = parse_exp_1 (&s, 0, 0); if (!gdb_evaluate_expression (exp, &value)) { - /* We cannot proceed without a valid expression. */ + /* We cannot proceed without a valid expression. */ xfree (exp); return 0; } @@ -1319,7 +1320,7 @@ varobj_set_value (struct varobj *var, char *expression) variable as changed -- because the first assignment has set the 'updated' flag. There's no need to optimize that, because return value of -var-update should be considered an approximation. */ - var->updated = install_new_value (var, val, 0 /* Compare values. */); + var->updated = install_new_value (var, val, 0 /* Compare values. */); input_radix = saved_input_radix; return 1; } @@ -1437,12 +1438,12 @@ install_new_value_visualizer (struct varobj *var) this is the first assignement after the variable object was just created, or changed type. In that case, just assign the value and return 0. - Otherwise, assign the new value, and return 1 if the value is different - from the current one, 0 otherwise. The comparison is done on textual - representation of value. Therefore, some types need not be compared. E.g. - for structures the reported value is always "{...}", so no comparison is - necessary here. If the old value was NULL and new one is not, or vice versa, - we always return 1. + Otherwise, assign the new value, and return 1 if the value is + different from the current one, 0 otherwise. The comparison is + done on textual representation of value. Therefore, some types + need not be compared. E.g. for structures the reported value is + always "{...}", so no comparison is necessary here. If the old + value was NULL and new one is not, or vice versa, we always return 1. The VALUE parameter should not be released -- the function will take care of releasing it when needed. */ @@ -1457,12 +1458,12 @@ install_new_value (struct varobj *var, struct value *value, int initial) /* We need to know the varobj's type to decide if the value should be fetched or not. C++ fake children (public/protected/private) - don't have a type. */ + don't have a type. */ gdb_assert (var->type || CPLUS_FAKE_CHILD (var)); changeable = varobj_value_is_changeable_p (var); /* If the type has custom visualizer, we consider it to be always - changeable. FIXME: need to make sure this behaviour will not + changeable. FIXME: need to make sure this behaviour will not mess up read-sensitive values. */ if (var->pretty_printer) changeable = 1; @@ -1532,7 +1533,7 @@ install_new_value (struct varobj *var, struct value *value, int initial) /* If the value of the varobj was changed by -var-set-value, then the value in the varobj and in the target is the same. However, that value is different from the value that the - varobj had after the previous -var-update. So need to the + varobj had after the previous -var-update. So need to the varobj as changed. */ if (var->updated) { @@ -1552,7 +1553,7 @@ install_new_value (struct varobj *var, struct value *value, int initial) changed = 1; } else if (var->value == NULL && value == NULL) - /* Equal. */ + /* Equal. */ ; else if (var->value == NULL || value == NULL) { @@ -1678,10 +1679,10 @@ varobj_set_visualizer (struct varobj *var, const char *visualizer) The EXPLICIT parameter specifies if this call is result of MI request to update this specific variable, or - result of implicit -var-update *. For implicit request, we don't + result of implicit -var-update *. For implicit request, we don't update frozen variables. - NOTE: This function may delete the caller's varobj. If it + NOTE: This function may delete the caller's varobj. If it returns TYPE_CHANGED, then it has done this and VARP will be modified to point to the new varobj. */ @@ -1719,9 +1720,9 @@ VEC(varobj_update_result) *varobj_update (struct varobj **varp, int explicit) r.varobj = *varp; r.status = VAROBJ_IN_SCOPE; - /* Update the root variable. value_of_root can return NULL + /* Update the root variable. value_of_root can return NULL if the variable is no longer around, i.e. we stepped out of - the frame in which a local existed. We are letting the + the frame in which a local existed. We are letting the value_of_root variable dispose of the varobj if the type has changed. */ new = value_of_root (varp, &type_changed); @@ -1774,7 +1775,7 @@ VEC(varobj_update_result) *varobj_update (struct varobj **varp, int explicit) /* We probably should not get children of a varobj that has a pretty-printer, but for which -var-list-children was never - invoked. */ + invoked. */ if (v->pretty_printer) { VEC (varobj_p) *changed = 0, *new = 0, *unchanged = 0; @@ -1903,10 +1904,10 @@ delete_variable (struct cpstack **resultp, struct varobj *var, return delcount; } -/* Delete the variable object VAR and its children */ +/* Delete the variable object VAR and its children. */ /* IMPORTANT NOTE: If we delete a variable which is a child and the parent is not removed we dump core. It must be always - initially called with remove_from_parent_p set */ + initially called with remove_from_parent_p set. */ static void delete_variable_1 (struct cpstack **resultp, int *delcountp, struct varobj *var, int only_children_p, @@ -1914,7 +1915,7 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp, { int i; - /* Delete any children of this variable, too. */ + /* Delete any children of this variable, too. */ for (i = 0; i < VEC_length (varobj_p, var->children); ++i) { varobj_p child = VEC_index (varobj_p, var->children, i); @@ -1927,24 +1928,24 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp, } VEC_free (varobj_p, var->children); - /* if we were called to delete only the children we are done here */ + /* if we were called to delete only the children we are done here. */ if (only_children_p) return; - /* Otherwise, add it to the list of deleted ones and proceed to do so */ + /* Otherwise, add it to the list of deleted ones and proceed to do so. */ /* If the name is null, this is a temporary variable, that has not - yet been installed, don't report it, it belongs to the caller... */ + yet been installed, don't report it, it belongs to the caller... */ if (var->obj_name != NULL) { cppush (resultp, xstrdup (var->obj_name)); *delcountp = *delcountp + 1; } - /* If this variable has a parent, remove it from its parent's list */ + /* If this variable has a parent, remove it from its parent's list. */ /* OPTIMIZATION: if the parent of this variable is also being deleted, (as indicated by remove_from_parent_p) we don't bother doing an expensive list search to find the element to remove when we are - discarding the list afterwards */ + discarding the list afterwards. */ if ((remove_from_parent_p) && (var->parent != NULL)) { VEC_replace (varobj_p, var->parent->children, var->index, NULL); @@ -1953,11 +1954,11 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp, if (var->obj_name != NULL) uninstall_variable (var); - /* Free memory associated with this variable */ + /* Free memory associated with this variable. */ free_variable (var); } -/* Install the given variable VAR with the object name VAR->OBJ_NAME. */ +/* Install the given variable VAR with the object name VAR->OBJ_NAME. */ static int install_variable (struct varobj *var) { @@ -1979,16 +1980,16 @@ install_variable (struct varobj *var) if (cv != NULL) error (_("Duplicate variable object name")); - /* Add varobj to hash table */ + /* Add varobj to hash table. */ newvl = xmalloc (sizeof (struct vlist)); newvl->next = *(varobj_table + index); newvl->var = var; *(varobj_table + index) = newvl; - /* If root, add varobj to root list */ + /* If root, add varobj to root list. */ if (is_root_p (var)) { - /* Add to list of root variables */ + /* Add to list of root variables. */ if (rootlist == NULL) var->root->next = NULL; else @@ -1999,7 +2000,7 @@ install_variable (struct varobj *var) return 1; /* OK */ } -/* Unistall the object VAR. */ +/* Unistall the object VAR. */ static void uninstall_variable (struct varobj *var) { @@ -2011,7 +2012,7 @@ uninstall_variable (struct varobj *var) unsigned int index = 0; unsigned int i = 1; - /* Remove varobj from hash table */ + /* Remove varobj from hash table. */ for (chp = var->obj_name; *chp; chp++) { index = (index + (i++ * (unsigned int) *chp)) % VAROBJ_TABLE_SIZE; @@ -2043,10 +2044,10 @@ uninstall_variable (struct varobj *var) xfree (cv); - /* If root, remove varobj from root list */ + /* If root, remove varobj from root list. */ if (is_root_p (var)) { - /* Remove from list of root variables */ + /* Remove from list of root variables. */ if (rootlist == var->root) rootlist = var->root->next; else @@ -2074,7 +2075,7 @@ uninstall_variable (struct varobj *var) } -/* Create and install a child of the parent of the given name */ +/* Create and install a child of the parent of the given name. */ static struct varobj * create_child (struct varobj *parent, int index, char *name) { @@ -2091,7 +2092,7 @@ create_child_with_value (struct varobj *parent, int index, const char *name, child = new_variable (); - /* name is allocated by name_of_child */ + /* Name is allocated by name_of_child. */ /* FIXME: xstrdup should not be here. */ child->name = xstrdup (name); child->index = index; @@ -2105,10 +2106,10 @@ create_child_with_value (struct varobj *parent, int index, const char *name, calling install_new_value. */ if (value != NULL) /* If the child had no evaluation errors, var->value - will be non-NULL and contain a valid type. */ + will be non-NULL and contain a valid type. */ child->type = value_type (value); else - /* Otherwise, we must compute the type. */ + /* Otherwise, we must compute the type. */ child->type = (*child->root->lang->type_of_child) (child->parent, child->index); install_new_value (child, value, 1); @@ -2121,7 +2122,7 @@ create_child_with_value (struct varobj *parent, int index, const char *name, * Miscellaneous utility functions. */ -/* Allocate memory and initialize a new variable */ +/* Allocate memory and initialize a new variable. */ static struct varobj * new_variable (void) { @@ -2154,7 +2155,7 @@ new_variable (void) return var; } -/* Allocate memory and initialize a new root variable */ +/* Allocate memory and initialize a new root variable. */ static struct varobj * new_root_variable (void) { @@ -2172,7 +2173,7 @@ new_root_variable (void) return var; } -/* Free any allocated memory associated with VAR. */ +/* Free any allocated memory associated with VAR. */ static void free_variable (struct varobj *var) { @@ -2190,7 +2191,7 @@ free_variable (struct varobj *var) value_free (var->value); - /* Free the expression if this is a root variable. */ + /* Free the expression if this is a root variable. */ if (is_root_p (var)) { xfree (var->root->exp); @@ -2216,11 +2217,11 @@ make_cleanup_free_variable (struct varobj *var) return make_cleanup (do_free_variable_cleanup, var); } -/* This returns the type of the variable. It also skips past typedefs +/* This returns the type of the variable. It also skips past typedefs to return the real type of the variable. NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file - except within get_target_type and get_type. */ + except within get_target_type and get_type. */ static struct type * get_type (struct varobj *var) { @@ -2235,7 +2236,7 @@ get_type (struct varobj *var) /* Return the type of the value that's stored in VAR, or that would have being stored there if the - value were accessible. + value were accessible. This differs from VAR->type in that VAR->type is always the true type of the expession in the source language. @@ -2268,7 +2269,7 @@ get_value_type (struct varobj *var) past typedefs, just like get_type (). NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file - except within get_target_type and get_type. */ + except within get_target_type and get_type. */ static struct type * get_target_type (struct type *type) { @@ -2283,14 +2284,14 @@ get_target_type (struct type *type) } /* What is the default display for this variable? We assume that - everything is "natural". Any exceptions? */ + everything is "natural". Any exceptions? */ static enum varobj_display_formats variable_default_display (struct varobj *var) { return FORMAT_NATURAL; } -/* FIXME: The following should be generic for any pointer */ +/* FIXME: The following should be generic for any pointer. */ static void cppush (struct cpstack **pstack, char *name) { @@ -2302,7 +2303,7 @@ cppush (struct cpstack **pstack, char *name) *pstack = s; } -/* FIXME: The following should be generic for any pointer */ +/* FIXME: The following should be generic for any pointer. */ static char * cppop (struct cpstack **pstack) { @@ -2326,7 +2327,7 @@ cppop (struct cpstack **pstack) /* Common entry points */ -/* Get the language of variable VAR. */ +/* Get the language of variable VAR. */ static enum varobj_languages variable_language (struct varobj *var) { @@ -2351,9 +2352,9 @@ variable_language (struct varobj *var) /* Return the number of children for a given variable. The result of this function is defined by the language - implementation. The number of children returned by this function + implementation. The number of children returned by this function is the number of children that the user will see in the variable - display. */ + display. */ static int number_of_children (struct varobj *var) { @@ -2361,7 +2362,7 @@ number_of_children (struct varobj *var) } /* What is the expression for the root varobj VAR? Returns a malloc'd - string. */ + string. */ static char * name_of_variable (struct varobj *var) { @@ -2369,7 +2370,7 @@ name_of_variable (struct varobj *var) } /* What is the name of the INDEX'th child of VAR? Returns a malloc'd - string. */ + string. */ static char * name_of_child (struct varobj *var, int index) { @@ -2396,7 +2397,7 @@ value_of_root (struct varobj **var_handle, int *type_changed) var = *var_handle; /* This should really be an exception, since this should - only get called with a root variable. */ + only get called with a root variable. */ if (!is_root_p (var)) return NULL; @@ -2453,7 +2454,7 @@ value_of_root (struct varobj **var_handle, int *type_changed) return (*var->root->lang->value_of_root) (var_handle); } -/* What is the ``struct value *'' for the INDEX'th child of PARENT? */ +/* What is the ``struct value *'' for the INDEX'th child of PARENT? */ static struct value * value_of_child (struct varobj *parent, int index) { @@ -2464,7 +2465,7 @@ value_of_child (struct varobj *parent, int index) return value; } -/* GDB already has a command called "value_of_variable". Sigh. */ +/* GDB already has a command called "value_of_variable". Sigh. */ static char * my_value_of_variable (struct varobj *var, enum varobj_display_formats format) { @@ -2668,12 +2669,12 @@ varobj_floating_p (struct varobj *var) for getting children of the variable object. This includes dereferencing top-level references to all types and dereferencing pointers to - structures. + structures. - Both TYPE and *TYPE should be non-null. VALUE + Both TYPE and *TYPE should be non-null. VALUE can be null if we want to only translate type. *VALUE can be null as well -- if the parent - value is not known. + value is not known. If WAS_PTR is not NULL, set *WAS_PTR to 0 or 1 depending on whether pointer was dereferenced @@ -2752,14 +2753,14 @@ c_number_of_children (struct varobj *var) break; case TYPE_CODE_PTR: - /* The type here is a pointer to non-struct. Typically, pointers + /* The type here is a pointer to non-struct. Typically, pointers have one child, except for function ptrs, which have no children, and except for void*, as we don't know what to show. We can show char* so we allow it to be dereferenced. If you decide to test for it, please mind that a little magic is necessary to properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and - TYPE_NAME == "char" */ + TYPE_NAME == "char". */ if (TYPE_CODE (target) == TYPE_CODE_FUNC || TYPE_CODE (target) == TYPE_CODE_VOID) children = 0; @@ -2768,7 +2769,7 @@ c_number_of_children (struct varobj *var) break; default: - /* Other types have no children */ + /* Other types have no children. */ break; } @@ -2783,7 +2784,7 @@ c_name_of_variable (struct varobj *parent) /* Return the value of element TYPE_INDEX of a structure value VALUE. VALUE's type should be a structure, - or union, or a typedef to struct/union. + or union, or a typedef to struct/union. Returns NULL if getting the value fails. Never throws. */ static struct value * @@ -2816,7 +2817,7 @@ value_struct_element_index (struct value *value, int type_index) } /* Obtain the information about child INDEX of the variable - object PARENT. + object PARENT. If CNAME is not null, sets *CNAME to the name of the child relative to the parent. If CVALUE is not null, sets *CVALUE to the value of the child. @@ -2925,12 +2926,12 @@ c_describe_child (struct varobj *parent, int index, break; default: - /* This should not happen */ + /* This should not happen. */ if (cname) *cname = xstrdup ("???"); if (cfull_expression) *cfull_expression = xstrdup ("???"); - /* Don't set value and type, we don't know then. */ + /* Don't set value and type, we don't know then. */ } } @@ -2983,14 +2984,14 @@ c_value_of_root (struct varobj **var_handle) int within_scope = 0; struct cleanup *back_to; - /* Only root variables can be updated... */ + /* Only root variables can be updated... */ if (!is_root_p (var)) - /* Not a root var */ + /* Not a root var. */ return NULL; back_to = make_cleanup_restore_current_thread (); - /* Determine whether the variable is still around. */ + /* Determine whether the variable is still around. */ if (var->root->valid_block == NULL || var->root->floating) within_scope = 1; else if (var->root->thread_id == 0) @@ -3055,7 +3056,7 @@ c_value_of_variable (struct varobj *var, enum varobj_display_formats format) if (var->pretty_printer && var->print_value) return xstrdup (var->print_value); - /* Strip top-level references. */ + /* Strip top-level references. */ while (TYPE_CODE (type) == TYPE_CODE_REF) type = check_typedef (TYPE_TARGET_TYPE (type)); @@ -3080,8 +3081,8 @@ c_value_of_variable (struct varobj *var, enum varobj_display_formats format) if (var->value == NULL) { /* This can happen if we attempt to get the value of a struct - member when the parent is an invalid pointer. This is an - error condition, so we should tell the caller. */ + member when the parent is an invalid pointer. This is an + error condition, so we should tell the caller. */ return NULL; } else @@ -3096,7 +3097,7 @@ c_value_of_variable (struct varobj *var, enum varobj_display_formats format) gdb_assert (!value_lazy (var->value)); /* If the specified format is the current one, - we can reuse print_value */ + we can reuse print_value. */ if (format == var->format) return xstrdup (var->print_value); else @@ -3136,11 +3137,11 @@ cplus_number_of_children (struct varobj *var) if (kids[v_protected] != 0) children++; - /* Add any baseclasses */ + /* Add any baseclasses. */ children += TYPE_N_BASECLASSES (type); dont_know = 0; - /* FIXME: save children in var */ + /* FIXME: save children in var. */ } } else @@ -3168,7 +3169,7 @@ cplus_number_of_children (struct varobj *var) /* Compute # of public, private, and protected variables in this class. That means we need to descend into all baseclasses and find out - how many are there, too. */ + how many are there, too. */ static void cplus_class_num_children (struct type *type, int children[3]) { @@ -3270,7 +3271,7 @@ cplus_describe_child (struct varobj *parent, int index, particular access control type ("public","protected", or "private"). We must skip over fields that don't have the access control we are looking for to properly - find the indexed field. */ + find the indexed field. */ int type_index = TYPE_N_BASECLASSES (type); enum accessibility acc = public_field; int vptr_fieldno; @@ -3326,7 +3327,7 @@ cplus_describe_child (struct varobj *parent, int index, { char *ptr = was_ptr ? "*" : ""; - /* Cast the parent to the base' type. Note that in gdb, + /* Cast the parent to the base' type. Note that in gdb, expression like (Base1)d will create an lvalue, for all appearences, so we don't @@ -3351,7 +3352,7 @@ cplus_describe_child (struct varobj *parent, int index, only be "public", "private", or "protected" The special "fake" children are always output by varobj in - this order. So if INDEX == 2, it MUST be "protected". */ + this order. So if INDEX == 2, it MUST be "protected". */ index -= TYPE_N_BASECLASSES (type); switch (index) { @@ -3375,11 +3376,11 @@ cplus_describe_child (struct varobj *parent, int index, access = "protected"; break; case 2: - /* Must be protected */ + /* Must be protected. */ access = "protected"; break; default: - /* error! */ + /* error! */ break; } @@ -3443,7 +3444,7 @@ cplus_value_of_variable (struct varobj *var, { /* If we have one of our special types, don't print out - any value. */ + any value. */ if (CPLUS_FAKE_CHILD (var)) return xstrdup (""); @@ -3465,7 +3466,7 @@ java_name_of_variable (struct varobj *parent) name = cplus_name_of_variable (parent); /* If the name has "-" in it, it is because we - needed to escape periods in the name... */ + needed to escape periods in the name... */ p = name; while (*p != '\000') @@ -3484,7 +3485,7 @@ java_name_of_child (struct varobj *parent, int index) char *name, *p; name = cplus_name_of_child (parent, index); - /* Escape any periods in the name... */ + /* Escape any periods in the name... */ p = name; while (*p != '\000') diff --git a/gdb/varobj.h b/gdb/varobj.h index 9ebb0e25a88..81ba05eb7ad 100644 --- a/gdb/varobj.h +++ b/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. diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index d9ab6e466cd..b84977a5d1e 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -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) diff --git a/gdb/vec.c b/gdb/vec.c index 418d377c22a..a61d52a9055 100644 --- a/gdb/vec.c +++ b/gdb/vec.c @@ -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) diff --git a/gdb/vec.h b/gdb/vec.h index 4bf2f47578f..2c383df7d87 100644 --- a/gdb/vec.h +++ b/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)); \ \ diff --git a/gdb/version.h b/gdb/version.h index d0e330276d0..6c292283133 100644 --- a/gdb/version.h +++ b/gdb/version.h @@ -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 */ diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 6fee3725817..86f92423bbd 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -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//exe */ + /* Try to find exe name as symlink target of /proc//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, "\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, "\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; } } diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index ab0aaf9e927..31ddd142f7b 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -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, "\">"); } @@ -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 diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index f80a94e85c4..a794f61643f 100644 --- a/gdb/xcoffread.c +++ b/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; diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c index 601d89ffb35..0915439e3a5 100644 --- a/gdb/xcoffsolib.c +++ b/gdb/xcoffsolib.c @@ -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) diff --git a/gdb/xml-support.c b/gdb/xml-support.c index 9a8ca8b8b64..140d0d9d877 100644 --- a/gdb/xml-support.c +++ b/gdb/xml-support.c @@ -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; diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 94a50f30418..1aef08a8eee 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -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) diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 93226fe18b3..c3ed28327b4 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -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, diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h index 75e93b1d840..be37808b6fd 100644 --- a/gdb/xtensa-tdep.h +++ b/gdb/xtensa-tdep.h @@ -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 . */ 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},