* main.c (main): Read the $HOME/.gdbinit file before processing
the argv arguments (e.g. reading symbol files or core files). This allows global parameters to be set, which will apply during the symbol reading. The ./.gdbinit is still read after argv processing. * symtab.c (list_symbols): `i variables' shouldn't show enum values.
This commit is contained in:
parent
bc718e874a
commit
3a16d64066
87
gdb/main.c
87
gdb/main.c
|
@ -412,6 +412,9 @@ main (argc, argv)
|
||||||
/* Number of elements used. */
|
/* Number of elements used. */
|
||||||
int ndir;
|
int ndir;
|
||||||
|
|
||||||
|
struct stat homebuf, cwdbuf;
|
||||||
|
char *homedir, *homeinit;
|
||||||
|
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
/* This needs to happen before the first use of malloc. */
|
/* This needs to happen before the first use of malloc. */
|
||||||
|
@ -653,6 +656,40 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
|
||||||
/* We may get more than one warning, don't double space all of them... */
|
/* We may get more than one warning, don't double space all of them... */
|
||||||
warning_pre_print = "\nwarning: ";
|
warning_pre_print = "\nwarning: ";
|
||||||
|
|
||||||
|
/* Read and execute $HOME/.gdbinit file, if it exists. This is done
|
||||||
|
*before* all the command line arguments are processed; it sets
|
||||||
|
global parameters, which are independent of what file you are
|
||||||
|
debugging or what directory you are in. */
|
||||||
|
homedir = getenv ("HOME");
|
||||||
|
if (homedir)
|
||||||
|
{
|
||||||
|
homeinit = (char *) alloca (strlen (getenv ("HOME")) +
|
||||||
|
strlen (gdbinit) + 10);
|
||||||
|
strcpy (homeinit, getenv ("HOME"));
|
||||||
|
strcat (homeinit, "/");
|
||||||
|
strcat (homeinit, gdbinit);
|
||||||
|
if (!inhibit_gdbinit && access (homeinit, R_OK) == 0)
|
||||||
|
{
|
||||||
|
/* The official language of expressions in $HOME/.gdbinit is C. */
|
||||||
|
set_language (language_c);
|
||||||
|
if (!setjmp (to_top_level))
|
||||||
|
source_command (homeinit, 0);
|
||||||
|
}
|
||||||
|
do_cleanups (ALL_CLEANUPS);
|
||||||
|
|
||||||
|
/* Do stats; no need to do them elsewhere since we'll only
|
||||||
|
need them if homedir is set. Make sure that they are
|
||||||
|
zero in case one of them fails (this guarantees that they
|
||||||
|
won't match if either exists). */
|
||||||
|
|
||||||
|
memset (&homebuf, 0, sizeof (struct stat));
|
||||||
|
memset (&cwdbuf, 0, sizeof (struct stat));
|
||||||
|
|
||||||
|
stat (homeinit, &homebuf);
|
||||||
|
stat (gdbinit, &cwdbuf); /* We'll only need this if
|
||||||
|
homedir was set. */
|
||||||
|
}
|
||||||
|
|
||||||
/* Now perform all the actions indicated by the arguments. */
|
/* Now perform all the actions indicated by the arguments. */
|
||||||
if (cdarg != NULL)
|
if (cdarg != NULL)
|
||||||
{
|
{
|
||||||
|
@ -740,47 +777,15 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
|
||||||
error_pre_print = 0;
|
error_pre_print = 0;
|
||||||
warning_pre_print = "warning: ";
|
warning_pre_print = "warning: ";
|
||||||
|
|
||||||
{
|
/* Read the .gdbinit file in the current directory, *if* it isn't
|
||||||
struct stat homebuf, cwdbuf;
|
the same as the $HOME/.gdbinit file (it should exist, also). */
|
||||||
char *homedir, *homeinit;
|
|
||||||
|
if (!homedir
|
||||||
/* Read init file, if it exists in home directory */
|
|| memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
|
||||||
homedir = getenv ("HOME");
|
if (!inhibit_gdbinit && access (gdbinit, R_OK) == 0)
|
||||||
if (homedir)
|
if (!setjmp (to_top_level))
|
||||||
{
|
source_command (gdbinit, 0);
|
||||||
homeinit = (char *) alloca (strlen (getenv ("HOME")) +
|
do_cleanups (ALL_CLEANUPS);
|
||||||
strlen (gdbinit) + 10);
|
|
||||||
strcpy (homeinit, getenv ("HOME"));
|
|
||||||
strcat (homeinit, "/");
|
|
||||||
strcat (homeinit, gdbinit);
|
|
||||||
if (!inhibit_gdbinit && access (homeinit, R_OK) == 0)
|
|
||||||
if (!setjmp (to_top_level))
|
|
||||||
source_command (homeinit, 0);
|
|
||||||
do_cleanups (ALL_CLEANUPS);
|
|
||||||
|
|
||||||
/* Do stats; no need to do them elsewhere since we'll only
|
|
||||||
need them if homedir is set. Make sure that they are
|
|
||||||
zero in case one of them fails (this guarantees that they
|
|
||||||
won't match if either exists). */
|
|
||||||
|
|
||||||
memset (&homebuf, 0, sizeof (struct stat));
|
|
||||||
memset (&cwdbuf, 0, sizeof (struct stat));
|
|
||||||
|
|
||||||
stat (homeinit, &homebuf);
|
|
||||||
stat (gdbinit, &cwdbuf); /* We'll only need this if
|
|
||||||
homedir was set. */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read the input file in the current directory, *if* it isn't
|
|
||||||
the same file (it should exist, also). */
|
|
||||||
|
|
||||||
if (!homedir
|
|
||||||
|| memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
|
|
||||||
if (!inhibit_gdbinit && access (gdbinit, R_OK) == 0)
|
|
||||||
if (!setjmp (to_top_level))
|
|
||||||
source_command (gdbinit, 0);
|
|
||||||
do_cleanups (ALL_CLEANUPS);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < ncmd; i++)
|
for (i = 0; i < ncmd; i++)
|
||||||
if (!setjmp (to_top_level))
|
if (!setjmp (to_top_level))
|
||||||
|
|
|
@ -2043,7 +2043,8 @@ name_match (name)
|
||||||
#define NAME_MATCH(NAME) name_match(NAME)
|
#define NAME_MATCH(NAME) name_match(NAME)
|
||||||
|
|
||||||
/* List all symbols (if REGEXP is 0) or all symbols matching REGEXP.
|
/* List all symbols (if REGEXP is 0) or all symbols matching REGEXP.
|
||||||
If CLASS is zero, list all symbols except functions and type names.
|
If CLASS is zero, list all symbols except functions, type names, and
|
||||||
|
constants (enums).
|
||||||
If CLASS is 1, list only functions.
|
If CLASS is 1, list only functions.
|
||||||
If CLASS is 2, list only type names.
|
If CLASS is 2, list only type names.
|
||||||
If CLASS is 3, list only method names.
|
If CLASS is 3, list only method names.
|
||||||
|
@ -2221,7 +2222,8 @@ list_symbols (regexp, class, bpt)
|
||||||
sym = BLOCK_SYM (b, j);
|
sym = BLOCK_SYM (b, j);
|
||||||
if ((regexp == 0 || NAME_MATCH (SYMBOL_NAME (sym)))
|
if ((regexp == 0 || NAME_MATCH (SYMBOL_NAME (sym)))
|
||||||
&& ((class == 0 && SYMBOL_CLASS (sym) != LOC_TYPEDEF
|
&& ((class == 0 && SYMBOL_CLASS (sym) != LOC_TYPEDEF
|
||||||
&& SYMBOL_CLASS (sym) != LOC_BLOCK)
|
&& SYMBOL_CLASS (sym) != LOC_BLOCK
|
||||||
|
&& SYMBOL_CLASS (sym) != LOC_CONST)
|
||||||
|| (class == 1 && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
|| (class == 1 && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
|| (class == 2 && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
|| (class == 2 && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||||
|| (class == 3 && SYMBOL_CLASS (sym) == LOC_BLOCK)))
|
|| (class == 3 && SYMBOL_CLASS (sym) == LOC_BLOCK)))
|
||||||
|
|
Loading…
Reference in New Issue