aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>1998-05-13 17:19:22 +0000
committerDoug Evans <dje@google.com>1998-05-13 17:19:22 +0000
commit95d33c131a7e78d755ce072d8b1da789e49db877 (patch)
tree48c7e79d1f3504e5afc64d1f749fe097586b1f1f /gas/read.c
parent94dda41a0c12c6d7327c30054809a9e0dd93c66f (diff)
downloadgdb-95d33c131a7e78d755ce072d8b1da789e49db877.zip
gdb-95d33c131a7e78d755ce072d8b1da789e49db877.tar.gz
gdb-95d33c131a7e78d755ce072d8b1da789e49db877.tar.bz2
* read.c (generate_file_debug,generate_lineno_debug): New functions.
(read_a_source_file): Call them. * read.h (stabs_generate_asm_file): Declare. * stabs.c (stabs_generate_asm_file): New function. (generate_asm_file): New function. (stabs_generate_asm_lineno): Move file name handling into generate_asm_file.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c74
1 files changed, 49 insertions, 25 deletions
diff --git a/gas/read.c b/gas/read.c
index 8e06d85..c9e4461 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -217,6 +217,8 @@ static segT get_segmented_expression PARAMS ((expressionS *expP));
static segT get_known_segmented_expression PARAMS ((expressionS * expP));
static void pobegin PARAMS ((void));
static int get_line_sb PARAMS ((sb *));
+static void generate_file_debug PARAMS ((void));
+static void generate_lineno_debug PARAMS ((void));
void
@@ -499,6 +501,11 @@ read_a_source_file (name)
listing_newline (NULL);
register_dependency (name);
+ /* Generate debugging information before we've read anything in to denote
+ this file as the "main" source file and not a subordinate one
+ (e.g. N_SO vs N_SOL in stabs). */
+ generate_file_debug ();
+
while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
{ /* We have another line to parse. */
know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
@@ -825,30 +832,7 @@ read_a_source_file (name)
c = *input_line_pointer;
*input_line_pointer = '\0';
- if (debug_type == DEBUG_STABS)
- stabs_generate_asm_lineno ();
-
-#ifdef OBJ_GENERATE_ASM_LINENO
-#ifdef ECOFF_DEBUGGING
- /* ECOFF assemblers automatically generate
- debugging information. FIXME: This should
- probably be handled elsewhere. */
- if (debug_type == DEBUG_NONE)
- {
- if (ecoff_no_current_file ())
- debug_type = DEBUG_ECOFF;
- }
-
- if (debug_type == DEBUG_ECOFF)
- {
- unsigned int lineno;
- char *s;
-
- as_where (&s, &lineno);
- OBJ_GENERATE_ASM_LINENO (s, lineno);
- }
-#endif
-#endif
+ generate_lineno_debug ();
if (macro_defined)
{
@@ -4117,7 +4101,7 @@ sizeof_uleb128 (value)
return size;
}
-inline int
+int
sizeof_leb128 (value, sign)
valueT value;
int sign;
@@ -4882,6 +4866,46 @@ add_include_dir (path)
include_dir_maxlen = i;
} /* add_include_dir() */
+/* Output debugging information to denote the source file. */
+
+static void
+generate_file_debug ()
+{
+ if (debug_type == DEBUG_STABS)
+ stabs_generate_asm_file ();
+}
+
+/* Output line number debugging information for the current source line. */
+
+static void
+generate_lineno_debug ()
+{
+ if (debug_type == DEBUG_STABS)
+ stabs_generate_asm_lineno ();
+
+#ifdef OBJ_GENERATE_ASM_LINENO
+#ifdef ECOFF_DEBUGGING
+ /* ECOFF assemblers automatically generate
+ debugging information. FIXME: This should
+ probably be handled elsewhere. */
+ if (debug_type == DEBUG_NONE)
+ {
+ if (ecoff_no_current_file ())
+ debug_type = DEBUG_ECOFF;
+ }
+
+ if (debug_type == DEBUG_ECOFF)
+ {
+ unsigned int lineno;
+ char *s;
+
+ as_where (&s, &lineno);
+ OBJ_GENERATE_ASM_LINENO (s, lineno);
+ }
+#endif
+#endif
+}
+
void
s_ignore (arg)
int arg;