int basic_block;
unsigned char op_index;
unsigned char end_sequence;
-/* This variable hold the number of the last entry seen
- in the File Table. */
+ /* This variable hold the number of the last entry seen
+ in the File Table. */
unsigned int last_file_entry;
} SMR;
= ((state_machine_regs.op_index + uladv)
/ linfo.li_max_ops_per_insn)
* linfo.li_min_insn_length;
- state_machine_regs.address
- += addrdelta;
+
+ state_machine_regs.address += addrdelta;
state_machine_regs.op_index
= (state_machine_regs.op_index + uladv)
% linfo.li_max_ops_per_insn;
-*- text -*-
+* Add support for loaction views in DWARF debug line information.
+
Changes in 2.29:
* Add support for ELF SHF_GNU_MBIND.
#define TC_PARSE_CONS_RETURN_NONE BFD_RELOC_NONE
#endif
-struct line_entry {
+struct line_entry
+{
struct line_entry *next;
symbolS *label;
struct dwarf2_line_info loc;
static char unused[offsetof(struct line_entry, next) ? -1 : 1]
ATTRIBUTE_UNUSED;
-struct line_subseg {
+struct line_subseg
+{
struct line_subseg *next;
subsegT subseg;
struct line_entry *head;
struct line_entry **pmove_tail;
};
-struct line_seg {
+struct line_seg
+{
struct line_seg *next;
segT seg;
struct line_subseg *head;
static struct line_seg *all_segs;
static struct line_seg **last_seg_ptr;
-struct file_entry {
+struct file_entry
+{
const char *filename;
unsigned int dir;
};
bfd_boolean dwarf2_loc_mark_labels;
/* Current location as indicated by the most recent .loc directive. */
-static struct dwarf2_line_info current = {
+static struct dwarf2_line_info current =
+{
1, 1, 0, 0,
DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0,
0, NULL
reverse_line_entry_list (struct line_entry *h)
{
struct line_entry *p = NULL, *e, *n;
+
for (e = h; e; e = n)
{
n = e->next;
/* Compute the view for E based on the previous entry P. If we
introduce an (undefined) view symbol for P, and H is given (P must
be the tail in this case), introduce view symbols for earlier list
- entries as well, until one of them is constant.
- */
+ entries as well, until one of them is constant. */
static void
set_or_check_view (struct line_entry *e, struct line_entry *p,
struct line_entry *h)
{
expressionS viewx;
+
memset (&viewx, 0, sizeof (viewx));
viewx.X_unsigned = 1;
if (viewx.X_op != O_constant || viewx.X_add_number)
{
+ expressionS incv;
+
if (!p->loc.view)
{
p->loc.view = symbol_temp_make ();
gas_assert (!S_IS_DEFINED (p->loc.view));
}
- expressionS incv;
memset (&incv, 0, sizeof (incv));
incv.X_unsigned = 1;
incv.X_op = O_symbol;
compute E's. */
if (h && p && p->loc.view && !S_IS_DEFINED (p->loc.view))
{
+ struct line_entry *h2;
/* Reverse the list to avoid quadratic behavior going backwards
in a single-linked list. */
struct line_entry *r = reverse_line_entry_list (h);
+
gas_assert (r == p);
/* Set or check views until we find a defined or absent view. */
do
set_or_check_view (r, r->next, NULL);
while (r->next && r->next->loc.view && !S_IS_DEFINED (r->next->loc.view)
&& (r = r->next));
+
/* Unreverse the list, so that we can go forward again. */
- struct line_entry *h2 = reverse_line_entry_list (p);
+ h2 = reverse_line_entry_list (p);
gas_assert (h2 == h);
+
/* Starting from the last view we just defined, attempt to
simplify the view expressions, until we do so to P. */
do
{
if (debug_type == DEBUG_DWARF2)
{
+ const char *filename;
+
memset (line, 0, sizeof (*line));
- const char *filename = as_where (&line->line);
+ filename = as_where (&line->line);
line->filenum = get_filenum (filename, 0);
line->column = 0;
line->flags = DWARF2_FLAG_IS_STMT;
}
else if (strcmp (p, "view") == 0)
{
- (void) restore_line_pointer (c);
symbolS *sym;
+
+ (void) restore_line_pointer (c);
SKIP_WHITESPACE ();
+
if (ISDIGIT (*input_line_pointer)
|| *input_line_pointer == '-')
{
bfd_boolean force_reset = *input_line_pointer == '-';
+
value = get_absolute_expression ();
if (value != 0)
{
else
{
char *name = read_symbol_name ();
+
if (!name)
return;
sym = symbol_find_or_make (name);
if (last_frag == NULL
|| (e->loc.view == force_reset_view && force_reset_view
- /* If we're to reset the view, but we know we're
- advancing PC, we don't have to force with
+ /* If we're going to reset the view, but we know we're
+ advancing the PC, we don't have to force with
set_address. We know we do when we're at the same
address of the same frag, and we know we might when
we're in the beginning of a frag, and we were at the
holding the check value in X_op_symbol. */
while (view_assert_failed)
{
+ expressionS *expr;
+ symbolS *sym;
+ offsetT failed;
+
gas_assert (!symbol_resolved_p (view_assert_failed));
- expressionS *expr = symbol_get_value_expression (view_assert_failed);
- symbolS *sym = view_assert_failed;
+ expr = symbol_get_value_expression (view_assert_failed);
+ sym = view_assert_failed;
/* If view_assert_failed looks like a compound check in the
chain, break it up. */
else
view_assert_failed = NULL;
- offsetT failed = resolve_symbol_value (sym);
+ failed = resolve_symbol_value (sym);
if (!symbol_resolved_p (sym) || failed)
{
as_bad (_("view number mismatch"));
#define DWARF2_FLAG_PROLOGUE_END (1 << 2)
#define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
-struct dwarf2_line_info {
+struct dwarf2_line_info
+{
unsigned int filenum;
unsigned int line;
unsigned int column;
/* Implements the .file FILENO "FILENAME" directive. FILENO can be 0
to indicate that no file number has been assigned. All real file
number must be >0. */
-extern char *dwarf2_directive_file (int dummy);
+extern char *dwarf2_directive_file (int);
/* Implements the .loc FILENO LINENO [COLUMN] directive. FILENO is
the file number, LINENO the line number and the (optional) COLUMN
corresponds to. FILENO can be 0 to indicate that the filename
specified by the textually most recent .file directive should be
used. */
-extern void dwarf2_directive_loc (int dummy);
+extern void dwarf2_directive_loc (int);
/* Implements the .loc_mark_labels {0,1} directive. */
-extern void dwarf2_directive_loc_mark_labels (int dummy);
+extern void dwarf2_directive_loc_mark_labels (int);
/* 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. */
-extern void dwarf2_where (struct dwarf2_line_info *l);
+extern void dwarf2_where (struct dwarf2_line_info *);
/* 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);
+extern void dwarf2_set_isa (unsigned int);
/* 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
L is the source information that should be associated with that
address. */
-extern void dwarf2_gen_line_info (addressT addr, struct dwarf2_line_info *l);
+extern void dwarf2_gen_line_info (addressT, struct dwarf2_line_info *);
/* Must be called for each generated instruction. */
extern void dwarf2_emit_insn (int);
/* An enumeration which describes the sizes of offsets (to DWARF sections)
and the mechanism by which the size is indicated. */
-enum dwarf2_format {
+enum dwarf2_format
+{
/* 32-bit format: the initial length field is 4 bytes long. */
dwarf2_format_32bit,
/* DWARF3 64-bit format: the representation of the initial length
#name: undefined symbols in sleb128 directive
#source: sleb128-9.s
#error-output: sleb128-9.l
-#target: *-*-*
+#not-target: riscv*-*
+
Decoded dump of debug contents of section \.debug_line:
CU: large-debug-line-table\.c:
-File name Line number Starting address
+File name Line number Starting address.*
large-debug-line-table\.c 1 0
#...
#as:
#name: DWARF2 10
#error-output: dwarf2-10.l
+# The mep target tries to relay code sections which breaks symbolic view computations.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: mep-* tile*-*
#as:
#readelf: -wL
#name: DWARF2 11
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* m32c-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Decoded dump of debug contents of section \.debug_line:
.globl _start
_start:
.file 1 "dwarf2-11.c"
- .int 0
+ .dc.l 0
.loc 1 1 view 0
.balign 8
.loc 1 2 view 0
#as:
#readelf: -x.rodata -wL
#name: DWARF2 12
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
+
Hex dump of section '\.rodata':
0x00000000 01 *.*
.loc 1 1 view 0
.loc 1 2 view -0
.loc 1 3 view .L1
- .int 0
+ .dc.l 0
.size _start, .-_start
.section .rodata
#as:
#readelf: -x.rodata -wL
#name: DWARF2 13
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 01 *.*
.globl _start
_start:
.file 1 "dwarf2-13.c"
- .int 0
+ .dc.l 0
.loc 1 1 view 0
.balign 8
.loc 1 2 view -0
.loc 1 3 view .L1
- .int 0
+ .dc.l 0
.size _start, .-_start
.section .rodata
#as:
#readelf: -x.rodata -wL
#name: DWARF2 14
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 01 *.*
.balign 4
.loc 1 2 view -0
.loc 1 3 view .L1
- .int 0
+ .dc.l 0
.size _start, .-_start
.section .rodata
#as:
#readelf: -x.rodata -wL
#name: DWARF2 15
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 01 *.*
_start:
.file 1 "dwarf2-15.c"
.loc 1 1 view 0
- .int 0
+ .dc.l 0
.loc 1 2 view -0
.loc 1 3 view .L1
- .int 0
+ .dc.l 0
.size _start, .-_start
.section .rodata
#as:
#readelf: -x.rodata -wL
#name: DWARF2 16
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The mep target tries to relay code sections which breaks symbolic view computations.
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mep-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 01 *.*
_start:
.file 1 "dwarf2-16.c"
.loc 1 1 view 0
- .int 0
+ .dc.l 0
.loc 1 2 view 0
.balign 4
.loc 1 3 view .L1
- .int 0
+ .dc.l 0
.size _start, .-_start
.section .rodata
#as:
#readelf: -x.rodata -wL
#name: DWARF2 17
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The mep target tries to relay code sections which breaks symbolic view computations.
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mep-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 00 *.*
_start:
.file 1 "dwarf2-17.c"
.loc 1 1 view 0
- .int 0
+ .dc.l 0
.loc 1 2 view 0
.balign 8
.loc 1 3 view .L1
- .int 0
+ .dc.l 0
.size _start, .-_start
.section .rodata
#as:
#readelf: -x.rodata -wL
#name: DWARF2 18
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 0100 *.*
.file 1 "dwarf2-18.c"
.loc 1 1
.loc 1 2 view .L1
- .int 0
+ .dc.l 0
.loc 1 3 view .L2
- .int 0
+ .dc.l 0
.size _start, .-_start
.section .rodata
#as:
#readelf: -x.rodata -wlL
#name: DWARF2 5
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 rx and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The mep target tries to relay code sections which breaks symbolic view computations.
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mep-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* rx-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 01010201 010203 *.*
-Raw dump of debug contents of section .debug_line:
+Raw dump of debug contents of section \.debug_line:
Offset: 0x0
Length: [0-9]*
.file 1 "dwarf2-5.c"
.loc 1 1 view 0
.loc 1 2 view .L2
- .int 0
+ .dc.l 0
.loc 1 3 view 0
.balign 4
.loc 1 4 view .L4
.org .+1
.balign 4
.loc 1 6 view 0
- .int 0
+ .dc.l 0
.text
.globl func
.type func, %function
func:
.loc 1 7 view 0
.loc 1 8 view .L8
- .int 0
+ .dc.l 0
.loc 1 9 view 0
.loc 1 10 view .L10
.pushsection .text
.loc 1 11 view .L11
.popsection
.loc 1 12 view .L12
- .int 0
+ .dc.l 0
.size func, .-func
.section .rodata
#as:
#readelf: -wlL
#name: DWARF2 6
+# These targets either do not support or do not evaluate the subtraction of symbols at assembly time
+#not-target: am3-* avr-* cr16-* crx-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* xtensa-*
Raw dump of debug contents of section .debug_line:
#as:
#readelf: -x.rodata -wL
#name: DWARF2 7
+# The am3 avr cr16 crx mn10 msp430 nds32 pru rl78 and xtensa targets do not evaluate the subtraction of symbols at assembly time
+# The riscv targets do not support the subtraction of symbols.
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: am3-* avr-* cr16-* crx-* mn10*-* msp430-* nds32*-* pru-* riscv*-* rl78-* tile*-* xtensa-*
Hex dump of section '\.rodata':
0x00000000 01 *.*
dwarf2-7\.c *1 *0
dwarf2-7\.c *2 *0
dwarf2-7\.c *3 *0 *1
-dwarf2-7\.c *3 *0x4
+dwarf2-7\.c *3 *0x.
func:
.loc 1 2 view -0
.loc 1 3 view .L1
- .int 0
+ .dc.l 0
.size func, .-func
#as:
#name: DWARF2 8
#error-output: dwarf2-8.l
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: tile*-*
#as:
#name: DWARF2 9
#error-output: dwarf2-9.l
+# The tile targets require 8-byte instructions, but the test only simulates 4-byte instructions.
+#not-target: tile*-*
[^:]*: Assembler messages:
-[^:]*:30: Error: view number mismatch
+[^:]*.* Error: view number mismatch
#...
Line Number Statements:
\[0x.*\] Extended opcode 2: set Address to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 1\)|)
\[0x.*\] Set column to 3
\[0x.*\] Advance Line by 1 to 2
\[0x.*\] Advance PC by fixed size amount .* to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 1\)|)
\[0x.*\] Set prologue_end to true
\[0x.*\] Advance Line by 1 to 3
\[0x.*\] Advance PC by fixed size amount .* to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 2\)|)
\[0x.*\] Set column to 0
\[0x.*\] Set epilogue_begin to true
\[0x.*\] Advance Line by 1 to 4
\[0x.*\] Advance PC by fixed size amount .* to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 3\)|)
\[0x.*\] Set ISA to 1
\[0x.*\] Set basic block
\[0x.*\] Advance Line by 1 to 5
\[0x.*\] Advance PC by fixed size amount .* to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 4\)|)
\[0x.*\] Set is_stmt to 0
\[0x.*\] Advance Line by 1 to 6
\[0x.*\] Advance PC by fixed size amount .* to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 5\)|)
\[0x.*\] Set is_stmt to 1
\[0x.*\] Advance Line by 1 to 7
\[0x.*\] Advance PC by fixed size amount .* to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 6\)|)
\[0x.*\] Extended opcode 4: set Discriminator to 1
\[0x.*\] Advance Line by 0 to 7
\[0x.*\] Advance PC by fixed size amount .* to .*
- \[0x.*\] Copy
+ \[0x.*\] Copy( \(view 7\)|)
\[0x.*\] Advance PC by fixed size amount .* to .*
\[0x.*\] Extended opcode 1: End of Sequence
#...
\[0x.*\] Extended opcode 2: set Address to .*
\[0x.*\] Copy
\[0x.*\] Set basic block
- \[0x.*\] .* by 1 to 2 \(view 1\)
+ \[0x.*\] .* by 1 to 2( \(view 1\)|)
#pass
Decoded dump of debug contents of section .debug_line:
.*:
-File name Line number Starting address
+File name Line number Starting address View
per-function-debugline.s 39 0
-per-function-debugline.s 40 0x2
+per-function-debugline.s 40 0x2 1
-per-function-debugline.s 41 0x4
+per-function-debugline.s 41 0x4 2
-per-function-debugline.s 42 0x6
+per-function-debugline.s 42 0x6 3
-per-function-debugline.s 47 0x8
+per-function-debugline.s 47 0x8 4
-per-function-debugline.s 48 0xc
+per-function-debugline.s 48 0xc 5
-per-function-debugline.s 49 0x10
+per-function-debugline.s 49 0x10 6
-per-function-debugline.s 50 0x12
+per-function-debugline.s 50 0x12 7
-per-function-debugline.s 51 0x16
+per-function-debugline.s 51 0x16 8
-per-function-debugline.s 52 0x1a
+per-function-debugline.s 52 0x1a 9
-per-function-debugline.s 54 0x1c
+per-function-debugline.s 54 0x1c 10
-per-function-debugline.s 55 0x1e
+per-function-debugline.s 55 0x1e 11
-per-function-debugline.s 56 0x20
+per-function-debugline.s 56 0x20 12
-per-function-debugline.s 62 0x22
-
-per-function-debugline.s 63 0x24
+per-function-debugline.s 56 0x22 13
-per-function-debugline.s 64 0x26
-
-per-function-debugline.s 65 0x28
+per-function-debugline.s 62 0x22
-per-function-debugline.s 70 0x2a
+per-function-debugline.s 63 0x24 1
-per-function-debugline.s 71 0x2e
+per-function-debugline.s 64 0x26 2
-per-function-debugline.s 72 0x32
+per-function-debugline.s 65 0x28 3
-per-function-debugline.s 73 0x36
+per-function-debugline.s 70 0x2a 4
-per-function-debugline.s 74 0x38
+per-function-debugline.s 71 0x2e 5
-per-function-debugline.s 75 0x3c
+per-function-debugline.s 72 0x32 6
-per-function-debugline.s 76 0x40
+per-function-debugline.s 73 0x36 7
-per-function-debugline.s 77 0x44
+per-function-debugline.s 74 0x38 8
-per-function-debugline.s 79 0x48
+per-function-debugline.s 75 0x3c 9
-per-function-debugline.s 80 0x4a
+per-function-debugline.s 76 0x40 10
-per-function-debugline.s 81 0x4c
+per-function-debugline.s 77 0x44 11
+per-function-debugline.s 79 0x48 12
+per-function-debugline.s 80 0x4a 13
+#pass