This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb: Move declarations from symtab.h to source.h


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=583068ca1d855abd09ac979c688f48b0ddaabe0f

commit 583068ca1d855abd09ac979c688f48b0ddaabe0f
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Mon Jan 7 09:16:16 2019 +0000

    gdb: Move declarations from symtab.h to source.h
    
    Declarations for functions in source.c are split between source.h and
    symtab.h.  This commit moves the small number that are in symtab.h
    into source.h.  There's just one file that needs to add an include of
    source.h in order to build.
    
    I've moved the function header comments from source.c to source.h
    inline with the recommended GDB style.
    
    gdb/ChangeLog:
    
    	* source.c (select_source_symtab): Move header comment to
    	declaration in source.h.
    	(forget_cached_source_info_for_objfile): Likewise.
    	(forget_cached_source_info): Likewise.
    	(identify_source_line): Likewise.
    	* source.h (identify_source_line): Move declaration from symtab.h
    	and add comment from source.c
    	(print_source_lines): Likewise.
    	(forget_cached_source_info_for_objfile): Likewise.
    	(forget_cached_source_info): Likewise.
    	(select_source_symtab): Likewise.
    	(enum print_source_lines_flag): Move definition from symtab.h.
    	* symtab.h (identify_source_line): Move declaration to source.h.
    	(print_source_lines): Likewise.
    	(forget_cached_source_info_for_objfile): Likewise.
    	(forget_cached_source_info): Likewise.
    	(select_source_symtab): Likewise.
    	(enum print_source_lines_flag): Move definition to source.h.
    	* tui/tui-hooks.c: Add 'source.h' include.

Diff:
---
 gdb/ChangeLog       | 22 ++++++++++++++++++++++
 gdb/source.c        | 30 ++++++------------------------
 gdb/source.h        | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/symtab.h        | 24 ------------------------
 gdb/tui/tui-hooks.c |  1 +
 5 files changed, 77 insertions(+), 48 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2ee19f3..71345ac 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,27 @@
 2019-01-08  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* source.c (select_source_symtab): Move header comment to
+	declaration in source.h.
+	(forget_cached_source_info_for_objfile): Likewise.
+	(forget_cached_source_info): Likewise.
+	(identify_source_line): Likewise.
+	* source.h (identify_source_line): Move declaration from symtab.h
+	and add comment from source.c
+	(print_source_lines): Likewise.
+	(forget_cached_source_info_for_objfile): Likewise.
+	(forget_cached_source_info): Likewise.
+	(select_source_symtab): Likewise.
+	(enum print_source_lines_flag): Move definition from symtab.h.
+	* symtab.h (identify_source_line): Move declaration to source.h.
+	(print_source_lines): Likewise.
+	(forget_cached_source_info_for_objfile): Likewise.
+	(forget_cached_source_info): Likewise.
+	(select_source_symtab): Likewise.
+	(enum print_source_lines_flag): Move definition to source.h.
+	* tui/tui-hooks.c: Add 'source.h' include.
+
+2019-01-08  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* source.c (print_source_lines_base): Handle requests to print
 	reverse line number sequences, and guard against empty lines
 	string.
diff --git a/gdb/source.c b/gdb/source.c
index 71da396..f865c8a 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -233,13 +233,7 @@ clear_current_source_symtab_and_line (void)
   current_source_line = 0;
 }
 
-/* Set the source file default for the "list" command to be S.
-
-   If S is NULL, and we don't have a default, find one.  This
-   should only be called when the user actually tries to use the
-   default, since we produce an error if we can't find a reasonable
-   default.  Also, since this can cause symbols to be read, doing it
-   before we need to would make things slower than necessary.  */
+/* See source.h.  */
 
 void
 select_source_symtab (struct symtab *s)
@@ -351,8 +345,7 @@ show_directories_command (struct ui_file *file, int from_tty,
   show_directories_1 (NULL, from_tty);
 }
 
-/* Forget line positions and file names for the symtabs in a
-   particular objfile.  */
+/* See source.h.  */
 
 void
 forget_cached_source_info_for_objfile (struct objfile *objfile)
@@ -378,9 +371,7 @@ forget_cached_source_info_for_objfile (struct objfile *objfile)
     objfile->sf->qf->forget_cached_source_info (objfile);
 }
 
-/* Forget what we learned about line positions in source files, and
-   which directories contain them; must check again now since files
-   may be found in a different directory now.  */
+/* See source.h.  */
 
 void
 forget_cached_source_info (void)
@@ -1226,14 +1217,7 @@ get_filename_and_charpos (struct symtab *s, char **fullname)
     find_source_lines (s, desc.get ());
 }
 
