diff options
-rw-r--r-- | gas/ChangeLog | 8 | ||||
-rw-r--r-- | gas/doc/as.texinfo | 24 | ||||
-rw-r--r-- | gas/dwarf2dbg.c | 133 | ||||
-rw-r--r-- | gas/dwarf2dbg.h | 4 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/lns/lns-common-1.d | 21 | ||||
-rw-r--r-- | gas/testsuite/gas/lns/lns-common-1.s | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/lns/lns-diag-1.l | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/lns/lns-diag-1.s | 27 |
9 files changed, 145 insertions, 99 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index c2f76ef..180ae68 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,13 @@ 2005-09-07 Richard Henderson <rth@redhat.com> + * 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. + +2005-09-07 Richard Henderson <rth@redhat.com> + * dwarf2dbg.c: Include safe-ctype.h. (DWARF2_LINE_OPCODE_BASE): Bump to 13. (current): Initialize. diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index e85677d..a6b3359 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -4065,7 +4065,7 @@ table is shared with the @code{.debug_info} section of the dwarf2 debugging information, and thus the user must know the exact indicies that table entries will have. -@section @code{.loc @var{fileno} @var{lineno} [@var{column}]} +@section @code{.loc @var{fileno} @var{lineno} [@var{column}] [@var{options}]} @cindex @code{loc} directive The @code{.loc} directive will add row to the @code{.debug_line} line number matrix corresponding to the immediately following assembly @@ -4073,26 +4073,30 @@ instruction. The @var{fileno}, @var{lineno}, and optional @var{column} arguments will be applied to the @code{.debug_line} state machine before the row is added. -@section @code{.loc basic_block} -This directive will set the @code{basic_block} register in the +The @var{options} are a sequence of the following tokens in any order: + +@table @code +@item basic_block +This option will set the @code{basic_block} register in the @code{.debug_line} state machine to @code{true}. -@section @code{.loc prologue_end} -This directive will set the @code{prologue_end} register in the +@item prologue_end +This option will set the @code{prologue_end} register in the @code{.debug_line} state machine to @code{true}. -@section @code{.loc epilogue_begin} -This directive will set the @code{epilogue_begin} register in the +@item epilogue_begin +This option will set the @code{epilogue_begin} register in the @code{.debug_line} state machine to @code{true}. -@section @code{.loc is_stmt @var{value}} -This directive will set the @code{epilogue_begin} register in the +@item is_stmt @var{value} +This option will set the @code{is_stmt} register in the @code{.debug_line} state machine to @code{value}, which must be either 0 or 1. -@section @code{.loc isa @var{value}} +@item isa @var{value} This directive will set the @code{isa} register in the @code{.debug_line} state machine to @var{value}, which must be an unsigned integer. +@end table @node Data @section @code{.data @var{subsection}} 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 (); diff --git a/gas/dwarf2dbg.h b/gas/dwarf2dbg.h index 34c923f..6e80021 100644 --- a/gas/dwarf2dbg.h +++ b/gas/dwarf2dbg.h @@ -55,6 +55,10 @@ extern void dwarf2_directive_loc (int dummy); returned. */ extern void dwarf2_where (struct dwarf2_line_info *l); +/* A hook to allow the target backend to inform the line number state + machine of isa changes when assembler debug info is enabled. */ +extern void dwarf2_set_isa (unsigned int isa); + /* This function generates .debug_line info based on the address and source information passed in the arguments. ADDR should be the frag-relative offset of the instruction the information is for and diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index b195892..a61ff32 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2005-09-07 Richard Henderson <rth@redhat.com> + * 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. + +2005-09-07 Richard Henderson <rth@redhat.com> + * gas/mips/mips16-dwarf2.d: Don't match anything but address and line number increments. Adjust relocation address. * gas/mips/mips16-dwarf2-n32.d: Likewise. Add "N32" to test name. diff --git a/gas/testsuite/gas/lns/lns-common-1.d b/gas/testsuite/gas/lns/lns-common-1.d index bb250e2..69de638 100644 --- a/gas/testsuite/gas/lns/lns-common-1.d +++ b/gas/testsuite/gas/lns/lns-common-1.d @@ -2,28 +2,25 @@ #name: lns-common-1 Dump of debug contents of section \.debug_line: #... - DWARF Version: 2 - Prologue Length: 28 - Minimum Instruction Length: 1 Initial value of 'is_stmt': 1 - Line Base: -5 - Line Range: 14 - Opcode Base: 13 #... Line Number Statements: - Extended opcode 2: set Address to 0x0 + Extended opcode 2: set Address to .* Copy + Set column to 3 + Special opcode .*: advance Address by .* to .* and Line by 1 to 2 Set prologue_end to true - Special opcode 19: advance Address by .* to .* and Line by 0 to 1 + Special opcode .*: advance Address by .* to .* and Line by 1 to 3 + Set column to 0 Set epilogue_begin to true - Special opcode 20: advance Address by .* to .* and Line by 1 to 2 + Special opcode .*: advance Address by .* to .* and Line by 1 to 4 Set ISA to 1 Set basic block - Special opcode 20: advance Address by .* to .* and Line by 1 to 3 + Special opcode .*: advance Address by .* to .* and Line by 1 to 5 Set is_stmt to 0 - Special opcode 19: advance Address by .* to .* and Line by 0 to 3 + Special opcode .*: advance Address by .* to .* and Line by 1 to 6 Set is_stmt to 1 - Special opcode 19: advance Address by .* to .* and Line by 0 to 3 + Special opcode .*: advance Address by .* to .* and Line by 1 to 7 Advance PC by .* to .* Extended opcode 1: End of Sequence #... diff --git a/gas/testsuite/gas/lns/lns-common-1.s b/gas/testsuite/gas/lns/lns-common-1.s index 8d3fec3..f1d590b 100644 --- a/gas/testsuite/gas/lns/lns-common-1.s +++ b/gas/testsuite/gas/lns/lns-common-1.s @@ -1,16 +1,15 @@ .file 1 "foo.c" .loc 1 1 nop - .loc prologue_end + .loc 1 2 3 nop - .loc epilogue_begin - .loc 1 2 + .loc 1 3 prologue_end nop - .loc isa 1 - .loc basic_block - .loc 1 3 + .loc 1 4 0 epilogue_begin nop - .loc is_stmt 0 + .loc 1 5 isa 1 basic_block nop - .loc is_stmt 1 + .loc 1 6 is_stmt 0 + nop + .loc 1 7 is_stmt 1 nop diff --git a/gas/testsuite/gas/lns/lns-diag-1.l b/gas/testsuite/gas/lns/lns-diag-1.l index 52207ed..53f9936 100644 --- a/gas/testsuite/gas/lns/lns-diag-1.l +++ b/gas/testsuite/gas/lns/lns-diag-1.l @@ -8,4 +8,8 @@ .*:18: Error: is_stmt value not 0 or 1 .*:19: Error: bad or irreducible absolute expression .*:23: Error: isa number less than zero -.*:26: Error: unknown .loc sub-directive frobnitz +.*:26: Error: bad or irreducible absolute expression +.*:26: Error: file number less than one +.*:27: Error: bad or irreducible absolute expression +.*:28: Error: unknown .loc sub-directive `frobnitz' +.*:29: Error: unknown .loc sub-directive `frobnitz' diff --git a/gas/testsuite/gas/lns/lns-diag-1.s b/gas/testsuite/gas/lns/lns-diag-1.s index 8193559..7a0aa409 100644 --- a/gas/testsuite/gas/lns/lns-diag-1.s +++ b/gas/testsuite/gas/lns/lns-diag-1.s @@ -8,19 +8,22 @@ .loc 3 1 .loc 1 1 1 1 - .loc basic_block - .loc basic_block 0 - .loc prologue_end - .loc epilogue_begin + .loc 1 1 basic_block + .loc 1 1 basic_block 0 + .loc 1 1 prologue_end + .loc 1 1 epilogue_begin - .loc is_stmt 0 - .loc is_stmt 1 - .loc is_stmt 2 - .loc is_stmt foo + .loc 1 1 1 is_stmt 0 + .loc 1 1 1 is_stmt 1 + .loc 1 1 1 is_stmt 2 + .loc 1 1 1 is_stmt foo - .loc isa 1 - .loc isa 2 - .loc isa -1 - .loc isa 0 + .loc 1 1 isa 1 + .loc 1 1 isa 2 + .loc 1 1 isa -1 + .loc 1 1 isa 0 .loc frobnitz + .loc 1 frobnitz + .loc 1 1 frobnitz + .loc 1 1 1 frobnitz |