[PATCH v3 04/14] change gdb.base/nodebug.c to not fail with clang
Bruno Larsen
blarsen@redhat.com
Thu May 26 15:10:31 GMT 2022
Clang organizes the variables differently to gcc in the original version
of this code, leading to the following differences when testing
p (int*) &dataglobal + 1
gcc:
$16 = (int *) 0x404034 <datalocal>
clang:
$16 = (int *) 0x404034 <dataglobal8>
The code change to nodebug.c makes it so gcc and clang will place the
same variable under dataglobal8, generating the same output.
---
No change in v3.
No change in v2.
---
gdb/testsuite/gdb.base/nodebug.c | 2 +-
gdb/testsuite/gdb.base/nodebug.exp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/nodebug.c b/gdb/testsuite/gdb.base/nodebug.c
index c7bc93991b8..572255697bb 100644
--- a/gdb/testsuite/gdb.base/nodebug.c
+++ b/gdb/testsuite/gdb.base/nodebug.c
@@ -3,8 +3,8 @@
/* Test that things still (sort of) work when compiled without -g. */
-int dataglobal = 3; /* Should go in global data */
static int datalocal = 4; /* Should go in local data */
+int dataglobal = 3; /* Should go in global data */
int bssglobal; /* Should go in global bss */
static int bsslocal; /* Should go in local bss */
diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
index 0dbd0ad153e..fbff6ecb395 100644
--- a/gdb/testsuite/gdb.base/nodebug.exp
+++ b/gdb/testsuite/gdb.base/nodebug.exp
@@ -187,7 +187,7 @@ if [nodebug_runto inner] then {
{"dataglobal + 1" "" $dataglobal_unk_re $dataglobal_unk_re}
{"&dataglobal" "" "\\($data_var_type \\*\\) $hex <dataglobal>" " = $data_var_type \\*"}
{"&dataglobal + 1" "" $ptr_math_re $ptr_math_re}
- {"(int *) &dataglobal + 1" "" " = \\(int \\*\\) $hex <datalocal>" "int \\*"}
+ {"(int *) &dataglobal + 1" "" " = \\(int \\*\\) $hex <dataglobal8>" "int \\*"}
{"&(int) dataglobal + 1" "" $not_mem_re $not_mem_re}
{"&dataglobal, &dataglobal" "" "\\($data_var_type \\*\\) $hex <dataglobal>" " = $data_var_type \\*"}
{"*dataglobal" "" $dataglobal_unk_re $dataglobal_unk_re}
--
2.31.1
More information about the Gdb-patches
mailing list