From patchwork Tue Feb 13 23:39:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 25929 Received: (qmail 35426 invoked by alias); 13 Feb 2018 23:39:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 35300 invoked by uid 89); 13 Feb 2018 23:39:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=33933 X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.160.12) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Feb 2018 23:39:16 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 5E1781544A for ; Tue, 13 Feb 2018 17:39:15 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id lkANeH0S9cGlplkANeFYqo; Tue, 13 Feb 2018 17:39:15 -0600 Received: from 174-29-60-18.hlrn.qwest.net ([174.29.60.18]:52440 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1elkAN-004Amp-3K; Tue, 13 Feb 2018 17:39:15 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 2/4] Move some declarations to source.h Date: Tue, 13 Feb 2018 16:39:05 -0700 Message-Id: <20180213233907.11259-3-tom@tromey.com> In-Reply-To: <20180213233907.11259-1-tom@tromey.com> References: <20180213233907.11259-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1elkAN-004Amp-3K X-Source-Sender: 174-29-60-18.hlrn.qwest.net (bapiya.Home) [174.29.60.18]:52440 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes I noticed a few declarations in defs.h that really could be put into source.h. I think it's generally preferable to something out of defs.h unless it is needed by most of the files in gdb. 2018-02-13 Tom Tromey * solib.c: Include source.h. * nto-tdep.c: Include source.h. * mi/mi-cmd-env.c: Include source.h. * infcmd.c: Include source.h. * exec.c: Include source.h. * defs.h (enum openp_flag, openp, source_full_path_of, mod_path) (add_path, directory_switch, source_path, init_source_path): Move declarations... * source.h (enum openp_flag, openp, source_full_path_of, mod_path) (add_path, directory_switch, source_path, init_source_path): ...here. --- gdb/ChangeLog | 14 ++++++++++++++ gdb/defs.h | 27 --------------------------- gdb/exec.c | 1 + gdb/infcmd.c | 1 + gdb/mi/mi-cmd-env.c | 1 + gdb/nto-tdep.c | 1 + gdb/solib.c | 1 + gdb/source.h | 25 +++++++++++++++++++++++++ 8 files changed, 44 insertions(+), 27 deletions(-) diff --git a/gdb/defs.h b/gdb/defs.h index 70389ad745..c85bf2cf11 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -339,33 +339,6 @@ extern int build_address_symbolic (struct gdbarch *, extern void print_address (struct gdbarch *, CORE_ADDR, struct ui_file *); extern const char *pc_prefix (CORE_ADDR); -/* From source.c */ - -/* See openp function definition for their description. */ - -enum openp_flag -{ - OPF_TRY_CWD_FIRST = 0x01, - OPF_SEARCH_IN_PATH = 0x02, - OPF_RETURN_REALPATH = 0x04, -}; - -DEF_ENUM_FLAGS_TYPE(openp_flag, openp_flags); - -extern int openp (const char *, openp_flags, const char *, int, char **); - -extern int source_full_path_of (const char *, char **); - -extern void mod_path (const char *, char **); - -extern void add_path (const char *, char **, int); - -extern void directory_switch (const char *, int); - -extern char *source_path; - -extern void init_source_path (void); - /* From exec.c */ /* * Process memory area starting at ADDR with length SIZE. Area is diff --git a/gdb/exec.c b/gdb/exec.c index 15f85a278f..79baf9c5fb 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -35,6 +35,7 @@ #include "progspace.h" #include "gdb_bfd.h" #include "gcore.h" +#include "source.h" #include #include "readline/readline.h" diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 3879df3f5a..331fd8751b 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -59,6 +59,7 @@ #include "top.h" #include "interps.h" #include "common/gdb_optional.h" +#include "source.h" /* Local functions: */ diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index e7c41dd7bd..2f5b803d5b 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -31,6 +31,7 @@ #include "ui-out.h" #include "top.h" #include +#include "source.h" static const char path_var_name[] = "PATH"; static char *orig_path = NULL; diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index 03b2d1e96d..30db99c759 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -31,6 +31,7 @@ #include "solib-svr4.h" #include "gdbcore.h" #include "objfiles.h" +#include "source.h" #define QNX_NOTE_NAME "QNX" #define QNX_INFO_SECT_NAME "QNX_info" diff --git a/gdb/solib.c b/gdb/solib.c index 46f2324c48..c732df6150 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -46,6 +46,7 @@ #include "filesystem.h" #include "gdb_bfd.h" #include "filestuff.h" +#include "source.h" /* Architecture-specific operations. */ diff --git a/gdb/source.h b/gdb/source.h index 77fd4cdaba..a21e919b28 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -21,6 +21,31 @@ struct symtab; +/* See openp function definition for their description. */ + +enum openp_flag +{ + OPF_TRY_CWD_FIRST = 0x01, + OPF_SEARCH_IN_PATH = 0x02, + OPF_RETURN_REALPATH = 0x04, +}; + +DEF_ENUM_FLAGS_TYPE(openp_flag, openp_flags); + +extern int openp (const char *, openp_flags, const char *, int, char **); + +extern int source_full_path_of (const char *, char **); + +extern void mod_path (const char *, char **); + +extern void add_path (const char *, char **, int); + +extern void directory_switch (const char *, int); + +extern char *source_path; + +extern void init_source_path (void); + /* This function is capable of finding the absolute path to a source file, and opening it, provided you give it a FILENAME. Both the DIRNAME and FULLNAME are only added suggestions on where to find the file.