diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-12-25 08:03:33 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-12-25 08:03:33 +0000 |
commit | f35a17b5424e3d92d168c2a30d85940294c22d9a (patch) | |
tree | d5435641cea99cddd3e3a08eb36289edf2a9ddf5 /gdb/source.c | |
parent | *** empty log message *** (diff) | |
download | binutils-gdb-f35a17b5424e3d92d168c2a30d85940294c22d9a.tar.gz binutils-gdb-f35a17b5424e3d92d168c2a30d85940294c22d9a.tar.bz2 binutils-gdb-f35a17b5424e3d92d168c2a30d85940294c22d9a.zip |
gdb/
* ada-lang.c (is_known_support_routine): New variable fullname. Use
access call to verify the symtab_to_fullname result.
* breakpoint.c (print_breakpoint_location, update_static_tracepoint):
Remove NULL check of symtab_to_fullname result.
* cli/cli-cmds.c (edit_command): Likewise.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
(mi_cmd_file_list_exec_source_files): Likewise.
* python/py-symtab.c (stpy_fullname): Likewise.
* source.c (symtab_to_fullname): Update function comment. Rename
variable r to fd, move it to inner block. Always provide non-NULL
result.
(print_source_lines_base): Remove NULL check of symtab_to_fullname
result.
* stack.c (print_frame): Likewise.
* symtab.c (iterate_over_some_symtabs, find_line_symtab, sources_info):
Likewise.
* tracepoint.c (print_one_static_tracepoint_marker): Likewise.
gdb/doc/
* gdb.texinfo (GDB/MI Data Manipulation) (fullname): Make it always
present.
(GDB/MI File Commands) (-file-list-exec-source-files): Make the
fullname output always present.
gdb/testsuite/
* gdb.mi/mi-fullname-deleted.exp: New file.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/gdb/source.c b/gdb/source.c index c9e6ba1f211..ea39528fea8 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1075,35 +1075,32 @@ open_source_file (struct symtab *s) /* Finds the fullname that a symtab represents. - If this functions finds the fullname, it will save it in s->fullname - and it will also return the value. + This functions finds the fullname and saves it in s->fullname. + It will also return the value. If this function fails to find the file that this symtab represents, - NULL will be returned and s->fullname will be set to NULL. */ + the expected fullname is used. Therefore the files does not have to + exist. */ const char * symtab_to_fullname (struct symtab *s) { - int r; - - if (!s) - return NULL; - /* Use cached copy if we have it. We rely on forget_cached_source_info being called appropriately to handle cases like the file being moved. */ - if (s->fullname) - return s->fullname; - - r = find_and_open_source (s->filename, s->dirname, &s->fullname); - - if (r >= 0) + if (s->fullname == NULL) { - close (r); - return s->fullname; - } + int fd = find_and_open_source (s->filename, s->dirname, &s->fullname); - return NULL; + if (fd >= 0) + close (fd); + else if (s->dirname == NULL) + s->fullname = xstrdup (s->filename); + else + s->fullname = concat (s->dirname, SLASH_STRING, s->filename, NULL); + } + + return s->fullname; } /* Create and initialize the table S->line_charpos that records @@ -1306,8 +1303,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, { const char *fullname = symtab_to_fullname (s); - if (fullname != NULL) - ui_out_field_string (uiout, "fullname", fullname); + ui_out_field_string (uiout, "fullname", fullname); } ui_out_text (uiout, "\n"); } |