[3/3] Run dw2-var-zero-addr.exp with --readnow

Message ID 1408609338-17561-3-git-send-email-yao@codesourcery.com
State New, archived
Headers

Commit Message

Yao Qi Aug. 21, 2014, 8:22 a.m. UTC
  This patch is to extend dw2-var-zero-add.exp to test the case that
partial symtabl is not used while full symtab is used, in order to
cover the changes in patch 2/3.  This patch restarts GDB with
--readnow and does the same test again.

gdb/testsuite:

2014-08-20  Yao Qi  <yao@codesourcery.com>

	* gdb.dwarf2/dw2-var-zero-addr.exp: Move test into new proc test.
	Invoke test.  Restart GDB with --readnow and invoke test again.
---
 gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
  

Comments

Doug Evans Aug. 22, 2014, 6:06 p.m. UTC | #1
Yao Qi writes:
 > This patch is to extend dw2-var-zero-add.exp to test the case that
 > partial symtabl is not used while full symtab is used, in order to
 > cover the changes in patch 2/3.  This patch restarts GDB with
 > --readnow and does the same test again.
 > 
 > gdb/testsuite:
 > 
 > 2014-08-20  Yao Qi  <yao@codesourcery.com>
 > 
 > 	* gdb.dwarf2/dw2-var-zero-addr.exp: Move test into new proc test.
 > 	Invoke test.  Restart GDB with --readnow and invoke test again.
 > ---
 >  gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp | 20 +++++++++++++++++---
 >  1 file changed, 17 insertions(+), 3 deletions(-)
 > 
 > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
 > index 462a5f8..5e1732b 100644
 > --- a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
 > +++ b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
 > @@ -26,6 +26,20 @@ if [prepare_for_testing ${testfile}.exp ${testfile} \
 >      return -1
 >  }
 >  
 > -# FAIL was: = (int *) 0x0
 > -# Such DIE record can be produced using: gcc -fdata-sections -Wl,-gc-sections
 > -gdb_test "print &var" {No symbol "var" in current context\.}
 > +proc test { } {
 > +    # FAIL was: = (int *) 0x0
 > +    # Such DIE record can be produced using: gcc -fdata-sections -Wl,-gc-sections
 > +    gdb_test "print &var" {No symbol "var" in current context\.}
 > +}
 > +
 > +test
 > +
 > +global GDBFLAGS

This global is unnecessary.
Otherwise the patch is fine by me.
[I kinda wonder whether the name "test" should be slightly more
descriptive, but I guess I'm ok with it as is.]

 > +set saved_gdbflags $GDBFLAGS
 > +set GDBFLAGS "$GDBFLAGS --readnow"
 > +clean_restart ${binfile}
 > +set GDBFLAGS $saved_gdbflags
 > +
 > +with_test_prefix "readnow" {
 > +    test
 > +}
  
Yao Qi Sept. 19, 2014, 9:05 a.m. UTC | #2
Doug Evans <dje@google.com> writes:

>  > +global GDBFLAGS
>
> This global is unnecessary.
> Otherwise the patch is fine by me.

It is removed from the updated patch.  Pushed in.
  

Patch

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
index 462a5f8..5e1732b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
@@ -26,6 +26,20 @@  if [prepare_for_testing ${testfile}.exp ${testfile} \
     return -1
 }
 
-# FAIL was: = (int *) 0x0
-# Such DIE record can be produced using: gcc -fdata-sections -Wl,-gc-sections
-gdb_test "print &var" {No symbol "var" in current context\.}
+proc test { } {
+    # FAIL was: = (int *) 0x0
+    # Such DIE record can be produced using: gcc -fdata-sections -Wl,-gc-sections
+    gdb_test "print &var" {No symbol "var" in current context\.}
+}
+
+test
+
+global GDBFLAGS
+set saved_gdbflags $GDBFLAGS
+set GDBFLAGS "$GDBFLAGS --readnow"
+clean_restart ${binfile}
+set GDBFLAGS $saved_gdbflags
+
+with_test_prefix "readnow" {
+    test
+}