]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/gdb.mi/mi-var-display.exp
Fix fail in mi-var-child.exp and mi-var-display.exp
authorYao Qi <yao@codesourcery.com>
Sat, 30 Aug 2014 13:30:36 +0000 (21:30 +0800)
committerYao Qi <yao@codesourcery.com>
Tue, 14 Oct 2014 11:42:51 +0000 (19:42 +0800)
commit4dc06805c2fa208dc2743099feaacb4230d1b1f7
treed6b466d1769e97a36ee6b4dc5903ab32361e6d99
parent46a93de2ab256dd2cb4e1845a93d9d1ae07b2475
Fix fail in mi-var-child.exp and mi-var-display.exp

Hi,
I see the following fails on arm-none-eabi target,

-var-list-children --simple-values struct_declarations  ^M
^done,numchild="11",children=[...,child={name="struct_declarations.func_ptr_struct",exp="func_ptr_struct",numchild="0",value="0x0 <_ftext>",type="struct _struct_decl (*)(int, char *, long)",thread-id="1"},child={name="struct_declarations.func_ptr_ptr",exp="func_ptr_ptr",numchild="0",value="0x0 <_ftext>",type="struct _struct_decl *(*)(int, char *, long)",thread-id="1"},...
(gdb) ^M
FAIL: gdb.mi/mi-var-child.exp: listing of children, simple types: names, type and values, complex types: names and types

-var-set-format weird.func_ptr_ptr natural^M
^done,format="natural",value="0x0 <_ftext>"^M
(gdb) ^M
FAIL: gdb.mi/mi-var-display.exp: set format variable weird.func_ptr_ptr in natural

In the test, "0x0" is expected, but "0x0 <_ftext>" is in the output.
Function pointers point to address zero, and tests assume there is no
symbol on address zero.  However, on my arm-none-eabi target, there is
a code symbol _ftext on address zero, and test fails.  Note that "set
print symbol off" doesn't take effect for function pointer.

int (*f) (void);
f = main;

(gdb) p f
$1 = (int (*)(void)) 0x8048400 <main>
(gdb) set print symbol off
(gdb) p f
$2 = (int (*)(void)) 0x8048400 <main>

In order to erase the difference, we can assign some function address
explicitly to function pointer, so the test behaves in a unique way.
In this patch, we assign nothing1 and nothing2 to function pointers
func_ptr_struct and func_ptr_ptr respectively, and update test as the
source file is changed.

gdb/testsuite:

2014-10-14  Yao Qi  <yao@codesourcery.com>

* gdb.mi/mi-var-child.c (nothing1): New function.
(nothing2): New function.
(do_children_tests): Set function pointers by nothing1 and
nothing2.
* gdb.mi/mi-var-child.exp: Step over new added statements.
Update test to match the new output.
* gdb.mi/var-cmd.c (nothing1): New function.
(nothing2): New function.
(do_children_tests): Set function pointers by  nothing1 and
nothing2.
* gdb.mi/mi-var-display.exp: Update test to match output.
Step to the line specified by $line_dct_nothing.
Increase the number of lines to step.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.mi/mi-var-child.c
gdb/testsuite/gdb.mi/mi-var-child.exp
gdb/testsuite/gdb.mi/mi-var-display.exp
gdb/testsuite/gdb.mi/mi2-var-child.exp
gdb/testsuite/gdb.mi/var-cmd.c