diff options
author | Doug Evans <xdje42@gmail.com> | 2014-11-18 08:28:04 -0800 |
---|---|---|
committer | Doug Evans <xdje42@gmail.com> | 2014-11-18 08:28:04 -0800 |
commit | 7bab9b58fd9c05c20cbd56d778ffa05d9fe3af3e (patch) | |
tree | feb1ac05b6e4d620ec3e02788f9b1ebf1248875c /gdb/sparc64-nat.c | |
parent | f194fefb5e345e8c3b55de1d957bc6d7b95667ad (diff) | |
download | gdb-7bab9b58fd9c05c20cbd56d778ffa05d9fe3af3e.zip gdb-7bab9b58fd9c05c20cbd56d778ffa05d9fe3af3e.tar.gz gdb-7bab9b58fd9c05c20cbd56d778ffa05d9fe3af3e.tar.bz2 |
Split up end_symtab_from_static_block into two.
This patch is conceptually quite simple.
If you look at end_symtab_from_static_block you'll see
that the static_block == NULL case is completely different
than the non-NULL case.
There's a lot of complexity to handle the NULL case but it seems
entirely unnecessary. For example, whether blockvector is NULL
is decided at the start, before this for loop:
for (subfile = subfiles; subfile; subfile = nextsub)
Secondly, after the for loop, we test symtab for non-NULL here:
/* Set this for the main source file. */
if (symtab)
but symtab will only ever be non-NULL if blockvector was non-NULL.
And if blockvector was non_NULL so will symtab.
The other case to consider is these lines of code executed before
the for loop:
/* Read the line table if it has to be read separately.
This is only used by xcoffread.c. */
if (objfile->sf->sym_read_linetable != NULL)
objfile->sf->sym_read_linetable (objfile);
/* Handle the case where the debug info specifies a different path
for the main source file. It can cause us to lose track of its
line number information. */
watch_main_source_file_lossage ();
From my reading of the code, neither of these is useful
in the static_block == NULL case.
Thus we can make the code more readable by splitting these two cases up,
which is what this patch does.
gdb/ChangeLog:
* buildsym.c (main_subfile): New static global.
(free_subfiles_list): New function.
(start_symtab): Set main_subfile.
(restart_symtab): Replace init of subfiles, current_subfile with
call to free_subfiles_list.
(watch_main_source_file_lossage): Use main_subfile.
(reset_symtab_globals): Replace init of current_subfile with call
to free_subfiles_list.
(end_symtab_without_blockvector, end_symtab_with_blockvector): New
functions, split out from ...
(end_symtab_from_static_block): ... here. Rewrite to call them.
Diffstat (limited to 'gdb/sparc64-nat.c')
0 files changed, 0 insertions, 0 deletions