diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-07-07 17:19:50 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-07-07 17:19:50 +0000 |
commit | 51cc5b073771099289e43e0d4a15f71fb0515f0b (patch) | |
tree | 8d4feb1344264b42785f9edf0e4c330a9380f427 /gdb/symtab.c | |
parent | c72e73889f2075d648af94c52687d306befd8fbf (diff) | |
download | gdb-51cc5b073771099289e43e0d4a15f71fb0515f0b.zip gdb-51cc5b073771099289e43e0d4a15f71fb0515f0b.tar.gz gdb-51cc5b073771099289e43e0d4a15f71fb0515f0b.tar.bz2 |
* symtab.c (main_name): New function.
(set_main_name): New function.
* symtab.h: Declare.
* TODO: Update
From 2000-03-05 Anthony Green <green@redhat.com>:
* dbxread.c (process_one_symbol): Handle the N_MAIN stab by
setting main_name.
* blockframe.c (inside_main_func): Use main_name instead of
"main".
* symtab.c (find_main_psymtab): Ditto.
* source.c (select_source_symtab): Ditto.
* nlmread.c (nlm_symfile_read): Ditto.
* rs6000-tdep.c (skip_prologue): Ditto.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index a16393e..dcaae52 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1158,7 +1158,7 @@ find_main_psymtab (void) ALL_PSYMTABS (objfile, pst) { - if (lookup_partial_symbol (pst, "main", 1, VAR_NAMESPACE)) + if (lookup_partial_symbol (pst, main_name (), 1, VAR_NAMESPACE)) { return (pst); } @@ -3624,6 +3624,33 @@ decode_line_spec (char *string, int funfirstline) return sals; } +/* Track MAIN */ +static char *name_of_main; + +void +set_main_name (const char *name) +{ + if (name_of_main != NULL) + { + xfree (name_of_main); + name_of_main = NULL; + } + if (name != NULL) + { + name_of_main = xstrdup (name); + } +} + +char * +main_name (void) +{ + if (name_of_main != NULL) + return name_of_main; + else + return "main"; +} + + void _initialize_symtab (void) { |