-/* Print text describing the full name of the source file S
-   and the line number LINE and its corresponding character position.
-   The text starts with two Ctrl-z so that the Emacs-GDB interface
-   can easily find it.
-
-   MID_STATEMENT is nonzero if the PC is not at the beginning of that line.
-
-   Return 1 if successful, 0 if could not find the file.  */
+/* See source.h.  */
 
 int
 identify_source_line (struct symtab *s, int line, int mid_statement,
@@ -1406,10 +1390,8 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
     uiout->text ("\n");
 }
 
-/* Show source lines from the file of symtab S, starting with line
-   number LINE and stopping before line number STOPLINE.  If this is
-   not the command line version, then the source is shown in the source
-   window otherwise it is simply printed.  */
+
+/* See source.h.  */
 
 void
 print_source_lines (struct symtab *s, int line, int stopline,
diff --git a/gdb/source.h b/gdb/source.h
index 05148f3..fcd83da 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -127,4 +127,52 @@ extern void clear_current_source_symtab_and_line (void);
 
 /* Add a source path substitution rule.  */
 extern void add_substitute_path_rule (char *, char *);
+
+/* Print text describing the full name of the source file S
+   and the line number LINE and its corresponding character position.
+   The text starts with two Ctrl-z so that the Emacs-GDB interface
+   can easily find it.
+
+   MID_STATEMENT is nonzero if the PC is not at the beginning of that line.
+
+   Return 1 if successful, 0 if could not find the file.  */
+extern int identify_source_line (struct symtab *s, int line,
+				 int mid_statement, CORE_ADDR pc);
+
+/* Flags passed as 4th argument to print_source_lines.  */
+enum print_source_lines_flag
+  {
+    /* Do not print an error message.  */
+    PRINT_SOURCE_LINES_NOERROR = (1 << 0),
+
+    /* Print the filename in front of the source lines.  */
+    PRINT_SOURCE_LINES_FILENAME = (1 << 1)
+  };
+DEF_ENUM_FLAGS_TYPE (enum print_source_lines_flag, print_source_lines_flags);
+
+/* Show source lines from the file of symtab S, starting with line
+   number LINE and stopping before line number STOPLINE.  If this is
+   not the command line version, then the source is shown in the source
+   window otherwise it is simply printed.  */
+extern void print_source_lines (struct symtab *s, int line, int stopline,
+				print_source_lines_flags flags);
+
+/* Forget line positions and file names for the symtabs in a
+   particular objfile.  */
+extern void forget_cached_source_info_for_objfile (struct objfile *);
+
+/* Forget what we learned about line positions in source files, and
+   which directories contain them; must check again now since files
+   may be found in a different directory now.  */
+extern void forget_cached_source_info (void);
+
+/* Set the source file default for the "list" command to be S.
+
+   If S is NULL, and we don't have a default, find one.  This
+   should only be called when the user actually tries to use the
+   default, since we produce an error if we can't find a reasonable
+   default.  Also, since this can cause symbols to be read, doing it
+   before we need to would make things slower than necessary.  */
+extern void select_source_symtab (struct symtab *s);
+
 #endif
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 414d167..c2d8a69 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1882,30 +1882,6 @@ extern void resolve_sal_pc (struct symtab_and_line *);
 
 extern void clear_solib (void);
 
-/* source.c */
-
-extern int identify_source_line (struct symtab *, int, int, CORE_ADDR);
-
-/* Flags passed as 4th argument to print_source_lines.  */
-
-enum print_source_lines_flag
-  {
-    /* Do not print an error message.  */
-    PRINT_SOURCE_LINES_NOERROR = (1 << 0),
-
-    /* Print the filename in front of the source lines.  */
-    PRINT_SOURCE_LINES_FILENAME = (1 << 1)
-  };
-DEF_ENUM_FLAGS_TYPE (enum print_source_lines_flag, print_source_lines_flags);
-
-extern void print_source_lines (struct symtab *, int, int,
-				print_source_lines_flags);
-
-extern void forget_cached_source_info_for_objfile (struct objfile *);
-extern void forget_cached_source_info (void);
-
-extern void select_source_symtab (struct symtab *);
-
 /* The reason we're calling into a completion match list collector
    function.  */
 enum class complete_symbol_mode
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index b8c18a3..98c6fd6 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -33,6 +33,7 @@
 #include "ui-out.h"
 #include "top.h"
 #include "observable.h"
+#include "source.h"
 #include <unistd.h>
 #include <fcntl.h>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]