This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/DWARF] constant class of DW_AT_high_pc is offset for version >=4 only.


Starting with DWARF version 4, the description of the DW_AT_high_pc
attribute was amended to say:

   if it is of class constant, the value is an unsigned integer offset
   which when added to the low PC gives the address of the first
   location past the last instruction associated with the entity.

A change was made in Apr 27th, 2012 to reflect that change:

  | commit 91da14142c0171e58a91ad58a32fd010b700e761
  | Author: Mark Wielaard <mjw@redhat.com>
  | Date:   Fri Apr 27 18:55:19 2012 +0000
  |
  |     * dwarf2read.c (dwarf2_get_pc_bounds): Check DW_AT_high_pc form to
  |     see whether it is an address or a constant offset from DW_AT_low_pc.
  |     (dwarf2_record_block_ranges): Likewise.
  |     (read_partial_die): Likewise.

Unfortunately, this new interpretation is now used regardless of
the CU's DWARF version. It turns out that one of WindRiver's compilers
(FTR: Diabdata 4.4) is generating DWARF version 2 info with
DW_AT_high_pc attributes using the data4 form. Because of that,
we miscompute all high PCs incorrectly. This leads to a lot of
symtabs having overlapping ranges, which in turn causes havoc
in pc-to-symtab-and-line translations.

One visible effect is when inserting a breakpoint on a given function:

    (gdb) b world
    Breakpoint 1 at 0x4005c4

The source location of the breakpoint is missing. The output should be:

    (gdb) b world
    Breakpoint 1 at 0x4005c8: file dw2-rel-hi-pc-world.c, line 24.

What happens in this case is that the pc-to-SAL translation first
starts be trying to find the symtab associated to our PC using
each symtab's ranges. Because of the high_pc miscomputation,
many symtabs end up matching, and the heuristic trying to select
the most probable one unfortunately returns one that is unrelated
(it really had no change in this case to do any better). Once we
have the wrong symtab, the start searching the associated linetable,
where the addresses are correct, thus finding no match, and therefore
no SAL.

This patch fixes it by ammending a bit the changes from the commit
mentioned above to use the new interpretation of a relative address
only when the CU's DWARF version is 4 or greater.

gdb/ChangeLog:

        * dwarf2read.c (dwarf2_get_pc): Treat the DW_AT_high_pc attribute
        as an offset only when the CU's DWARF version is 4 or greater.
        (dwarf2_record_block_ranges, read_partial_die): Likewise.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-hello.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S: New file.
        * gdb.dwarf2/dw2-abs-hi-pc-world.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc.c: New file.
        * gdb.dwarf2/dw2-abs-hi-pc.exp: New file.

Tested on x86_64-linux. OK to commmit?

As a side note, it took me nearly 4 hours to manage to create
this assembly-based testcase, mostly trying to generate a valid
linetable. There is no testcase for this feature with version >=4.
Now that the hard work has been done, it should be pretty trivial
to tweak this testscase to generate another testing version 4.
I will do that once this testcase is approved. That way, if
I have to make some modifications to this one, I won't have to
make them again to the version 4 one.

---
 gdb/dwarf2read.c                                   |  27 ++--
 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S | 151 +++++++++++++++++++++
 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c     |  28 ++++
 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S | 151 +++++++++++++++++++++
 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c     |  28 ++++
 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c           |  28 ++++
 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp         |  36 +++++
 7 files changed, 437 insertions(+), 12 deletions(-)
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 54c538a..f71730d 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -11675,11 +11675,12 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
       if (attr)
         {
 	  low = DW_ADDR (attr);
-	  if (attr_high->form == DW_FORM_addr
-	      || attr_high->form == DW_FORM_GNU_addr_index)
-	    high = DW_ADDR (attr_high);
-	  else
+	  if (cu->header.version >= 4
+	      && attr_high->form != DW_FORM_addr
+	      && attr_high->form != DW_FORM_GNU_addr_index)
 	    high = low + DW_UNSND (attr_high);
+	  else
+	    high = DW_ADDR (attr_high);
 	}
       else
 	/* Found high w/o low attribute.  */
