[testsuite patch] [ppc64] +kfail: gdb_target_symbol does not support function descriptors

Jan Kratochvil
2016-07-05T14:55:10Z

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

Hi,

Marin Cermak has found various testcases (or one of them) of GDB FAIL on
ppc64.

https://sourceware.org/bugzilla/show_bug.cgi?id=20328
# powerpc64-unknown-linux-gnu:
# FAIL: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype f
# FAIL: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype g
# FAIL: gdb.dwarf2/dw2-lexical-block-bare.exp: p testvar
# FAIL: gdb.dwarf2/atomic-type.exp: ptype f
#
# but:
# powerpc64le-unknown-linux-gnu does PASS them (ppc64le does not use function
# descriptors anymore)

I do not see how to really fix it, DWARF needs to contain PC addresses, not
function descriptor addresses. But .o contains only the function descriptor
address.

The DWARF as produced by Tcl Dwarf::assemble:
<1><27>: Abbrev Number: 4 (DW_TAG_subprogram)
<28> DW_AT_name : main
<2d> DW_AT_external : 1
<2e> DW_AT_low_pc : 0x1001ff98
<36> DW_AT_high_pc : 0x1002ff98
<2><3e>: Abbrev Number: 5 (DW_TAG_lexical_block)

Runtime info:
$2 = {<text variable, no debug info>} 0x10000674 <.main>
$3 = {void ()} 0x1001ff98

I haven't tried to use for DW_AT_low_pc (normally using DW_FORM_addr) to use
DW_FORM_block* with DW_OP_deref as IIRC that is unsupported by GDB's
dwarf2read.c et al.; if anyone thinks it could work I can try that.

Also I am not sure whether "powerpc64-*linux*" really catches all and only all
function descriptor platforms.

OK for check-in?

Jan

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 1863 bytes --]

gdb/testsuite/ChangeLog
2016-07-05 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.dwarf2/atomic-type.exp (ptype f): Add kfail testsuite/20328.
* gdb.dwarf2/dw2-bad-mips-linkage-name.exp (ptype f, ptype g): Likewise.
* gdb.dwarf2/dw2-lexical-block-bare.exp (p testvar): Likewise.

diff --git a/gdb/testsuite/gdb.dwarf2/atomic-type.exp b/gdb/testsuite/gdb.dwarf2/atomic-type.exp
index 7b35cad..f6557e5 100644
--- a/gdb/testsuite/gdb.dwarf2/atomic-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/atomic-type.exp
@@ -86,4 +86,5 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
return -1
}

+setup_kfail "powerpc64-*linux*" "testsuite/20328"
gdb_test "ptype f" "int \\(const _Atomic char \\\* volatile _Atomic\\)"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
index b1041fa..24cba04 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
@@ -68,5 +68,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
# much matter what we test here, so long as we do something to make
# sure that the DWARF is read.

+setup_kfail "powerpc64-*linux*" "testsuite/20328"
gdb_test "ptype f" " = bool \\(\\)"
+setup_kfail "powerpc64-*linux*" "testsuite/20328"
gdb_test "ptype g" " = bool \\(\\)"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp b/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
index 3f9411e..1c8f868 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
@@ -67,4 +67,5 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \
runto_main

# FAILing GDB did print: No symbol "testvar" in current context.
+setup_kfail "powerpc64-*linux*" "testsuite/20328"
gdb_test "p testvar" { = -?[0-9]+}