This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Re: "optimized out" on gdb.base/gdb1090.exp
- From: Edjunior Barbosa Machado <emachado at linux dot vnet dot ibm dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Yao Qi <yao at codesourcery dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 12 Apr 2011 18:21:48 -0300
- Subject: [patch] Re: "optimized out" on gdb.base/gdb1090.exp
- References: <4DA3A7D0.2000701@linux.vnet.ibm.com> <4DA3B701.3060902@codesourcery.com> <4DA4573D.1040101@linux.vnet.ibm.com> <20110412160220.GA18580@host1.jankratochvil.net>
Thanks Jan for reviewing this. This is the updated patch with the suggested modifications.
Checking out the original PR 1090 that originated this testcase, it doesn't mention any particularity regarding frame or backtrace, which leads me to believe that changing where 'print' is called should not affect the main focus of the testcase.
Thanks,
--
Edjunior
2011-04-12 Edjunior Machado <emachado@br.ibm.com>
* testsuite/gdb.base/gdb1090.exp: change breakpoint location to read the
content of 's24' correctly (avoiding "optimized out").
* testsuite/gdb.base/gdb1090.c: add comment in order to set breakpoint.
diff --git a/gdb/testsuite/gdb.base/gdb1090.c b/gdb/testsuite/gdb.base/gdb1090.c
index 22f2cec..8933952 100644
--- a/gdb/testsuite/gdb.base/gdb1090.c
+++ b/gdb/testsuite/gdb.base/gdb1090.c
@@ -36,7 +36,7 @@ void foo ()
register struct s_2_by_4 s24;
s24.field_0 = 1170;
s24.field_1 = 64701;
- marker (s24);
+ marker (s24); /* break-here */
return;
}
diff --git a/gdb/testsuite/gdb.base/gdb1090.exp b/gdb/testsuite/gdb.base/gdb1090.exp
index a15fd04..ab568ab 100644
--- a/gdb/testsuite/gdb.base/gdb1090.exp
+++ b/gdb/testsuite/gdb.base/gdb1090.exp
@@ -40,11 +40,13 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-if ![runto marker] then {
- perror "couldn't run to breakpoint"
- continue
-}
-gdb_test "up" ".*foo.*" "up from marker"
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 1
+}
+
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "break-here" ".* break-here .*"
gdb_test_multiple "print s24" "print s24" {
-re "\\\$\[0-9\]* = \\{field_0 = 1170, field_1 = 64701\\}\r\n$gdb_prompt $" {