From 1cee9b02f6821921de761a33c7ee7e78b73f85b9 Mon Sep 17 00:00:00 2001
From: Michael Eager <eager@eagercon.com>
Date: Thu, 26 Mar 2015 17:18:02 -0700
Subject: [PATCH 2/2] GDB - Fix leading & trailing whitespace
* corelow.c: Replace leading whitespace with tabs, eliminate trailing blanks.
* exec.c: Ditto.
* symfile.c: Ditto.
* utils.c: Ditto
* utils.h: Ditto
---
gdb/corelow.c | 10 +++++-----
gdb/exec.c | 22 ++++++++++-----------
gdb/symfile.c | 62 +++++++++++++++++++++++++++++------------------------------
gdb/utils.c | 60 ++++++++++++++++++++++++++++-----------------------------
gdb/utils.h | 4 ++--
5 files changed, 79 insertions(+), 79 deletions(-)
@@ -198,7 +198,7 @@ core_close (struct target_ops *self)
exit_inferior_silent (pid);
/* Clear out solib state while the bfd is still open. See
- comments in clear_solib in solib.c. */
+ comments in clear_solib in solib.c. */
clear_solib ();
if (core_data)
@@ -330,8 +330,8 @@ core_open (const char *arg, int from_tty)
{
/* Do it after the err msg */
/* FIXME: should be checking for errors from bfd_close (for one
- thing, on error it does not free all the storage associated
- with the bfd). */
+ thing, on error it does not free all the storage associated
+ with the bfd). */
make_cleanup_bfd_unref (temp_bfd);
error (_("\"%s\" is not a core dump: %s"),
filename, bfd_errmsg (bfd_get_error ()));
@@ -954,7 +954,7 @@ core_read_description (struct target_ops *target)
{
const struct target_desc *result;
- result = gdbarch_core_read_description (core_gdbarch,
+ result = gdbarch_core_read_description (core_gdbarch,
target, core_bfd);
if (result != NULL)
return result;
@@ -1055,7 +1055,7 @@ init_core_ops (void)
core_ops.to_magic = OPS_MAGIC;
if (core_target)
- internal_error (__FILE__, __LINE__,
+ internal_error (__FILE__, __LINE__,
_("init_core_ops: core target already exists (\"%s\")."),
core_target->to_longname);
core_target = &core_ops;
@@ -1,4 +1,4 @@
-/* Work with executable files, for GDB.
+/* Work with executable files, for GDB.
Copyright (C) 1988-2015 Free Software Foundation, Inc.
@@ -171,7 +171,7 @@ exec_file_attach (const char *filename, int from_tty)
if (!filename)
{
if (from_tty)
- printf_unfiltered (_("No executable file now.\n"));
+ printf_unfiltered (_("No executable file now.\n"));
set_gdbarch_from_file (NULL);
}
@@ -283,7 +283,7 @@ exec_file_attach (const char *filename, int from_tty)
Note that we have to explicitly ignore additional args, since we can
be called from file_command(), which also calls symbol_file_command()
which can take multiple args.
-
+
If ARGS is NULL, we just want to close the exec file. */
static void
@@ -302,16 +302,16 @@ exec_file_command (char *args, int from_tty)
struct cleanup *cleanups;
/* Scan through the args and pick up the first non option arg
- as the filename. */
+ as the filename. */
argv = gdb_buildargv (args);
cleanups = make_cleanup_freeargv (argv);
for (; (*argv != NULL) && (**argv == '-'); argv++)
- {;
- }
+ {;
+ }
if (*argv == NULL)
- error (_("No executable file name was specified"));
+ error (_("No executable file name was specified"));
filename = tilde_expand (*argv);
make_cleanup (xfree, filename);
@@ -716,7 +716,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
if (section_name && strcmp (section_name, asect->name) != 0)
continue; /* not the section we need. */
if (memaddr >= p->addr)
- {
+ {
if (memend <= p->endaddr)
{
/* Entire transfer is within this section. */
@@ -762,7 +762,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
else
return TARGET_XFER_EOF;
}
- }
+ }
}
return TARGET_XFER_EOF; /* We can't help. */
@@ -832,8 +832,8 @@ print_section_info (struct target_section_table *t, bfd *abfd)
warning (_("Cannot find section for the entry point of %s."),
bfd_get_filename (abfd));
- entry_point = gdbarch_addr_bits_remove (gdbarch,
- bfd_get_start_address (abfd)
+ entry_point = gdbarch_addr_bits_remove (gdbarch,
+ bfd_get_start_address (abfd)
+ displacement);
printf_filtered (_("\tEntry point: %s\n"),
paddress (gdbarch, entry_point));
@@ -265,7 +265,7 @@ alloc_section_addr_info (size_t num_sections)
extern struct section_addr_info *
build_section_addr_info_from_section_table (const struct target_section *start,
- const struct target_section *end)
+ const struct target_section *end)
{
struct section_addr_info *sap;
const struct target_section *stp;
@@ -507,7 +507,7 @@ relative_addr_info_to_section_offsets (struct section_offsets *section_offsets,
/* Record all sections in offsets. */
/* The section_offsets in the objfile are here filled in using
- the BFD index. */
+ the BFD index. */
section_offsets->offsets[osp->sectindex] = osp->addr;
}
}
@@ -918,7 +918,7 @@ init_entry_point_info (struct objfile *objfile)
if (bfd_get_file_flags (objfile->obfd) & EXEC_P)
{
/* Executable file -- record its entry point so we'll recognize
- the startup file because it contains the entry point. */
+ the startup file because it contains the entry point. */
ei->entry_point = bfd_get_start_address (objfile->obfd);
ei->entry_point_p = 1;
}
@@ -1017,7 +1017,7 @@ syms_from_objfile_1 (struct objfile *objfile,
objfile->num_sections = num_sections;
objfile->section_offsets
- = obstack_alloc (&objfile->objfile_obstack, size);
+ = obstack_alloc (&objfile->objfile_obstack, size);
memset (objfile->section_offsets, 0, size);
return;
}
@@ -1039,7 +1039,7 @@ syms_from_objfile_1 (struct objfile *objfile,
if (mainline)
{
/* We will modify the main symbol table, make sure that all its users
- will be cleaned up if an error occurs during symbol reading. */
+ will be cleaned up if an error occurs during symbol reading. */
make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/);
/* Since no error yet, throw away the old symbol table. */
@@ -1051,9 +1051,9 @@ syms_from_objfile_1 (struct objfile *objfile,
}
/* Currently we keep symbols from the add-symbol-file command.
- If the user wants to get rid of them, they should do "symbol-file"
- without arguments first. Not sure this is the best behavior
- (PR 2207). */
+ If the user wants to get rid of them, they should do "symbol-file"
+ without arguments first. Not sure this is the best behavior
+ (PR 2207). */
(*objfile->sf->sym_new_init) (objfile);
}
@@ -1279,8 +1279,8 @@ symbol_file_add_separate (bfd *bfd, const char *name, int symfile_flags,
struct objfile *
symbol_file_add_from_bfd (bfd *abfd, const char *name, int add_flags,
- struct section_addr_info *addrs,
- int flags, struct objfile *parent)
+ struct section_addr_info *addrs,
+ int flags, struct objfile *parent)
{
return symbol_file_add_with_addrs (abfd, name, add_flags, addrs, flags,
parent);
@@ -2137,9 +2137,9 @@ generic_load (const char *args, int from_tty)
cbdata.load_offset = strtoulst (argv[1], &endptr, 0);
/* If the last word was not a valid number then
- treat it as a file name with spaces in. */
+ treat it as a file name with spaces in. */
if (argv[1] == endptr)
- error (_("Invalid download offset:%s."), argv[1]);
+ error (_("Invalid download offset:%s."), argv[1]);
if (argv[2] != NULL)
error (_("Too many parameters."));
@@ -2392,7 +2392,7 @@ add_symbol_file_command (char *args, int from_tty)
addr = parse_and_eval_address (val);
/* Here we store the section offsets in the order they were
- entered on the command line. */
+ entered on the command line. */
section_addrs->other[sec_num].name = sec;
section_addrs->other[sec_num].addr = addr;
printf_unfiltered ("\t%s_addr = %s\n", sec,
@@ -2751,7 +2751,7 @@ reread_symbols (void)
observer_notify_new_objfile (objfile);
/* At least one objfile has changed, so we can consider that
- the executable we're debugging has changed too. */
+ the executable we're debugging has changed too. */
observer_notify_executable_changed ();
}
@@ -3181,7 +3181,7 @@ section_is_mapped (struct obj_section *osect)
return 0; /* overlay debugging off */
case ovly_auto: /* overlay debugging automatic */
/* Unles there is a gdbarch_overlay_update function,
- there's really nothing useful to do here (can't really go auto). */
+ there's really nothing useful to do here (can't really go auto). */
gdbarch = get_objfile_arch (osect->objfile);
if (gdbarch_overlay_update_p (gdbarch))
{
@@ -3434,7 +3434,7 @@ map_overlay_command (char *args, int from_tty)
sec->ovly_mapped = 1;
/* Next, make a pass and unmap any sections that are
- overlapped by this new section: */
+ overlapped by this new section: */
ALL_OBJSECTIONS (objfile2, sec2)
if (sec2->ovly_mapped && sec != sec2 && sections_overlap (sec, sec2))
{
@@ -3630,8 +3630,8 @@ simple_read_overlay_table (void)
if (! novlys_msym.minsym)
{
error (_("Error reading inferior's overlay table: "
- "couldn't find `_novlys' variable\n"
- "in inferior. Use `overlay manual' mode."));
+ "couldn't find `_novlys' variable\n"
+ "in inferior. Use `overlay manual' mode."));
return 0;
}
@@ -3639,8 +3639,8 @@ simple_read_overlay_table (void)
if (! ovly_table_msym.minsym)
{
error (_("Error reading inferior's overlay table: couldn't find "
- "`_ovly_table' array\n"
- "in inferior. Use `overlay manual' mode."));
+ "`_ovly_table' array\n"
+ "in inferior. Use `overlay manual' mode."));
return 0;
}
@@ -3654,8 +3654,8 @@ simple_read_overlay_table (void)
= (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
cache_ovly_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_table_msym);
read_target_long_array (cache_ovly_table_base,
- (unsigned int *) cache_ovly_table,
- cache_novlys * 4, word_size, byte_order);
+ (unsigned int *) cache_ovly_table,
+ cache_novlys * 4, word_size, byte_order);
return 1; /* SUCCESS */
}
@@ -3779,7 +3779,7 @@ symfile_dummy_outputs (bfd *abfd, asection *sectp, void *dummy)
bfd_byte *
default_symfile_relocate (struct objfile *objfile, asection *sectp,
- bfd_byte *buf)
+ bfd_byte *buf)
{
/* Use sectp->owner instead of objfile->obfd. sectp may point to a
DWO file. */
@@ -3813,7 +3813,7 @@ default_symfile_relocate (struct objfile *objfile, asection *sectp,
bfd_byte *
symfile_relocate_debug_section (struct objfile *objfile,
- asection *sectp, bfd_byte *buf)
+ asection *sectp, bfd_byte *buf)
{
gdb_assert (objfile->sf->sym_relocate);
@@ -3881,17 +3881,17 @@ symfile_map_offsets_to_segments (bfd *abfd,
gdb_assert (0 <= which && which <= data->num_segments);
/* Don't bother computing offsets for sections that aren't
- loaded as part of any segment. */
+ loaded as part of any segment. */
if (! which)
- continue;
+ continue;
/* Use the last SEGMENT_BASES entry as the address of any extra
- segments mentioned in DATA->segment_info. */
+ segments mentioned in DATA->segment_info. */
if (which > num_segment_bases)
- which = num_segment_bases;
+ which = num_segment_bases;
offsets->offsets[i] = (segment_bases[which - 1]
- - data->segment_bases[which - 1]);
+ - data->segment_bases[which - 1]);
}
return 1;
@@ -4087,9 +4087,9 @@ Set printing of symbol loading messages."), _("\
Show printing of symbol loading messages."), _("\
off == turn all messages off\n\
brief == print messages for the executable,\n\
- and brief messages for shared libraries\n\
+ and brief messages for shared libraries\n\
full == print messages for the executable,\n\
- and messages for each shared library."),
+ and messages for each shared library."),
NULL,
NULL,
&setprintlist, &showprintlist);
@@ -696,13 +696,13 @@ internal_vproblem (struct internal_problem *problem,
abort_with_message (msg);
default:
dejavu = 3;
- /* Newer GLIBC versions put the warn_unused_result attribute
- on write, but this is one of those rare cases where
- ignoring the return value is correct. Casting to (void)
- does not fix this problem. This is the solution suggested
- at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509. */
+ /* Newer GLIBC versions put the warn_unused_result attribute
+ on write, but this is one of those rare cases where
+ ignoring the return value is correct. Casting to (void)
+ does not fix this problem. This is the solution suggested
+ at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509. */
if (write (STDERR_FILENO, msg, sizeof (msg)) != sizeof (msg))
- abort (); /* NOTE: GDB has only three calls to abort(). */
+ abort (); /* NOTE: GDB has only three calls to abort(). */
exit (1);
}
}
@@ -751,7 +751,7 @@ internal_vproblem (struct internal_problem *problem,
if (!confirm || !filtered_printing_initialized ())
quit_p = 1;
else
- quit_p = query (_("%s\nQuit this debugging session? "), reason);
+ quit_p = query (_("%s\nQuit this debugging session? "), reason);
}
else if (problem->should_quit == internal_problem_yes)
quit_p = 1;
@@ -1058,7 +1058,7 @@ quit (void)
#else
if (job_control
/* If there is no terminal switching for this target, then we can't
- possibly get screwed by the lack of job control. */
+ possibly get screwed by the lack of job control. */
|| !target_supports_terminal_ours ())
throw_quit ("Quit");
else
@@ -1299,15 +1299,15 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
if (answer >= 'a')
answer -= 040;
/* Check answer. For the non-default, the user must specify
- the non-default explicitly. */
+ the non-default explicitly. */
if (answer == not_def_answer)
{
retval = !def_value;
break;
}
/* Otherwise, if a default was specified, the user may either
- specify the required input or have it default by entering
- nothing. */
+ specify the required input or have it default by entering
+ nothing. */
if (answer == def_answer
|| (defchar != '\0' && answer == '\0'))
{
@@ -1323,7 +1323,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
gettimeofday (&prompt_ended, NULL);
timeval_sub (&prompt_delta, &prompt_ended, &prompt_started);
timeval_add (&prompt_for_continue_wait_time,
- &prompt_for_continue_wait_time, &prompt_delta);
+ &prompt_for_continue_wait_time, &prompt_delta);
xfree (prompt);
if (annotation_level > 1)
@@ -1686,8 +1686,8 @@ init_page_info (void)
chars_per_line = cols;
/* Readline should have fetched the termcap entry for us.
- Only try to use tgetnum function if rl_get_screen_size
- did not return a useful value. */
+ Only try to use tgetnum function if rl_get_screen_size
+ did not return a useful value. */
if (((rows <= 0) && (tgetnum ("li") < 0))
/* Also disable paging if inside EMACS. */
|| getenv ("EMACS"))
@@ -1745,7 +1745,7 @@ struct cleanup *
set_batch_flag_and_make_cleanup_restore_page_info (void)
{
struct cleanup *back_to = make_cleanup_restore_page_info ();
-
+
make_cleanup_restore_integer (&batch_flag);
batch_flag = 1;
init_page_info ();
@@ -1826,7 +1826,7 @@ prompt_for_continue (void)
strcat (cont_prompt, "\n\032\032prompt-for-continue\n");
/* We must do this *before* we call gdb_readline, else it will eventually
- call us -- thinking that we're trying to print beyond the end of the
+ call us -- thinking that we're trying to print beyond the end of the
screen. */
reinitialize_more_filter ();
@@ -1852,7 +1852,7 @@ prompt_for_continue (void)
gettimeofday (&prompt_ended, NULL);
timeval_sub (&prompt_delta, &prompt_ended, &prompt_started);
timeval_add (&prompt_for_continue_wait_time,
- &prompt_for_continue_wait_time, &prompt_delta);
+ &prompt_for_continue_wait_time, &prompt_delta);
if (annotation_level > 1)
printf_unfiltered (("\n\032\032post-prompt-for-continue\n"));
@@ -1960,11 +1960,11 @@ wrap_here (char *indent)
}
}
-/* Print input string to gdb_stdout, filtered, with wrap,
+/* Print input string to gdb_stdout, filtered, with wrap,
arranging strings in columns of n chars. String can be
- right or left justified in the column. Never prints
+ right or left justified in the column. Never prints
trailing spaces. String should never be longer than
- width. FIXME: this could be useful for the EXAMINE
+ width. FIXME: this could be useful for the EXAMINE
command, which currently doesn't tabulate very well. */
void
@@ -2075,8 +2075,8 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
else
fputc_unfiltered ('\t', stream);
/* Shifting right by 3 produces the number of tab stops
- we have already passed, and then adding one and
- shifting left 3 advances to the next tab stop. */
+ we have already passed, and then adding one and
+ shifting left 3 advances to the next tab stop. */
chars_printed = ((chars_printed >> 3) + 1) << 3;
lineptr++;
}
@@ -2097,8 +2097,8 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
chars_printed = 0;
lines_printed++;
/* If we aren't actually wrapping, don't output newline --
- if chars_per_line is right, we probably just overflowed
- anyway; if it's wrong, let us keep going. */
+ if chars_per_line is right, we probably just overflowed
+ anyway; if it's wrong, let us keep going. */
if (wrap_column)
fputc_unfiltered ('\n', stream);
@@ -2638,7 +2638,7 @@ strcmp_iw_ordered (const char *string1, const char *string2)
if (case_pass == case_sensitive_on)
return 0;
-
+
/* Otherwise the strings were equal in case insensitive way, make
a more fine grained comparison in a case sensitive way. */
@@ -2918,7 +2918,7 @@ gdb_realpath_keepfile (const char *filename)
char *real_path;
char *result;
- /* Extract the basename of filename, and return immediately
+ /* Extract the basename of filename, and return immediately
a copy of filename if it does not contain any directory prefix. */
if (base_name == filename)
return xstrdup (filename);
@@ -3196,7 +3196,7 @@ gdb_bfd_errmsg (bfd_error_type error_tag, char **matching)
return bfd_errmsg (error_tag);
ret_len = strlen (bfd_errmsg (error_tag)) + strlen (AMBIGUOUS_MESS1)
- + strlen (AMBIGUOUS_MESS2);
+ + strlen (AMBIGUOUS_MESS2);
for (p = matching; *p; p++)
ret_len += strlen (*p) + 1;
ret = xmalloc (ret_len + 1);
@@ -3302,9 +3302,9 @@ producer_is_gcc (const char *producer, int *major, int *minor)
*/
cs = &producer[strlen ("GNU ")];
while (*cs && !isspace (*cs))
- cs++;
+ cs++;
if (*cs && isspace (*cs))
- cs++;
+ cs++;
if (sscanf (cs, "%d.%d", major, minor) == 2)
return 1;
}
@@ -3356,7 +3356,7 @@ substitute_path_component (char **stringp, const char *from, const char *to)
if ((s == string || IS_DIR_SEPARATOR (s[-1])
|| s[-1] == DIRNAME_SEPARATOR)
- && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])
+ && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])
|| s[from_len] == DIRNAME_SEPARATOR))
{
char *string_new;
@@ -77,8 +77,8 @@ extern struct cleanup *
make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);
struct section_addr_info;
-extern struct cleanup *(make_cleanup_free_section_addr_info
- (struct section_addr_info *));
+extern struct cleanup *(make_cleanup_free_section_addr_info
+ (struct section_addr_info *));
extern struct cleanup *make_cleanup_close (int fd);
--
1.8.1.4