diff options
author | Doug Evans <dje@google.com> | 2014-08-22 16:20:05 -0700 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2014-08-22 16:20:05 -0700 |
commit | 252a6764dd7ce810c9ecea3786d04f8f05c2d566 (patch) | |
tree | 61412d50e848718cbb8967e74cc55ccb7ec4f4ff | |
parent | 49b9c17cf445af9184508824a703099c5997f7d0 (diff) | |
download | gdb-252a6764dd7ce810c9ecea3786d04f8f05c2d566.zip gdb-252a6764dd7ce810c9ecea3786d04f8f05c2d566.tar.gz gdb-252a6764dd7ce810c9ecea3786d04f8f05c2d566.tar.bz2 |
Create a typedef for record_line: record_line_ftype.
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.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/buildsym.h | 6 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 49 |
3 files changed, 48 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a34ad78..2ebc1e8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 57467c7..8ce01b2 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -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); + #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); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 157d7fb..57a2e65 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -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); } } } |