[gdb/testsuite] Use MACRO_AT_{func,range}
authorTom de Vries <tdevries@suse.de>
Fri, 17 Jul 2020 14:42:37 +0000 (16:42 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 17 Jul 2020 14:42:37 +0000 (16:42 +0200)
Use dwarf assembly procs MACRO_AT_func and MACRO_AT_range in test-cases where
that's appropriate.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-07-17  Tom de Vries  <tdevries@suse.de>

* gdb.dlang/circular.c (found): Use found_label as label name.
* gdb.dwarf2/arr-subrange.c (main): Use main_label as label name.
* gdb.dwarf2/comp-unit-lang.c (func): Use func_label as label name.
* gdb.dlang/circular.exp: Use MACRO_AT_func and MACRO_AT_range.
* gdb.dwarf2/ada-linkage-name.exp: Same.
* gdb.dwarf2/arr-subrange.exp: Same.
* gdb.dwarf2/atomic-type.exp: Same.
* gdb.dwarf2/comp-unit-lang.exp: Same.
* gdb.dwarf2/cpp-linkage-name.exp: Same.
* gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Same.
* gdb.dwarf2/dw2-lexical-block-bare.exp: Same.
* gdb.dwarf2/dw2-regno-invalid.exp: Same.
* gdb.dwarf2/implptr-64bit.exp: Same.
* gdb.dwarf2/imported-unit-abstract-const-value.exp: Same.
* gdb.dwarf2/imported-unit-runto-main.exp: Same.
* gdb.dwarf2/imported-unit.exp: Same.
* gdb.dwarf2/main-subprogram.exp: Same.
* gdb.dwarf2/missing-type-name.exp: Same.
* gdb.dwarf2/nonvar-access.exp: Same.
* gdb.dwarf2/struct-with-sig.exp: Same.
* gdb.dwarf2/typedef-void-finish.exp: Same.
* gdb.dwarf2/void-type.exp: Same.

23 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dlang/circular.c
gdb/testsuite/gdb.dlang/circular.exp
gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp
gdb/testsuite/gdb.dwarf2/arr-subrange.c
gdb/testsuite/gdb.dwarf2/arr-subrange.exp
gdb/testsuite/gdb.dwarf2/atomic-type.exp
gdb/testsuite/gdb.dwarf2/comp-unit-lang.c
gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp
gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp
gdb/testsuite/gdb.dwarf2/imported-unit.exp
gdb/testsuite/gdb.dwarf2/main-subprogram.exp
gdb/testsuite/gdb.dwarf2/missing-type-name.exp
gdb/testsuite/gdb.dwarf2/nonvar-access.exp
gdb/testsuite/gdb.dwarf2/struct-with-sig.exp
gdb/testsuite/gdb.dwarf2/typedef-void-finish.exp
gdb/testsuite/gdb.dwarf2/void-type.exp

index f9ee61251b2cdfbebd1e3ac6150242f4f600d544..3e775d6498514355665aeb1eb797d23adffa195d 100644 (file)
@@ -1,3 +1,28 @@
+2020-07-17  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.dlang/circular.c (found): Use found_label as label name.
+       * gdb.dwarf2/arr-subrange.c (main): Use main_label as label name.
+       * gdb.dwarf2/comp-unit-lang.c (func): Use func_label as label name.
+       * gdb.dlang/circular.exp: Use MACRO_AT_func and MACRO_AT_range.
+       * gdb.dwarf2/ada-linkage-name.exp: Same.
+       * gdb.dwarf2/arr-subrange.exp: Same.
+       * gdb.dwarf2/atomic-type.exp: Same.
+       * gdb.dwarf2/comp-unit-lang.exp: Same.
+       * gdb.dwarf2/cpp-linkage-name.exp: Same.
+       * gdb.dwarf2/dw2-bad-mips-linkage-name.exp: Same.
+       * gdb.dwarf2/dw2-lexical-block-bare.exp: Same.
+       * gdb.dwarf2/dw2-regno-invalid.exp: Same.
+       * gdb.dwarf2/implptr-64bit.exp: Same.
+       * gdb.dwarf2/imported-unit-abstract-const-value.exp: Same.
+       * gdb.dwarf2/imported-unit-runto-main.exp: Same.
+       * gdb.dwarf2/imported-unit.exp: Same.
+       * gdb.dwarf2/main-subprogram.exp: Same.
+       * gdb.dwarf2/missing-type-name.exp: Same.
+       * gdb.dwarf2/nonvar-access.exp: Same.
+       * gdb.dwarf2/struct-with-sig.exp: Same.
+       * gdb.dwarf2/typedef-void-finish.exp: Same.
+       * gdb.dwarf2/void-type.exp: Same.
+
 2020-07-17  Tom de Vries  <tdevries@suse.de>
 
        * lib/dwarf.exp (Dwarf::MACRO_AT_func, Dwarf::MACRO_AT_range): Drop
index 1c2e08c5dfb0cf24c82d921e15274be495221f17..d2e55d1512c478ebec332aa9a8aac16c28645491 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-asm ("circular1_found_start: .globl circular1_found_start");
-
 /* DWARF will describe this function as being inside a D module.  */
 
 void
 found (void)
 {
+  asm ("found_label: .globl found_label");
 }
 
-asm ("circular1_found_end: .globl circular1_found_end");
-
 int
 main (void)
 {
index 1e04370478a01ff437c9b65f8538ee794f54a4f1..a34cc83099d2288db70e8191298e5a8ec2ff3d4e 100644 (file)
@@ -54,10 +54,8 @@ Dwarf::assemble $asm_file {
                }
 
                subprogram {
-                   {name found}
                    {external 1 flag_present}
-                   {low_pc circular1_found_start addr}
-                   {high_pc circular1_found_end addr}
+                   {MACRO_AT_func {found}}
                }
            }
 
index d823fac3c26b8c8b80f89ad09ac0246d2c35a254..c10a592df744cf672656096f8081eb6cccc8692c 100644 (file)
@@ -31,12 +31,6 @@ set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
     global srcdir subdir srcfile
 
-    lassign [function_range first ${srcdir}/${subdir}/${srcfile}] \
-       first_start first_length
-
-    lassign [function_range second ${srcdir}/${subdir}/${srcfile}] \
-       second_start second_length
-
     cu {} {
        DW_TAG_compile_unit {
                 {DW_AT_language @DW_LANG_Ada95}
@@ -55,16 +49,14 @@ Dwarf::assemble $asm_file {
             DW_TAG_subprogram {
                 {name system__namefirst}
                {linkage_name __gnat_namefirst}
-                {low_pc $first_start addr}
-                {high_pc "$first_start + $first_length" addr}
+               {MACRO_AT_range {first}}
                 {type :$b_l}
            }
            # Here the linkage name comes first and the name second.
             DW_TAG_subprogram {
                {linkage_name __gnat_namesecond}
                 {name system__namesecond}
-                {low_pc $second_start addr}
-                {high_pc "$second_start + $second_length" addr}
+                {MACRO_AT_range {second}}
                 {type :$b_l}
            }
        }
index 01087518a8918892e67ec4415336a4b0924bd5a4..9bfe1d627f24405f386d5c231dc6dcba6dd15905 100644 (file)
@@ -16,5 +16,6 @@
 int
 main (void)
 {
+  asm ("main_label: .globl main_label");
   return 0;
 }
index f79b65946303f2dbd9fe46ad148d8a38029fe357..4e355ff5c164c9aee9604cfeff9380fc20424309 100644 (file)
@@ -29,8 +29,7 @@ Dwarf::assemble $asm_file {
                 {DW_AT_language @DW_LANG_Ada95}
                 {DW_AT_name     foo.adb}
                 {DW_AT_comp_dir /tmp}
-                {DW_AT_low_pc   0x1000 addr}
-                {DW_AT_high_pc  0x2000 addr}
+               {MACRO_AT_range {main}}
             } {
            declare_labels boolean_label typedef_label array_label enum_label
 
index 689924c74803b28b5a5dfba2ddd5b6e0a882bcee..9a44686f438df0784e47ef306cfdb618e8c959b5 100644 (file)
@@ -25,12 +25,6 @@ standard_testfile atomic.c atomic-type-dw.S
 
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    set f_result [function_range f ${srcdir}/${subdir}/${srcfile}]
-    set f_start [lindex $f_result 0]
-    set f_length [lindex $f_result 1]
-
     cu {} {
        DW_TAG_compile_unit {
                 {DW_AT_language @DW_LANG_C11}
@@ -73,9 +67,7 @@ Dwarf::assemble $asm_file {
             }
 
             DW_TAG_subprogram {
-                {name f}
-                {low_pc $f_start addr}
-                {high_pc "$f_start + $f_length" addr}
+                {MACRO_AT_func {f}}
                 {type :$i_l}
             } {
                 DW_TAG_formal_parameter {
index fa6f8fe9c8cb21c6eda233335f1a4b7329ca5bf6..4bd33464d2d60f712e124fc3e77615a98cf57113 100644 (file)
 
 asm (".section \".text\"");
 asm (".balign 8");
-asm ("func_start: .globl func_start");
 
 static void
 func (void)
 {
+  asm ("func_label: .globl func_label");
 }
 
-asm ("func_end: .globl func_end");
-
 int
 main (void)
 {
index 2ebe6caedc3bc1a166acc9e65eeb31d2753a5853..162848be941de95941878f310919d158ec559880 100644 (file)
@@ -45,14 +45,11 @@ proc do_test {cu_lang gdb_lang} {
            compile_unit {
                {name file1.txt}
                {language @$cu_lang}
-               {low_pc func_start addr}
-               {high_pc func_end addr}
+               {MACRO_AT_range {func}}
            } {
                subprogram {
                    {external 1 flag}
-                   {name func}
-                   {low_pc func_start addr}
-                   {high_pc func_end addr}
+                   {MACRO_AT_func {func}}
                } {
                }
            }
index 414b43a7dd990370f1aea46e771ebb69df06048e..7ff49380292b870b5c53262204f21323a88bedbb 100644 (file)
@@ -30,11 +30,6 @@ standard_testfile cpp-linkage-name.c cpp-linkage-name-debug.S
 # Set up the DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    lassign [function_range main ${srcdir}/${subdir}/${srcfile}] \
-       main_start main_length
-
     cu {} {
        DW_TAG_compile_unit {
            {DW_AT_language @DW_LANG_C_plus_plus}
@@ -70,9 +65,7 @@ Dwarf::assemble $asm_file {
                }
            }
            DW_TAG_subprogram {
-               {name "main"}
-               {low_pc $main_start addr}
-               {high_pc "$main_start + $main_length" addr}
+               {MACRO_AT_func {main}}
                {type :$a_l}
            }
            DW_TAG_variable {
index 5f01c41aaa325d089028303ff56fdfd391adcc04..986de0c526dbfc543f6f234924237e2d0174c5bd 100644 (file)
@@ -26,16 +26,6 @@ standard_testfile dw2-bad-mips-linkage-name.c dw2-bad-mips-linkage-name.S
 
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    set f_result [function_range f ${srcdir}/${subdir}/${srcfile}]
-    set f_start [lindex $f_result 0]
-    set f_length [lindex $f_result 1]
-
-    set g_result [function_range g ${srcdir}/${subdir}/${srcfile}]
-    set g_start [lindex $g_result 0]
-    set g_length [lindex $g_result 1]
-
     cu {} {
        DW_TAG_compile_unit {
                 {DW_AT_language @DW_LANG_C_plus_plus}
@@ -51,16 +41,12 @@ Dwarf::assemble $asm_file {
                {DW_AT_name      bool}
            }
             DW_TAG_subprogram {
-                {name f}
-                {low_pc $f_start addr}
-                {high_pc "$f_start + $f_length" addr}
+                {MACRO_AT_func {f}}
                 {type :$b_l}
                {DW_AT_MIPS_linkage_name _Z1fv}
            }
             DW_TAG_subprogram {
-                {name g}
-                {low_pc $g_start addr}
-                {high_pc "$g_start + $g_length" addr}
+                {MACRO_AT_func {g}}
                 {type :$b_l}
                {DW_AT_MIPS_linkage_name 42 DW_FORM_data1}
            }
index 8844058340af4b2a5764e74632c3c94c783d0627..161100d1fcdd831ed32525e4b51b63b65ffded01 100644 (file)
@@ -19,21 +19,14 @@ if {![dwarf2_support]} {
     return 0
 }
 
-standard_testfile .S main.c
+standard_testfile main.c .S
 
 # Make some DWARF for the test.
-set asm_file [standard_output_file $srcfile]
+set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile2
-
-    set main_result [function_range main ${srcdir}/${subdir}/${srcfile2}]
-    set main_start [lindex $main_result 0]
-    set main_length [lindex $main_result 1]
-
     cu {} {
        compile_unit {
-           {low_pc $main_start addr}
-           {high_pc "$main_start + $main_length" addr}
+           {MACRO_AT_range {main}}
        } {
            declare_labels integer_label
 
@@ -44,10 +37,8 @@ Dwarf::assemble $asm_file {
            }
 
            DW_TAG_subprogram {
-               {name main}
+               {MACRO_AT_func {main}}
                {DW_AT_external 1 flag}
-               {low_pc $main_start addr}
-               {high_pc "$main_start + $main_length" addr}
            } {
                DW_TAG_lexical_block {
                } {
@@ -66,7 +57,7 @@ Dwarf::assemble $asm_file {
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} \
-                         [list $srcfile2 $asm_file] {nodebug}] } {
+                         [list $srcfile $asm_file] {nodebug}] } {
     return -1
 }
 
index 62d29ea4682edbf3944133782455dbe3c6e3a446..b8a67dbd4343ddf6981a76416fbeef88f2e8bce1 100644 (file)
@@ -22,15 +22,14 @@ if {![dwarf2_support]} {
     return 0
 }
 
-standard_testfile .S main.c
+standard_testfile main.c .S
 
 # Make some DWARF for the test.
-set asm_file [standard_output_file $srcfile]
+set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
     cu {} {
        compile_unit {
-           {low_pc [gdb_target_symbol main] DW_FORM_addr}
-           {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
+           {MACRO_AT_range {main}}
        } {
            declare_labels integer_label
 
@@ -41,10 +40,8 @@ Dwarf::assemble $asm_file {
            }
 
            DW_TAG_subprogram {
-               {name main}
                {DW_AT_external 1 flag}
-               {low_pc [gdb_target_symbol main] DW_FORM_addr}
-               {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
+               {MACRO_AT_func {main}}
            } {
                DW_TAG_variable {
                    {DW_AT_name bregx}
@@ -60,7 +57,7 @@ Dwarf::assemble $asm_file {
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} \
-                         [list $srcfile2 $asm_file] {nodebug}] } {
+                         [list $srcfile $asm_file] {nodebug}] } {
     return -1
 }
 
index 71f51bb87d2fcd394c8ed722cadd474f8e21970a..a75d4436306448ecdf0cd5fd81cf658a62b644be 100644 (file)
@@ -81,9 +81,7 @@ proc test { dwarf_version offset_size addr_size ref_addr_size two_cu } {
 
                if { !$two_cu } {
                    subprogram {
-                       { name main }
-                       { low_pc main addr }
-                       { high_pc "main+0x100" addr }
+                       {MACRO_AT_func {main}}
                        { type :$int_label }
                        { external 1 flag }
                    } {
@@ -111,9 +109,7 @@ proc test { dwarf_version offset_size addr_size ref_addr_size two_cu } {
                    { name 1.c }
                } {
                    subprogram {
-                       { name main }
-                       { low_pc main addr }
-                       { high_pc "main+0x100" addr }
+                       { MACRO_AT_func {main} }
                        { type %$int_label }
                        { external 1 flag }
                    } {
index 13a7e97cc56376f6dc932e616a59abc6c46bee2f..363305170ec9883fec8ae45604fda06ac86b90a7 100644 (file)
@@ -40,12 +40,6 @@ Dwarf::assemble $asm_file {
     declare_labels aaa_label
     set int_size [get_sizeof "int" 4]
 
-    global srcdir subdir srcfile
-
-    set main_range [function_range main ${srcdir}/${subdir}/${srcfile}]
-    set main_start [lindex $main_range 0]
-    set main_length [lindex $main_range 1]
-
     cu {} {
        cu_label: partial_unit {
            {language @DW_LANG_C}
@@ -81,8 +75,7 @@ Dwarf::assemble $asm_file {
            }
            subprogram {
                {abstract_origin %$main_label}
-               {low_pc $main_start addr}
-               {high_pc "$main_start + $main_length" addr}
+               {MACRO_AT_range {main}}
            }
        }
     }
index 8a05ee852709023cb6995dd267910661ba646d79..a35c12e441d7acf417721d4d0e782368da13a26b 100644 (file)
@@ -37,12 +37,6 @@ Dwarf::assemble $asm_file {
     declare_labels aaa_label
     set int_size [get_sizeof "int" 4]
 
-    global srcdir subdir srcfile
-
-    set main_range [function_range main ${srcdir}/${subdir}/${srcfile}]
-    set main_start [lindex $main_range 0]
-    set main_length [lindex $main_range 1]
-
     cu {} {
        cu_label: partial_unit {
            {language @DW_LANG_C}
@@ -69,8 +63,7 @@ Dwarf::assemble $asm_file {
        } {
            subprogram {
                {abstract_origin %$main_label}
-               {low_pc $main_start addr}
-               {high_pc "$main_start + $main_length" addr}
+               {MACRO_AT_range {main}}
            }
        }
     }
index dba87ffcb2cf3a8dc9ea4456cfc5e9c2228764fe..0e65276a020dda0740416426bef944087d5e6f37 100644 (file)
@@ -54,16 +54,6 @@ Dwarf::assemble $asm_file {
     set int_size [get_sizeof "int" 4]
     set addr_size [get_sizeof "void *" 8]
 
-    global srcdir subdir srcfile
-
-    set main_range [function_range main ${srcdir}/${subdir}/${srcfile}]
-    set main_start [lindex $main_range 0]
-    set main_length [lindex $main_range 1]
-
-    set doit_range [function_range doit ${srcdir}/${subdir}/${srcfile}]
-    set doit_start [lindex $doit_range 0]
-    set doit_length [lindex $doit_range 1]
-
     cu {} {
        compile_unit {
            {language @DW_LANG_C_plus_plus}
@@ -74,13 +64,11 @@ Dwarf::assemble $asm_file {
            }
            subprogram {
                {abstract_origin %$main_label}
-               {low_pc $main_start addr}
-               {high_pc "$main_start + $main_length" addr}
+               {MACRO_AT_range {main}}
            } {
                subprogram {
                    {abstract_origin %$doit_label}
-                   {low_pc $doit_start addr}
-                   {high_pc "$doit_start + $doit_length" addr}
+                   {MACRO_AT_range {doit}}
                } {
                    formal_parameter {
                        {abstract_origin %$doit_self_label}
index 15a67bada64aa78cd5c3c8b886c220aaf91f1cae..b0924c8096df4dbf4f38559b1105de9eb3d75423 100644 (file)
@@ -24,12 +24,6 @@ standard_testfile main-subprogram.c enum-type-dw.S
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    set range [function_range mymain ${srcdir}/${subdir}/${srcfile}]
-    set mymain_start [lindex $range 0]
-    set mymain_length [lindex $range 1]
-
     cu {} {
        DW_TAG_compile_unit {
                 {DW_AT_language @DW_LANG_C}
@@ -45,9 +39,7 @@ Dwarf::assemble $asm_file {
             }
 
            DW_TAG_subprogram {
-               {name mymain}
-               {low_pc $mymain_start addr}
-                {high_pc "$mymain_start + $mymain_length" addr}
+               {MACRO_AT_func {mymain}}
                {type :$type}
                {DW_AT_main_subprogram 1 flag}
            } {
index 3ee1e335bb8d11a052c2a1d08e72a916e7141945..920b67a7cb740ae3f20aecc95351e7357b3f5070 100644 (file)
@@ -42,16 +42,6 @@ standard_testfile void-type.c void-type.S
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    set func_result [function_range func ${srcdir}/${subdir}/${srcfile}]
-    set func_start [lindex $func_result 0]
-    set func_length [lindex $func_result 1]
-
-    set main_result [function_range main ${srcdir}/${subdir}/${srcfile}]
-    set main_start [lindex $main_result 0]
-    set main_length [lindex $main_result 1]
-
     cu {} {
        DW_TAG_compile_unit {
                {DW_AT_producer "GNU C 8.1"}
@@ -76,15 +66,11 @@ Dwarf::assemble $asm_file {
            }
 
             DW_TAG_subprogram {
-                {name func}
-                {low_pc $func_start addr}
-                {high_pc "$func_start + $func_length" addr}
+                {MACRO_AT_func func}
                 {type :$int_type}
            }
             DW_TAG_subprogram {
-                {name main}
-                {low_pc $main_start addr}
-                {high_pc "$main_start + $main_length" addr}
+                {MACRO_AT_func main}
                 {type :$main_type}
            }
 
index a3705f9514feab036ef391aefb1c3311cebd04c2..93174657bbe4b0f3d388751c93d6bf138f8a673c 100644 (file)
@@ -27,12 +27,6 @@ standard_testfile main.c nonvar-access-dw.S
 set asm_file [standard_output_file $srcfile2]
 
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    set range [function_range main ${srcdir}/${subdir}/${srcfile}]
-    set main_start [lindex $range 0]
-    set main_length [lindex $range 1]
-
     cu {} {
        compile_unit {
            {DW_AT_name main.c}
@@ -101,10 +95,8 @@ Dwarf::assemble $asm_file {
            }
 
            DW_TAG_subprogram {
-               {name main}
+               {MACRO_AT_func {main}}
                {DW_AT_external 1 flag}
-               {low_pc [gdb_target_symbol main] DW_FORM_addr}
-               {high_pc "$main_start + $main_length" DW_FORM_addr}
            } {
                # Simple variable without location.
                DW_TAG_variable {
index 1ce013dfea60be0b22c1b2047c3dda3bcff12122..c8be804e53b73013d95c05d00ad3a0752a0a8233 100644 (file)
@@ -24,14 +24,6 @@ standard_testfile main-foo.c .S
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    lassign [function_range main ${srcdir}/${subdir}/${srcfile}] \
-       main_start main_length
-
-    lassign [function_range foo ${srcdir}/${subdir}/${srcfile}] \
-       foo_start foo_length
-
     cu {} {
        compile_unit {
            {DW_AT_language @DW_LANG_C}
@@ -43,9 +35,7 @@ Dwarf::assemble $asm_file {
                {declaration 1 flag}
            }
            DW_TAG_subprogram {
-               {name "main"}
-               {low_pc $main_start addr}
-               {high_pc "$main_start + $main_length" addr}
+               {MACRO_AT_func {main}}
            }
        }
     }
@@ -61,9 +51,7 @@ Dwarf::assemble $asm_file {
                {declaration 1 flag}
            }
            DW_TAG_subprogram {
-               {name "foo"}
-               {low_pc $foo_start addr}
-               {high_pc "$foo_start + $foo_length" addr}
+               {MACRO_AT_func {foo}}
            }
        }
     }
index 1505532f686fec5f48b72f9544723042cb35d532..e2b95adefe768f8aeb83ef88d6929fbf76d60b54 100644 (file)
@@ -29,16 +29,6 @@ standard_testfile void-type.c typedef-void-finish.S
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    set func_result [function_range func ${srcdir}/${subdir}/${srcfile}]
-    set func_start [lindex $func_result 0]
-    set func_length [lindex $func_result 1]
-
-    set main_result [function_range main ${srcdir}/${subdir}/${srcfile}]
-    set main_start [lindex $main_result 0]
-    set main_length [lindex $main_result 1]
-
     cu {} {
        DW_TAG_compile_unit {
                {DW_AT_producer "GNU C 8.1"}
@@ -58,15 +48,11 @@ Dwarf::assemble $asm_file {
            }
 
             DW_TAG_subprogram {
-                {name func}
-                {low_pc $func_start addr}
-                {high_pc "$func_start + $func_length" addr}
+                {MACRO_AT_func {func}}
                 {type :$void_typedef}
            }
             DW_TAG_subprogram {
-                {name main}
-                {low_pc $main_start addr}
-                {high_pc "$main_start + $main_length" addr}
+                {MACRO_AT_func {main}}
                 {type :$main_type}
            }
        }
index 8bc44cdbe6fbb8609ad5f31d9fea33c1f734d212..4ae00c3d256828d13d3b94ccc888da80f33737f0 100644 (file)
@@ -36,16 +36,6 @@ standard_testfile void-type.c void-type.S
 # Make some DWARF for the test.
 set asm_file [standard_output_file $srcfile2]
 Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-
-    set func_result [function_range func ${srcdir}/${subdir}/${srcfile}]
-    set func_start [lindex $func_result 0]
-    set func_length [lindex $func_result 1]
-
-    set main_result [function_range main ${srcdir}/${subdir}/${srcfile}]
-    set main_start [lindex $main_result 0]
-    set main_length [lindex $main_result 1]
-
     cu {} {
        DW_TAG_compile_unit {
                {DW_AT_producer "Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.5.212 Build 20150212"}
@@ -72,15 +62,11 @@ Dwarf::assemble $asm_file {
            }
 
             DW_TAG_subprogram {
-                {name func}
-                {low_pc $func_start addr}
-                {high_pc "$func_start + $func_length" addr}
+               {MACRO_AT_func {func}}
                 {type :$void_type}
            }
             DW_TAG_subprogram {
-                {name main}
-                {low_pc $main_start addr}
-                {high_pc "$main_start + $main_length" addr}
+               {MACRO_AT_func {main}}
                 {type :$int_type}
            }