Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: gdb@sources.redhat.com
Subject: Is gdb.c++/local.exp broken?
Date: Wed, 13 Nov 2002 13:12:00 -0000	[thread overview]
Message-ID: <vt2of8tp4s5.fsf@zenia.red-bean.com> (raw)


The recent change to dwarf2read.c:read_func_scope causes the following
known failure:

! FAIL: gdb.c++/local.exp: ptype Local (gdb/483)

to change to this unknown failure:

! FAIL: gdb.c++/local.exp: ptype Local

The bug in the database, gdb/483, is that the type Local gets printed
incorrectly.  But if you look at gdb/testsuite/gdb.c++/local.cc, the
type Local isn't even in scope at that point --- on line 59, after the
return of marker1.  I don't think it should be printed at all.  And in
fact, with the recent change to read_func_scope, that's what GDB does,
under Dwarf 2:

Breakpoint 2, marker1() () at /home/jimb/cygnus/src/sourceware/gdb/gdb_5_3/src/gdb/testsuite/gdb.c++/local.cc:5
5	}
(gdb) up
#1  0x08048438 in main () at /home/jimb/cygnus/src/sourceware/gdb/gdb_5_3/src/gdb/testsuite/gdb.c++/local.cc:59
59	   marker1();
(gdb) PASS: gdb.c++/local.exp: up from marker1
ptype Local
No symbol "Local" in current context.
(gdb) FAIL: gdb.c++/local.exp: ptype Local

I kind of think the test should actually try to print Local while
stopped in the function `foobar', and print InnerLocal while stopped
in main, and check that Local isn't defined.  That, however,
introduces a new failure in the STABS side, which still isn't scoping
Local correctly.

Is my understanding of this correct?  If I file a PR for the stabs
side of things, can I mark the STABS failure as a kfail, and commit
this change?

Index: gdb/testsuite/gdb.c++/local.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/local.cc,v
retrieving revision 1.2
diff -c -r1.2 local.cc
*** gdb/testsuite/gdb.c++/local.cc	10 Apr 2002 03:52:21 -0000	1.2
--- gdb/testsuite/gdb.c++/local.cc	13 Nov 2002 21:09:53 -0000
***************
*** 4,9 ****
--- 4,12 ----
  { 
  }
  
+ void marker2 (void)
+ {
+ }
    
  int foobar (int x)
  {
***************
*** 20,25 ****
--- 23,30 ----
    static Local l1;
    char  c;
  
+   marker1 ();
+ 
    l.loc1 = 23;
  
    c = l.loc_foo('x');
***************
*** 56,61 ****
  
     il.ilc = 'b';
     il.ip = &c;
!    marker1();
   }
  }
--- 61,66 ----
  
     il.ilc = 'b';
     il.ip = &c;
!    marker2();
   }
  }
Index: gdb/testsuite/gdb.c++/local.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/local.exp,v
retrieving revision 1.9
diff -c -r1.9 local.exp
*** gdb/testsuite/gdb.c++/local.exp	27 May 2002 18:00:14 -0000	1.9
--- gdb/testsuite/gdb.c++/local.exp	13 Nov 2002 21:09:53 -0000
***************
*** 67,73 ****
      continue
  }
  
! gdb_test "up" ".*main.*" "up from marker1"
  
  # Local classes in g++ get names like "main.1::InnerLocal", just like local
  # static variables.  Some targets use "___" instead of ".".
--- 67,73 ----
      continue
  }
  
! gdb_test "up" ".*foobar.*" "up from marker1"
  
  # Local classes in g++ get names like "main.1::InnerLocal", just like local
  # static variables.  Some targets use "___" instead of ".".
***************
*** 110,115 ****
--- 110,127 ----
    -re ".*$gdb_prompt $"   {  fail "ptype Local" }
    timeout             { fail "(timeout) ptype Local" }
  }
+ 
+ if ![runto 'marker2'] then {
+     perror "couldn't run to marker2"
+     continue
+ }
+ 
+ gdb_test "up" ".*main.*" "up from marker2"
+ 
+ # Make sure that `Local' isn't in scope here; it's local to foobar.
+ gdb_test "ptype Local" "No symbol \"Local\" in current context.*" \
+          "Local out of scope"
+ 
  
  # DTS CLLbs14316 and CLLbs17058
  # coulter - I added a clause for HP's aCC compiler.  We print out the type


             reply	other threads:[~2002-11-13 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-13 13:12 Jim Blandy [this message]
2002-11-13 13:23 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vt2of8tp4s5.fsf@zenia.red-bean.com \
    --to=jimb@redhat.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox