diff options
author | Yao Qi <yao@codesourcery.com> | 2014-08-30 21:30:36 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-10-14 19:42:51 +0800 |
commit | 4dc06805c2fa208dc2743099feaacb4230d1b1f7 (patch) | |
tree | d6b466d1769e97a36ee6b4dc5903ab32361e6d99 /gdb/testsuite/gdb.mi/mi-var-child.c | |
parent | 46a93de2ab256dd2cb4e1845a93d9d1ae07b2475 (diff) | |
download | binutils-gdb-4dc06805c2fa208dc2743099feaacb4230d1b1f7.tar.gz |
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.
Diffstat (limited to 'gdb/testsuite/gdb.mi/mi-var-child.c')
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-var-child.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-var-child.c b/gdb/testsuite/gdb.mi/mi-var-child.c index bde668edc87..689fe553789 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.c +++ b/gdb/testsuite/gdb.mi/mi-var-child.c @@ -160,6 +160,20 @@ nothing () { } +struct _struct_decl +nothing1 (int a, char *b, long c) +{ + struct _struct_decl foo; + + return foo; +} + +struct _struct_decl * +nothing2 (int a, char *b, long c) +{ + return (struct _struct_decl *) 0; +} + void subroutine1 (int i, long *l) { @@ -231,6 +245,8 @@ do_children_tests (void) struct_declarations.long_array[9] = 1234; weird->func_ptr = nothing; + weird->func_ptr_struct = nothing1; + weird->func_ptr_ptr = nothing2; struct_declarations.long_array[10] = 3456; struct_declarations.long_array[11] = 5678; |