diff options
author | Tom Tromey <tom@tromey.com> | 2018-10-27 12:23:44 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-11-09 15:47:45 -0700 |
commit | 2179fbc36d23f29a83fb3dfcac0fc7d1fb31b8e8 (patch) | |
tree | 25112de3c1340c90ca19cefb2dbf5ab5877b6a96 /gdb/source.h | |
parent | 9c122c7f9c8260d2cceb1e8f29d69607531f43ba (diff) | |
download | gdb-2179fbc36d23f29a83fb3dfcac0fc7d1fb31b8e8.zip gdb-2179fbc36d23f29a83fb3dfcac0fc7d1fb31b8e8.tar.gz gdb-2179fbc36d23f29a83fb3dfcac0fc7d1fb31b8e8.tar.bz2 |
Return scoped_fd from open_source_file and find_and_open_source
This changes open_source_file and find_and_open_source to return
scoped_fd, then updates the callers as appropriate, including using
scoped_fd::to_file.
Tested by the buildbot.
gdb/ChangeLog
2018-11-09 Tom Tromey <tom@tromey.com>
* common/scoped_fd.h (class scoped_fd): Add move constructor and
move assignment operator.
* psymtab.c (psymtab_to_fullname): Update.
* source.h (open_source_file): Return scoped_fd.
(find_and_open_source): Likewise.
* source.c (open_source_file): Return scoped_fd.
(get_filename_and_charpos): Update.
(print_source_lines_base): Update. Use scoped_fd::to_file.
(forward_search_command): Likewise.
(reverse_search_command): Likewise.
(find_and_open_source): Return scoped_fd.
* tui/tui-source.c (tui_set_source_content): Update. Use
gdb_file_up.
Diffstat (limited to 'gdb/source.h')
-rw-r--r-- | gdb/source.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gdb/source.h b/gdb/source.h index a876950..9152ec0 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -19,6 +19,8 @@ #ifndef SOURCE_H #define SOURCE_H +#include "common/scoped_fd.h" + struct symtab; /* See openp function definition for their description. */ @@ -66,13 +68,13 @@ extern void init_source_path (void); On Failure An invalid file descriptor is returned (the return value is negative). FULLNAME is set to NULL. */ -extern int find_and_open_source (const char *filename, - const char *dirname, - gdb::unique_xmalloc_ptr<char> *fullname); +extern scoped_fd find_and_open_source (const char *filename, + const char *dirname, + gdb::unique_xmalloc_ptr<char> *fullname); /* Open a source file given a symtab S. Returns a file descriptor or negative number for error. */ -extern int open_source_file (struct symtab *s); +extern scoped_fd open_source_file (struct symtab *s); extern gdb::unique_xmalloc_ptr<char> rewrite_source_path (const char *path); |