diff options
author | Richard Henderson <rth@redhat.com> | 2005-09-07 19:22:42 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2005-09-07 19:22:42 +0000 |
commit | ecea767983fd834f48c7ceafefaec153239837c8 (patch) | |
tree | 481e8b12b179103a057bc3d182fd2e8919fcfeb1 /gas/dwarf2dbg.c | |
parent | bd12172103c0a142056c764a932d1a5f15977c81 (diff) | |
download | gdb-ecea767983fd834f48c7ceafefaec153239837c8.zip gdb-ecea767983fd834f48c7ceafefaec153239837c8.tar.gz gdb-ecea767983fd834f48c7ceafefaec153239837c8.tar.bz2 |
* dwarf2dbg.c (dwarf2_where): Set line->isa.
(dwarf2_set_isa): New.
(dwarf2_directive_loc): Rearrange to allow all options on one line.
* dwarf2dbg.h (dwarf2_set_isa): Declare.
* doc/as.texinfo: Update .loc documentation.
* gas/lns/lns-common-1.d: Don't match header or special opcode numbers.
* gas/lns/lns-common-1.s: Update for syntax change.
* gas/lns/lns-diag-1.[sl]: Likewise.
Diffstat (limited to 'gas/dwarf2dbg.c')
-rw-r--r-- | gas/dwarf2dbg.c | 133 |
1 files changed, 77 insertions, 56 deletions
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 7ebb25b..4360080 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -24,12 +24,8 @@ following directives: .file FILENO "file.c" - .loc FILENO LINENO [COLUMN] - .loc basic_block - .loc prologue_end - .loc epilogue_begin - .loc is_stmt [VALUE] - .loc isa [VALUE] + .loc FILENO LINENO [COLUMN] [basic_block] [prologue_end] \ + [epilogue_begin] [is_stmt VALUE] [isa VALUE] */ #include "ansidecl.h" @@ -287,6 +283,11 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc) ss->ptail = &e->next; } +/* Returns the current source information. If .file directives have + been encountered, the info for the corresponding source file is + returned. Otherwise, the info for the assembly source file is + returned. */ + void dwarf2_where (struct dwarf2_line_info *line) { @@ -297,11 +298,21 @@ dwarf2_where (struct dwarf2_line_info *line) line->filenum = get_filenum (filename, 0); line->column = 0; line->flags = DWARF2_FLAG_IS_STMT; + line->isa = current.isa; } else *line = current; } +/* A hook to allow the target backend to inform the line number state + machine of isa changes when assembler debug info is enabled. */ + +void +dwarf2_set_isa (unsigned int isa) +{ + current.isa = isa; +} + /* Called for each machine instruction, or relatively atomic group of machine instructions (ie built-in macro). The instruction or group is SIZE bytes in length. If dwarf2 line number generation is called @@ -482,8 +493,55 @@ dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED) void dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) { + offsetT filenum, line; + + filenum = get_absolute_expression (); + SKIP_WHITESPACE (); + line = get_absolute_expression (); + + if (filenum < 1) + { + as_bad (_("file number less than one")); + return; + } + if (filenum >= (int) files_in_use || files[filenum].filename == 0) + { + as_bad (_("unassigned file number %ld"), (long) filenum); + return; + } + + current.filenum = filenum; + current.line = line; + +#ifndef NO_LISTING + if (listing) + { + if (files[filenum].dir) + { + size_t dir_len = strlen (dirs[files[filenum].dir]); + size_t file_len = strlen (files[filenum].filename); + char *cp = (char *) alloca (dir_len + 1 + file_len + 1); + + memcpy (cp, dirs[files[filenum].dir], dir_len); + cp[dir_len] = '/'; + memcpy (cp + dir_len + 1, files[filenum].filename, file_len); + cp[dir_len + file_len + 1] = '\0'; + listing_source_file (cp); + } + else + listing_source_file (files[filenum].filename); + listing_source_line (line); + } +#endif + SKIP_WHITESPACE (); - if (ISALPHA (*input_line_pointer)) + if (ISDIGIT (*input_line_pointer)) + { + current.column = get_absolute_expression (); + SKIP_WHITESPACE (); + } + + while (ISALPHA (*input_line_pointer)) { char *p, c; offsetT value; @@ -515,68 +573,31 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) else if (value == 1) current.flags |= DWARF2_FLAG_IS_STMT; else - as_bad (_("is_stmt value not 0 or 1")); + { + as_bad (_("is_stmt value not 0 or 1")); + return; + } } else if (strcmp (p, "isa") == 0) { *input_line_pointer = c; value = get_absolute_expression (); - if (value < 0) - as_bad (_("isa number less than zero")); - else + if (value >= 0) current.isa = value; + else + { + as_bad (_("isa number less than zero")); + return; + } } else { - as_bad (_("unknown .loc sub-directive %s"), p); + as_bad (_("unknown .loc sub-directive `%s'"), p); *input_line_pointer = c; - } - } - else - { - offsetT filenum, line, column; - - filenum = get_absolute_expression (); - SKIP_WHITESPACE (); - line = get_absolute_expression (); - SKIP_WHITESPACE (); - column = get_absolute_expression (); - - if (filenum < 1) - { - as_bad (_("file number less than one")); - return; - } - if (filenum >= (int) files_in_use || files[filenum].filename == 0) - { - as_bad (_("unassigned file number %ld"), (long) filenum); return; } - current.filenum = filenum; - current.line = line; - current.column = column; - -#ifndef NO_LISTING - if (listing) - { - if (files[filenum].dir) - { - size_t dir_len = strlen (dirs[files[filenum].dir]); - size_t file_len = strlen (files[filenum].filename); - char *cp = (char *) alloca (dir_len + 1 + file_len + 1); - - memcpy (cp, dirs[files[filenum].dir], dir_len); - cp[dir_len] = '/'; - memcpy (cp + dir_len + 1, files[filenum].filename, file_len); - cp[dir_len + file_len + 1] = '\0'; - listing_source_file (cp); - } - else - listing_source_file (files[filenum].filename); - listing_source_line (line); - } -#endif + SKIP_WHITESPACE (); } demand_empty_rest_of_line (); |