aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhuvanendra Kumar N <Bhuvanendra.KumarN@amd.com>2021-10-05 13:10:16 +0200
committerTom de Vries <tdevries@suse.de>2021-10-05 13:10:16 +0200
commita5ea23036d8a85d2ef133458a4c54a339857c152 (patch)
tree74fbc63e0edb067f2869caaf12a5882131cb415a
parentb1f0f2841871f407d116e3e7f0dfca3e410633d4 (diff)
downloadgdb-a5ea23036d8a85d2ef133458a4c54a339857c152.zip
gdb-a5ea23036d8a85d2ef133458a4c54a339857c152.tar.gz
gdb-a5ea23036d8a85d2ef133458a4c54a339857c152.tar.bz2
[gdb/testsuite] Use function_range in gdb.dwarf2/dw2-ref-missing-frame.exp
Following 2 test points are failing with clang compiler (gdb) FAIL: gdb.dwarf2/dw2-ref-missing-frame.exp: func_nofb print (gdb) FAIL: gdb.dwarf2/dw2-ref-missing-frame.exp: func_loopfb print As in commit f677852bbda "[gdb/testsuite] Use function_range in gdb.dwarf2/dw2-abs-hi-pc.exp", the problem is that the CU and functions have an empty address range, due to using asm labels in global scope, which is a known source of problems, as explained in the comment of proc function_range in gdb/testsuite/lib/dwarf.exp. Hence fix this also by using function_range. Tested on x86_64-linux with gcc and clang.
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c22
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp23
3 files changed, 25 insertions, 32 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
index 1ec1897..90772d6 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
@@ -15,34 +15,16 @@
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 (".globl cu_text_start");
-asm ("cu_text_start:");
-
-asm (".globl func_nofb_start");
-asm (".p2align 4");
-asm ("func_nofb_start:");
-
void
func_nofb (void)
{
+asm ("func_nofb_label: .globl func_nofb_label\n");
/* int func_nofb_var; */
}
-asm (".globl func_nofb_end");
-asm ("func_nofb_end:");
-
-asm (".globl func_loopfb_start");
-asm (".p2align 4");
-asm ("func_loopfb_start:");
-
void
func_loopfb (void)
{
+asm ("func_loopfb_label: .globl func_loopfb_label\n");
/* int func_loopfb_var; */
}
-
-asm (".globl func_loopfb_end");
-asm ("func_loopfb_end:");
-
-asm (".globl cu_text_end");
-asm ("cu_text_end:");
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S
index a64f03b..293eb0e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S
@@ -28,8 +28,8 @@
/* CU die */
.uleb128 1 /* Abbrev: DW_TAG_compile_unit */
- .4byte cu_text_end /* DW_AT_high_pc */
- .4byte cu_text_start /* DW_AT_low_pc */
+ .4byte FUNC_LOOPFB_END /* DW_AT_high_pc */
+ .4byte FUNC_NOFB_START /* DW_AT_low_pc */
.ascii "file1.txt\0" /* DW_AT_name */
.ascii "GNU C 3.3.3\0" /* DW_AT_producer */
.byte 1 /* DW_AT_language (C) */
@@ -43,8 +43,8 @@
/* func_nofb */
.uleb128 5 /* Abbrev: DW_TAG_subprogram (no fb) */
.ascii "func_nofb\0" /* DW_AT_name */
- .4byte func_nofb_start /* DW_AT_low_pc */
- .4byte func_nofb_end /* DW_AT_high_pc */
+ .4byte FUNC_NOFB_START /* DW_AT_low_pc */
+ .4byte FUNC_NOFB_END /* DW_AT_high_pc */
.uleb128 7 /* Abbrev: DW_TAG_variable (location) */
.ascii "func_nofb_var\0" /* DW_AT_name */
@@ -58,8 +58,8 @@
/* func_loopfb */
.uleb128 6 /* Abbrev: DW_TAG_subprogram (loop fb) */
.ascii "func_loopfb\0" /* DW_AT_name */
- .4byte func_loopfb_start /* DW_AT_low_pc */
- .4byte func_loopfb_end /* DW_AT_high_pc */
+ .4byte FUNC_LOOPFB_START /* DW_AT_low_pc */
+ .4byte FUNC_LOOPFB_END /* DW_AT_high_pc */
.byte 2f - 1f /* DW_AT_frame_base */
1: .byte 0x91 /* DW_OP_fbreg */
.sleb128 0 /* 0 */
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
index 1b87144..e8d7c0f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
@@ -19,14 +19,25 @@ if {![dwarf2_support]} {
return 0
}
-standard_testfile .S
-set srcfuncfile ${testfile}-func.c
-set srcmainfile ${testfile}-main.c
+standard_testfile .S -func.c -main.c
+lassign [function_range func_nofb \
+ "${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}"] \
+ func_nofb_start func_nofb_len
+lassign [function_range func_loopfb \
+ "${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}"] \
+ func_loopfb_start func_loopfb_len
+
+set flags \
+ [list \
+ "debug" \
+ "additional_flags=\"-DFUNC_NOFB_START=$func_nofb_start\"" \
+ "additional_flags=\"-DFUNC_NOFB_END=$func_nofb_start + $func_nofb_len\"" \
+ "additional_flags=\"-DFUNC_LOOPFB_START=$func_loopfb_start\"" \
+ "additional_flags=\"-DFUNC_LOOPFB_END=$func_loopfb_start + $func_loopfb_len\""]
set executable ${testfile}
-if {[prepare_for_testing_full "failed to prepare" \
- [list $testfile {} $srcfile {} $srcfuncfile {} \
- $srcmainfile debug]]} {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ [list $srcfile3 $srcfile $srcfile2] $flags] == -1} {
return -1
}