Create a typedef for record_line: record_line_ftype.
authorDoug Evans <dje@google.com>
Fri, 22 Aug 2014 23:20:05 +0000 (16:20 -0700)
committerDoug Evans <dje@google.com>
Fri, 22 Aug 2014 23:20:05 +0000 (16:20 -0700)
gdb/ChangeLog:

* buildsym.h (record_line_ftype): New typedef.
(record_line): Use it.
* dwarf2read.c (dwarf_record_line, dwarf_finish_line): New functions.
(dwarf_decode_lines_1): Call them.

gdb/ChangeLog
gdb/buildsym.h
gdb/dwarf2read.c

index a34ad780ca394e1d254aa09c0b8743a6513456dd..2ebc1e8fdcfc9ecb9c616f2297fc2d7c6a5f202e 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-22  Doug Evans  <dje@google.com>
+
+       * buildsym.h (record_line_ftype): New typedef.
+       (record_line): Use it.
+       * dwarf2read.c (dwarf_record_line, dwarf_finish_line): New functions.
+       (dwarf_decode_lines_1): Call them.
+
 2014-08-22  Yao Qi  <yao@codesourcery.com>
 
        * ctf.c (CTF_FILE_MIN_SIZE): Remove.
index 57467c7ed463d3d4d4d727ca036760b6ecad72af..8ce01b2b1971728a56afd7f041de6b1681bbaf7a 100644 (file)
@@ -171,6 +171,10 @@ EXTERN int context_stack_size;
 
 EXTERN int within_function;
 
+/* The type of the record_line function.  */
+typedef void (record_line_ftype) (struct subfile *subfile, int line,
+                                 CORE_ADDR pc);
+
 \f
 
 #define next_symbol_text(objfile) (*next_symbol_text_func)(objfile)
@@ -236,7 +240,7 @@ extern struct context_stack *push_context (int desc, CORE_ADDR valu);
 
 extern struct context_stack *pop_context (void);
 
-extern void record_line (struct subfile *subfile, int line, CORE_ADDR pc);
+extern record_line_ftype record_line;
 
 extern void start_symtab (const char *name, const char *dirname,
                          CORE_ADDR start_addr);
index 157d7fb32344ee2c5c2a35d3681018f51ff3f251..57a2e65246132cf8ce37143d5212ef9c8abae4fc 100644 (file)
@@ -17174,6 +17174,32 @@ noop_record_line (struct subfile *subfile, int line, CORE_ADDR pc)
   return;
 }
 
+/* Use P_RECORD_LINE to record line number LINE beginning at address ADDRESS
+   in the line table of subfile SUBFILE.  */
+
+static void
+dwarf_record_line (struct gdbarch *gdbarch, struct subfile *subfile,
+                  unsigned int line, CORE_ADDR address,
+                  record_line_ftype p_record_line)
+{
+  CORE_ADDR addr = gdbarch_addr_bits_remove (gdbarch, address);
+
+  (*p_record_line) (current_subfile, line, addr);
+}
+
+/* Subroutine of dwarf_decode_lines_1 to simplify it.
+   Mark the end of a set of line number records.
+   The arguments are the same as for dwarf_record_line.
+   If SUBFILE is NULL the request is ignored.  */
+
+static void
+dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
+                  CORE_ADDR address, record_line_ftype p_record_line)
+{
+  if (subfile != NULL)
+    dwarf_record_line (gdbarch, subfile, 0, address, p_record_line);
+}
+
 /* Subroutine of dwarf_decode_lines to simplify it.
    Process the line number information in LH.  */
 
@@ -17207,7 +17233,6 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
       unsigned int line = 1;
       int is_stmt = lh->default_is_stmt;
       int end_sequence = 0;
-      CORE_ADDR addr;
       unsigned char op_index = 0;
 
       if (!decode_for_pst_p && lh->num_file_names >= file)
@@ -17259,14 +17284,13 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
                    {
                      if (last_subfile != current_subfile)
                        {
-                         addr = gdbarch_addr_bits_remove (gdbarch, address);
-                         if (last_subfile)
-                           (*p_record_line) (last_subfile, 0, addr);
+                         dwarf_finish_line (gdbarch, last_subfile,
+                                            address, p_record_line);
                          last_subfile = current_subfile;
                        }
                      /* Append row to matrix using current values.  */
-                     addr = gdbarch_addr_bits_remove (gdbarch, address);
-                     (*p_record_line) (current_subfile, line, addr);
+                     dwarf_record_line (gdbarch, current_subfile,
+                                        line, address, p_record_line);
                    }
                }
            }
@@ -17359,13 +17383,12 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
                    {
                      if (last_subfile != current_subfile)
                        {
-                         addr = gdbarch_addr_bits_remove (gdbarch, address);
-                         if (last_subfile)
-                           (*p_record_line) (last_subfile, 0, addr);
+                         dwarf_finish_line (gdbarch, last_subfile,
+                                            address, p_record_line);
                          last_subfile = current_subfile;
                        }
-                     addr = gdbarch_addr_bits_remove (gdbarch, address);
-                     (*p_record_line) (current_subfile, line, addr);
+                     dwarf_record_line (gdbarch, current_subfile,
+                                        line, address, p_record_line);
                    }
                }
              break;
@@ -17461,8 +17484,8 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
           lh->file_names[file - 1].included_p = 1;
           if (!decode_for_pst_p)
            {
-             addr = gdbarch_addr_bits_remove (gdbarch, address);
-             (*p_record_line) (current_subfile, 0, addr);
+             dwarf_finish_line (gdbarch, current_subfile, address,
+                                p_record_line);
            }
         }
     }