@@ -11847,11 +11848,12 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
         {
           CORE_ADDR low = DW_ADDR (attr);
 	  CORE_ADDR high;
-	  if (attr_high->form == DW_FORM_addr
-	      || attr_high->form == DW_FORM_GNU_addr_index)
-	    high = DW_ADDR (attr_high);
-	  else
+	  if (cu->header.version >= 4
+	      && attr_high->form != DW_FORM_addr
+	      && attr_high->form != DW_FORM_GNU_addr_index)
 	    high = low + DW_UNSND (attr_high);
+	  else
+	    high = DW_ADDR (attr_high);
 
           record_block_range (block, baseaddr + low, baseaddr + high - 1);
         }
@@ -15244,14 +15246,15 @@ read_partial_die (const struct die_reader_specs *reader,
 	  break;
 	case DW_AT_high_pc:
 	  has_high_pc_attr = 1;
-	  if (attr.form == DW_FORM_addr
-	      || attr.form == DW_FORM_GNU_addr_index)
-	    part_die->highpc = DW_ADDR (&attr);
-	  else
+	  if (cu->header.version >= 4
+	      && attr.form != DW_FORM_addr
+	      && attr.form != DW_FORM_GNU_addr_index)
 	    {
 	      high_pc_relative = 1;
 	      part_die->highpc = DW_UNSND (&attr);
 	    }
+	  else
+	    part_die->highpc = DW_ADDR (&attr);
 	  break;
 	case DW_AT_location:
           /* Support the .debug_loc offsets.  */
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S
new file mode 100644
index 0000000..f7ea9ae
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S
@@ -0,0 +1,151 @@
+/* Copyright 2014 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+	.section	.debug_info,"",@progbits
+	.4byte	.Ledebug_info0 - .Lsdebug_info0	/* Length of Compilation Unit Info */
+.Lsdebug_info0:
+	.value	0x2	/* DWARF version number */
+	.4byte	.Ldebug_abbrev0	/* Offset Into Abbrev. Section */
+	.byte	0x4	/* Pointer Size (in bytes) */
+	.uleb128 0x1	/* (DIE (0xb) DW_TAG_compile_unit) */
+        .ascii "GNU C 4.7.4 20140206 for GNAT Pro 7.3.0w (20140206)\0"
+	.byte	0x1	/* DW_AT_language */
+	.ascii	"dw2-rel-hi-pc-hello.c\0"     /* DW_AT_name */
+	.ascii  "/tmp\0"        /* DW_AT_comp_dir */
+	.4byte	.hello_start	/* DW_AT_low_pc */
+	.4byte	.hello_end	/* DW_AT_high_pc */
+	.4byte	.Ldebug_line0	/* DW_AT_stmt_list */
+	.uleb128 0x2	/* (DIE (0x2d) DW_TAG_subprogram) */
+	.byte	0x1	/* DW_AT_external */
+	.ascii	"hello\0"
+	.byte	0x1	/* DW_AT_decl_file (hello.c) */
+	.byte	0x13	/* DW_AT_decl_line */
+	.byte	0x1	/* DW_AT_prototyped */
+	.4byte	.hello_start	/* DW_AT_low_pc */
+	.4byte	.hello_end	/* DW_AT_high_pc */
+	.byte	0	/* end of children of DIE 0xb */
+.Ledebug_info0:
+
+	.section	.debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+	.uleb128 0x1	/* (abbrev code) */
+	.uleb128 0x11	/* (TAG: DW_TAG_compile_unit) */
+	.byte	0x1	/* DW_children_yes */
+	.uleb128 0x25	/* (DW_AT_producer) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x13	/* (DW_AT_language) */
+	.uleb128 0xb	/* (DW_FORM_data1) */
+	.uleb128 0x3	/* (DW_AT_name) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x1b	/* (DW_AT_comp_dir) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x11	/* (DW_AT_low_pc) */
+	.uleb128 0x1	/* (DW_FORM_addr) */
+	.uleb128 0x12	/* (DW_AT_high_pc) */
+	.uleb128 0x6	/* (DW_FORM_data4) */
+	.uleb128 0x10	/* (DW_AT_stmt_list) */
+	.uleb128 0x6	/* (DW_FORM_data4) */
+	.byte	0
+	.byte	0
+	.uleb128 0x2	/* (abbrev code) */
+	.uleb128 0x2e	/* (TAG: DW_TAG_subprogram) */
+	.byte	0	/* DW_children_no */
+	.uleb128 0x3f	/* (DW_AT_external) */
+	.uleb128 0xc	/* (DW_FORM_flag) */
+	.uleb128 0x3	/* (DW_AT_name) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x3a	/* (DW_AT_decl_file) */
+	.uleb128 0xb	/* (DW_FORM_data1) */
+	.uleb128 0x3b	/* (DW_AT_decl_line) */
+	.uleb128 0xb	/* (DW_FORM_data1) */
+	.uleb128 0x27	/* (DW_AT_prototyped) */
+	.uleb128 0xc	/* (DW_FORM_flag) */
+	.uleb128 0x11	/* (DW_AT_low_pc) */
+	.uleb128 0x1	/* (DW_FORM_addr) */
+	.uleb128 0x12	/* (DW_AT_high_pc) */
+	.uleb128 0x6	/* (DW_FORM_data4) */
+	.byte	0
+	.byte	0
+	.byte	0
+
+	.section	.debug_line,"",@progbits
+.Ldebug_line0:
+        .4byte  LELT-LSLT  /* Length of Source Line Info */
+LSLT:
+        .2byte  0x2    /* DWARF Version */
+        .4byte  LELTP-LASLTP     /* Prolog Length */
+LASLTP:
+        .byte   0x1      /* Minimum Instruction Length */
+        .byte   0x1      /* Default is_stmt_start flag */
+        .byte   0x1      /* Line Base Value (Special Opcodes) */
+        .byte   0x1      /* Line Range Value (Special Opcodes) */
+        .byte   0xd      /* Special Opcode Base */
+        .byte   0        /* opcode: 0x1 has 0 args */
+        .byte   0x1      /* opcode: 0x2 has 1 args */
+        .byte   0x1      /* opcode: 0x3 has 1 args */
+        .byte   0x1      /* opcode: 0x4 has 1 args */
+        .byte   0x1      /* opcode: 0x5 has 1 args */
+        .byte   0        /* opcode: 0x6 has 0 args */
+        .byte   0        /* opcode: 0x7 has 0 args */
+        .byte   0        /* opcode: 0x8 has 0 args */
+        .byte   0x1      /* opcode: 0x9 has 1 args */
+        .byte   0        /* opcode: 0xa has 0 args */
+        .byte   0        /* opcode: 0xb has 0 args */
+        .byte   0x1      /* opcode: 0xc has 1 args */
+        .byte   0        /* End directory table */
+        .ascii "dw2-rel-hi-pc-hello.c\0"       /* File Entry: 0x1 */
+        .uleb128 0
+        .uleb128 0
+        .uleb128 0
+        .byte   0        /* End file name table */
+LELTP:
+        .byte   0        /* set address to .hello_start */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .hello_start
+        .byte   0x3      /* DW_LNS_advance_line */
+        .sleb128 22      /* ... to 23 */
+        .byte   0x5      /* column 0 */
+        .uleb128 0       /* 0 */
+        .byte           1       /* DW_LNS_copy */
+
+        .byte   0        /* set address to .hello0 */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .hello0
+        .byte   0x3      /* DW_LNS_advance_line */
+        .sleb128 1       /* ... to 24 */
+        .byte   0x5      /* column 0 */
+        .uleb128 0       /* 0 */
+        .byte           1       /* DW_LNS_copy */
+
+        .byte   0        /* set address to .hello1 */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .hello1
+        .byte   0x3      /* DW_LNS_advance_line */
+        .sleb128 1       /* ... to 25 */
+        .byte   0x5      /* column 0 */
+        .uleb128 0       /* 0 */
+        .byte           1       /* DW_LNS_copy */
+
+        .byte   0        /* set address to .hello_end */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .hello_end
+        .byte   0        /* end sequence */
+        .uleb128 0x1
+        .byte   0x1
+LELT:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c
new file mode 100644
index 0000000..59c761d
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello.c
@@ -0,0 +1,28 @@
+/* Copyright 2014 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+extern int v;
+
+asm (".hello_start: .globl .hello_start\n");
+void
+hello (void)
+{
+asm (".hello0: .globl .hello0\n");
+  v++;
+asm (".hello1: .globl .hello1\n");
+}
+asm (".hello_end: .globl .hello_end\n");
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S
new file mode 100644
index 0000000..0d3a3d2
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S
@@ -0,0 +1,151 @@
+/* Copyright 2014 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+	.section	.debug_info,"",@progbits
+	.4byte	.Ledebug_info0 - .Lsdebug_info0	/* Length of Compilation Unit Info */
+.Lsdebug_info0:
+	.value	0x2	/* DWARF version number */
+	.4byte	.Ldebug_abbrev0	/* Offset Into Abbrev. Section */
+	.byte	0x4	/* Pointer Size (in bytes) */
+	.uleb128 0x1	/* (DIE (0xb) DW_TAG_compile_unit) */
+        .ascii "GNU C 4.7.4 20140206 for GNAT Pro 7.3.0w (20140206)\0"
+	.byte	0x1	/* DW_AT_language */
+	.ascii	"dw2-rel-hi-pc-world.c\0"     /* DW_AT_name */
+	.ascii  "/tmp\0"        /* DW_AT_comp_dir */
+	.4byte	.world_start	/* DW_AT_low_pc */
+	.4byte	.world_end	/* DW_AT_high_pc */
+	.4byte	.Ldebug_line0	/* DW_AT_stmt_list */
+	.uleb128 0x2	/* (DIE (0x2d) DW_TAG_subprogram) */
+	.byte	0x1	/* DW_AT_external */
+	.ascii	"world\0"
+	.byte	0x1	/* DW_AT_decl_file (world.c) */
+	.byte	0x13	/* DW_AT_decl_line */
+	.byte	0x1	/* DW_AT_prototyped */
+	.4byte	.world_start	/* DW_AT_low_pc */
+	.4byte	.world_end	/* DW_AT_high_pc */
+	.byte	0	/* end of children of DIE 0xb */
+.Ledebug_info0:
+
+	.section	.debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+	.uleb128 0x1	/* (abbrev code) */
+	.uleb128 0x11	/* (TAG: DW_TAG_compile_unit) */
+	.byte	0x1	/* DW_children_yes */
+	.uleb128 0x25	/* (DW_AT_producer) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x13	/* (DW_AT_language) */
+	.uleb128 0xb	/* (DW_FORM_data1) */
+	.uleb128 0x3	/* (DW_AT_name) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x1b	/* (DW_AT_comp_dir) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x11	/* (DW_AT_low_pc) */
+	.uleb128 0x1	/* (DW_FORM_addr) */
+	.uleb128 0x12	/* (DW_AT_high_pc) */
+	.uleb128 0x6	/* (DW_FORM_data4) */
+	.uleb128 0x10	/* (DW_AT_stmt_list) */
+	.uleb128 0x6	/* (DW_FORM_data4) */
+	.byte	0
+	.byte	0
+	.uleb128 0x2	/* (abbrev code) */
+	.uleb128 0x2e	/* (TAG: DW_TAG_subprogram) */
+	.byte	0	/* DW_children_no */
+	.uleb128 0x3f	/* (DW_AT_external) */
+	.uleb128 0xc	/* (DW_FORM_flag) */
+	.uleb128 0x3	/* (DW_AT_name) */
+	.uleb128 0x8    /* (DW_FORM_string) */
+	.uleb128 0x3a	/* (DW_AT_decl_file) */
+	.uleb128 0xb	/* (DW_FORM_data1) */
+	.uleb128 0x3b	/* (DW_AT_decl_line) */
+	.uleb128 0xb	/* (DW_FORM_data1) */
+	.uleb128 0x27	/* (DW_AT_prototyped) */
+	.uleb128 0xc	/* (DW_FORM_flag) */
+	.uleb128 0x11	/* (DW_AT_low_pc) */
+	.uleb128 0x1	/* (DW_FORM_addr) */
+	.uleb128 0x12	/* (DW_AT_high_pc) */
+	.uleb128 0x6	/* (DW_FORM_data4) */
+	.byte	0
+	.byte	0
+	.byte	0
+
+	.section	.debug_line,"",@progbits
+.Ldebug_line0:
+        .4byte  LELT-LSLT  /* Length of Source Line Info */
+LSLT:
+        .2byte  0x2    /* DWARF Version */
+        .4byte  LELTP-LASLTP     /* Prolog Length */
+LASLTP:
+        .byte   0x1      /* Minimum Instruction Length */
+        .byte   0x1      /* Default is_stmt_start flag */
+        .byte   0x1      /* Line Base Value (Special Opcodes) */
+        .byte   0x1      /* Line Range Value (Special Opcodes) */
+        .byte   0xd      /* Special Opcode Base */
+        .byte   0        /* opcode: 0x1 has 0 args */
+        .byte   0x1      /* opcode: 0x2 has 1 args */
+        .byte   0x1      /* opcode: 0x3 has 1 args */
+        .byte   0x1      /* opcode: 0x4 has 1 args */
+        .byte   0x1      /* opcode: 0x5 has 1 args */
+        .byte   0        /* opcode: 0x6 has 0 args */
+        .byte   0        /* opcode: 0x7 has 0 args */
+        .byte   0        /* opcode: 0x8 has 0 args */
+        .byte   0x1      /* opcode: 0x9 has 1 args */
+        .byte   0        /* opcode: 0xa has 0 args */
+        .byte   0        /* opcode: 0xb has 0 args */
+        .byte   0x1      /* opcode: 0xc has 1 args */
+        .byte   0        /* End directory table */
+        .ascii "dw2-rel-hi-pc-world.c\0"       /* File Entry: 0x1 */
+        .uleb128 0
+        .uleb128 0
+        .uleb128 0
+        .byte   0        /* End file name table */
+LELTP:
+        .byte   0        /* set address to .world_start */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .world_start
+        .byte   0x3      /* DW_LNS_advance_line */
+        .sleb128 22      /* ... to 23 */
+        .byte   0x5      /* column 0 */
+        .uleb128 0       /* 0 */
+        .byte           1       /* DW_LNS_copy */
+
+        .byte   0        /* set address to .world0 */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .world0
+        .byte   0x3      /* DW_LNS_advance_line */
+        .sleb128 1       /* ... to 24 */
+        .byte   0x5      /* column 0 */
+        .uleb128 0       /* 0 */
+        .byte           1       /* DW_LNS_copy */
+
+        .byte   0        /* set address to .world1 */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .world1
+        .byte   0x3      /* DW_LNS_advance_line */
+        .sleb128 1       /* ... to 25 */
+        .byte   0x5      /* column 0 */
+        .uleb128 0       /* 0 */
+        .byte           1       /* DW_LNS_copy */
+
+        .byte   0        /* set address to .world_end */
+        .uleb128 0x5
+        .byte   0x2
+        .4byte  .world_end
+        .byte   0        /* end sequence */
+        .uleb128 0x1
+        .byte   0x1
+LELT:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c
new file mode 100644
index 0000000..04f17bd
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world.c
@@ -0,0 +1,28 @@
+/* Copyright 2014 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+extern int v;
+
+asm (".world_start: .globl .world_start\n");
+void
+world (void)
+{
+asm (".world0: .globl .world0\n");
+  v++;
+asm (".world1: .globl .world1\n");
+}
+asm (".world_end: .globl .world_end\n");
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c
new file mode 100644
index 0000000..95773a2
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.c
@@ -0,0 +1,28 @@
+/* Copyright 2014 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+extern void hello (void);
+extern void world (void);
+
+int v;
+
+int
+main (void)
+{
+  hello ();
+  world ();
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
new file mode 100644
index 0000000..9090eb5
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
@@ -0,0 +1,36 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+    return 0
+}
+
+standard_testfile
+set executable ${testfile}
+
+if {[build_executable ${testfile}.exp ${executable} "${testfile}.c ${testfile}-hello-dbg.S ${testfile}-hello.c ${testfile}-world-dbg.S ${testfile}-world.c"] == -1} {
+    return -1
+}
+
+clean_restart $executable
+
+gdb_test "break hello" \
+    "Breakpoint $decimal at $hex: file .*dw2-rel-hi-pc-hello\\.c, line 24\\."
+
+
+gdb_test "break world" \
+    "Breakpoint $decimal at $hex: file .*dw2-rel-hi-pc-world\\.c, line 24\\."
-- 
1.8.3.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]