Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: C++/Java regressions
@ 2003-11-26 22:48 Michael Elizabeth Chastain
  0 siblings, 0 replies; 26+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-26 22:48 UTC (permalink / raw)
  To: ian, mec.gnu; +Cc: drow, gdb

Hi Ian,

> I have probably lost the context of the question.  I am only talking
> about the case where DMGL_PARAMS is not passed.  In that case, the
> demangler will indeed print `Foo::method' for both of your examples.
> For that matter, it will also print `Foo::method' for `int method
> (int);'.

Ah, sorry, I am not providing enough context.

The context is this kind of message from gdb:

  (gdb) continue
  Continuing.

  Breakpoint 3, A::bar(int) const (this=0xbffff770, arg=15) at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.cp/method.cc:44

(This output is from the old demangler).

gdb wants to print a nice message showing the name of the function and
its arguments.  That's why gdb calls the demangler without DMGL_PARAMS
and then writes its own paramater list.  But then that raises the
question of where the "const" goes.

The delicate part is that gdb doesn't mind losing the params,
because gdb is going to print the params itself manually.  But I
do mind losing the "const" because gdb doesn't print its own "const".

> I think that is appropriate.  Without DMGL_PARAMS, you can't
> distinguish any Foo::method overloaded based on parameter types.  So
> it seems logical to me that you also shouldn't be able to distinguish
> overloading based on the method qualifier.  And that is how the V2
> demangler behaved when DMGL_PARAMS was not passed.
> 
> Does that make sense?

Totally.

I think the real issue is that us gdb folks need to sit down with some
use cases and figure out what we want to print in all situations.  Then
translate that down to requests for enhanced demangler API's.  But it's
lame of me to ask "can you tweak the demangler to produce one string
that co-incidentally looks nice for us".  In a case like the above, I
think gdb really wants some kind of structured return value, and then
gdb can assemble the pieces any way it wants.

For now, I will be happy if the new demangler has no regressions
compared to the old demangler.  And the new demangler already has
at least one bug fix shown by the gdb test suite.  We can come back
with our structured API request when we are ready.

Michael C


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: C++/Java regressions
@ 2003-11-26 21:44 Michael Elizabeth Chastain
  2003-11-26 22:21 ` Ian Lance Taylor
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-26 21:44 UTC (permalink / raw)
  To: drow, ian; +Cc: gdb

ian> Yes, I think it should print A::bar without the const.  I have the
ian> patch in my sources, but I haven't checked it in yet.

But what about:

  class Foo
  {
    public:
      int method ();
      int method () const;
  };

If the name comes back as "Foo::method" then we have ambiguity
in gdb's output.

I think the const looks ugly and the code that prints the function
name is also ugly.  But I don't wanna print the same name for two
different methods.

Michael C


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: C++/Java regressions
@ 2003-11-26 21:18 Michael Elizabeth Chastain
  2003-11-26 21:33 ` Ian Lance Taylor
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-26 21:18 UTC (permalink / raw)
  To: drow, ian; +Cc: gdb

ian> Good question.  My guess is that it's because lookup_symbol_aux()
ian> calls current_language->la_lookup_symbol_nonlocal() before it calls
ian> lookup_symbol_aux_psymtabs().  If I force la_lookup_symbol_nonlocal()
ian> to return NULL, then lookup_symbol_aux_psymtabs() finds the typedef,
ian> and `ptype T5<int>' works more or less correctly.

Have a look at

  http://sources.redhat.com/gdb/bugs/1465

I just mailed in an analysis of a similar bug.  It will take some
time for gnats to post it.

Briefly, the call tree is:

  lookup_symbol_aux
    current_language->la_lookup_symbol_nonlocal
      lookup_symbol_file
	lookup_symbol_static                    [1]
	lookup_symbol_aux_block
	lookup_symbol_global                    [2]
	lookup_possible_namespace_symbol        [3]
    lookup_symbol_aux_symtabs                   [4]
    lookup_symbol_aux_psymtabs

You are probably getting a hit at [3].

Check the value of "block" in lookup_symbol_file.  I bet that
you have block=0.  That prevents [1] from finding a match in the current
static block.

[4] is a kludge that looks in ALL static blocks.  That's not good.
Before [3] came along as part of DavidC's namespace work,
[4] was happening all the time.

I think the right fix is to pass a correct "block" to local_symbol_aux
so that [1] can do its job properly.

Michael C


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: C++/Java regressions
@ 2003-11-25 17:06 Michael Elizabeth Chastain
  2003-11-25 17:14 ` David Carlton
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-25 17:06 UTC (permalink / raw)
  To: mec.gnu; +Cc: gdb, ian

[Ian might not need any more of this ...]

I asked:
mec> What is the correct output when a breakpoint is taken on
mec> "A::bar(int) const" ?

After some deliberation, I decided that I want the test script
to be liberal in what it accepts.

  class A {
  public:
    ...
    int foo (int arg);
    int bar (int arg) const;
  };

When a breakpoint is taken on A::foo, the script currently accepts:

  Breakpoint N, A::foo (this=...)
  Breakpoint N, A::foo(int) (this=...)

When a breakpoint is taken on A::bar, the script currently accepts:

  Breakpoint N, A::bar (this=...)
  Breakpoint N, A::bar(int) const (this=...)

I am going to keep all these patterns and add another pattern to
accept what gdb is printing today:

  Breakpoint N, A::bar const (this=...)

If someone wants to spend time on making gdb's output better here,
that is okay with me.  But I decided that it's too low priority for
my attention and the list bandwidth.

David C is that okay with you?

Patch to follow.

Michael C


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: C++/Java regressions
@ 2003-11-25 15:33 Michael Elizabeth Chastain
  0 siblings, 0 replies; 26+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-25 15:33 UTC (permalink / raw)
  To: drow, mec.gnu; +Cc: carlton, gdb, ian

drow> The former, since ths has been the documented interface to the
drow> demangler forever.

Sounds good to me.

drow> I believe the GNU v2 demangler supported it.

Yes it does.

drow> But I thought we did everywhere - where aren't we that this caused
drow> a problem?

I don't know what's causing the problem with the java tests.

print_frame in stack.c is part of the problem with gdb.cp/method.exp.
It's intentionally omitting DMGL_PARAMS.  But actually it's just
a precursor for some other code that I haven't find yet.

With v2, when DMGL_PARAMS is not set, the arguments don't get printed,
and the "const" modifier doesn't get printed either.

  Breakpoint 3, A::bar (this=0xbffff770, arg=15) at ...

With the old v3 demangler, the args get printed even though we
didn't ask for them:

  Breakpoint 3, A::bar(int) const (this=...)

With the new v3 demangler, the args do not get printed, but the
"const" attribute is printed:

  Breakpoint 3, A::bar const (this=...)

So actually the old demangler was broken, and the new demangler is
doing what we ask it to do.  Now we have to think about what we really
want to see.

What is the correct output when a breakpoint is taken on
"A::bar(int) const" ?

(This particular test accepts either "A::bar" or "A::bar(int) const",
but not "A::bar const".  That's why the FAIL popped up.  Just another
bit of ad-hoc matching.  After we decide what should be printed,
I can change the test).

Michael C


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: C++/Java regressions
@ 2003-11-25 14:49 Michael Elizabeth Chastain
  2003-11-25 15:06 ` Daniel Jacobowitz
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-25 14:49 UTC (permalink / raw)
  To: carlton, gdb, ian

Good morning,

I see the same regressions that David does.  This happened in all
my gcc-3 configurations.  If you want a specific configuration:

  target = native, host = i686-pc-linux-gnu, osversion = red-hat-8.0
  gdb = HEAD 2003-11-25 04:21:57 UTC
  gcc = 3.3.2
  binutils = 2.14
  glibc = 2.2.93-5-rh
  gformat = dwarf-2
  glevel = 2

I have two issues.

=== Issue #1: the demangler changed its interface.

The demangler used to return parameters all the time, but now it looks
like it returns parameters only if DMGL_PARAMS is given.

This change did not happen with "complete rewrite".  It happened
with the followup patch:

    2003-11-22  Ian Lance Taylor  <ian@wasabisystems.com>

    * cp-demangle.c (d_encoding): Add top_level parameter.  Change all
    callers.
    (print_usage): Display new -p option.
    (long_options): Add --no-params.
    (main): Accept and handle -p.

So the questions are:

(A) Does gdb want to keep getting the parameters?
    (My answer: yes we do).

(B) If we want the parameters, should we change gdb to set DMGL_PARAMS,
    or should we ask the demangler to keep giving us the parameters with
    our existing flags, which is usually just DMGL_ANSI?  (My answer:
    let Ian tell us what the interface actually is, and then we'll adapt
    gdb to match).

=== Issue #2: "unsigned" versus "unsigned int"

The new demangler prints "unsigned int" in some places where the old
demangler prints "unsigned".

This is fine.  I updated gdb.cp/templates.exp to accept "unsigned int".

Michael C


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: C++/Java regressions
@ 2003-11-25  4:44 Michael Elizabeth Chastain
  2003-11-25 17:54 ` Ian Lance Taylor
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-25  4:44 UTC (permalink / raw)
  To: carlton, ian; +Cc: gdb

Hi Ian and David,

My last spin was with gdb HEAD checked out on 2003-11-21 06:25:07.
I got some new demangler code, because my gdb HEAD had
"715 tests, 18 failures" instead of the old "715 tests, 31 failures".
However I did not get the "cp-demangle.c: complete rewrite" version.

I didn't see any demangler-related changes in my results.

I'll fire up some scripts and see if I can see any difference now.

ian> I'm not saying that the problem is not the demangler.  I don't know
ian> what the problem is.  If you can give more information, I would be
ian> happy to adjust the demangler.

Totally reasonable.

For what it's worth, how would I file a demangler bug report?
Do I just file it in gcc bugzilla, because the primary copy of
libiberty lives in gcc?

ian> I enclose the diff of gdb.sum.

Cool!  Just because I'm such a gdb test suite geek, I'll post a
little analysis of what you are seeing.

I'd like to keep improving the test suite so that
"diff gdb-1.sum gdb-2.sum" has less noise in it.
It has been getting better lately.

Michael C

-PASS: gdb.base/pc-fp.exp: get value of $fp (0xbfffe788)
+PASS: gdb.base/pc-fp.exp: get value of $fp (0xbfffe388)

  The test name has a machine address in it, so it fluctuates a bit
  from run to run (obviously).

-PASS: gdb.cp/cplusfuncs.exp: print &'overload1arg(unsigned)'
+PASS: gdb.cp/cplusfuncs.exp: print &'overload1arg(unsigned int)'

  You changed the demangler.

-KFAIL: gdb.cp/cplusfuncs.exp: print &'hairyfunc5' (PRMS: gdb/19)
-KFAIL: gdb.cp/cplusfuncs.exp: print &'hairyfunc6' (PRMS: gdb/19)
-KFAIL: gdb.cp/cplusfuncs.exp: print &'hairyfunc7' (PRMS: gdb/19)
+PASS: gdb.cp/cplusfuncs.exp: print &'hairyfunc5'
+PASS: gdb.cp/cplusfuncs.exp: print &'hairyfunc6'
+PASS: gdb.cp/cplusfuncs.exp: print &'hairyfunc7'

  You fixed a bug in the demangler (a very old bug, gdb/19).
  Cool!

-PASS: gdb.threads/print-threads.exp: Hit kill breakpoint, 9 (slow with kill breakpoint)
 PASS: gdb.threads/print-threads.exp: Hit thread_function breakpoint, 4 (slow with kill breakpoint)
+PASS: gdb.threads/print-threads.exp: Hit kill breakpoint, 9 (slow with kill breakpoint)

  Non-determinism in the order of execution of thread tests.

-PASS: gdb.threads/print-threads.exp: Hit thread_function breakpoint, 5 (slow with kill breakpoint)
 PASS: gdb.threads/print-threads.exp: Hit kill breakpoint, 11 (slow with kill breakpoint)
+PASS: gdb.threads/print-threads.exp: Hit thread_function breakpoint, 5 (slow with kill breakpoint)

  Ditto.

-PASS: gdb.threads/pthreads.exp: continue to bkpt at common_routine in thread 2
-PASS: gdb.threads/pthreads.exp: backtrace from thread 2 bkpt in common_routine
+FAIL: gdb.threads/pthreads.exp: continue to bkpt at common_routine in thread 2

  My understanding is that this is a real race condition between
  gdb and the operating system.  It happens about one time every
  500 or so test runs for me.  Daniel J knows more about this.
  Whatever it is, it's not a demangler problem.

-PASS: gdb.threads/schedlock.exp: other thread 2 didn't run
-PASS: gdb.threads/schedlock.exp: other thread 3 didn't run
 PASS: gdb.threads/schedlock.exp: current thread ran
+PASS: gdb.threads/schedlock.exp: other thread 3 didn't run
+PASS: gdb.threads/schedlock.exp: other thread 4 didn't run

  More thread non-determinism, sigh.  As long as they all pass it's
  okay.


^ permalink raw reply	[flat|nested] 26+ messages in thread
* C++/Java regressions
@ 2003-11-25  1:37 David Carlton
  2003-11-25  3:58 ` Ian Lance Taylor
  2003-11-26  4:04 ` Ian Lance Taylor
  0 siblings, 2 replies; 26+ messages in thread
From: David Carlton @ 2003-11-25  1:37 UTC (permalink / raw)
  To: gdb, ian

I did a CVS update on GDB for the first time in 4 days, and I got the
following testsuite changes:

-PASS: gdb.cp/method.exp: continue to A::bar
+FAIL: gdb.cp/method.exp: continue to A::bar

-KFAIL: gdb.cp/templates.exp: ptype T5<int> (PRMS: gdb/1111)
-KFAIL: gdb.cp/templates.exp: ptype T5<int> (PRMS: gdb/1111)
+FAIL: gdb.cp/templates.exp: ptype T5<int>
+FAIL: gdb.cp/templates.exp: ptype t5i

 PASS: gdb.java/jmisc1.exp: set language to "java"
+FAIL: gdb.java/jmisc1.exp: setting breakpoint at jmisc.main(java.lang.String[]) FAIL: gdb.java/jmisc1.exp: ptype jmisc
-PASS: gdb.java/jmisc1.exp: p args
-PASS: gdb.java/jmisc1.exp: p *args
-PASS: gdb.java/jmisc1.exp: break exit
-PASS: gdb.java/jmisc1.exp: continue to exit
+FAIL: gdb.java/jmisc1.exp: p args
+FAIL: gdb.java/jmisc1.exp: p *args
+FAIL: gdb.java/jmisc1.exp: break exit
+FAIL: gdb.java/jmisc1.exp: continue to exit (the program is no longer running)
 Running ./gdb.java/jmisc2.exp ...
 PASS: gdb.java/jmisc2.exp: set print sevenbit-strings
 PASS: gdb.java/jmisc2.exp: set language to "java"
 FAIL: gdb.java/jmisc2.exp: ptype jmisc
-PASS: gdb.java/jmisc2.exp: p args
-PASS: gdb.java/jmisc2.exp: p *args
+FAIL: gdb.java/jmisc2.exp: setting breakpoint at jmisc.main(java.lang.String[])+FAIL: gdb.java/jmisc2.exp: p args
+FAIL: gdb.java/jmisc2.exp: p *args

I haven't looked in detail; I tend to suspect the recent demangler
changes, but I could be wrong.

David Carlton
carlton@kealia.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2003-12-01 16:45 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-26 22:48 C++/Java regressions Michael Elizabeth Chastain
  -- strict thread matches above, loose matches on Subject: below --
2003-11-26 21:44 Michael Elizabeth Chastain
2003-11-26 22:21 ` Ian Lance Taylor
2003-11-26 22:28   ` Daniel Jacobowitz
2003-11-26 22:34     ` Ian Lance Taylor
2003-11-26 21:18 Michael Elizabeth Chastain
2003-11-26 21:33 ` Ian Lance Taylor
2003-11-25 17:06 Michael Elizabeth Chastain
2003-11-25 17:14 ` David Carlton
2003-11-25 17:59   ` Daniel Jacobowitz
2003-11-25 15:33 Michael Elizabeth Chastain
2003-11-25 14:49 Michael Elizabeth Chastain
2003-11-25 15:06 ` Daniel Jacobowitz
2003-11-25  4:44 Michael Elizabeth Chastain
2003-11-25 17:54 ` Ian Lance Taylor
2003-11-25  1:37 David Carlton
2003-11-25  3:58 ` Ian Lance Taylor
2003-11-26  4:04 ` Ian Lance Taylor
2003-11-26 15:32   ` Daniel Jacobowitz
2003-11-26 21:05     ` Ian Lance Taylor
2003-11-26 21:11       ` David Carlton
2003-11-26 21:12       ` Daniel Jacobowitz
2003-11-26 21:32         ` Ian Lance Taylor
2003-12-01 16:45           ` Daniel Jacobowitz
2003-11-30  2:57         ` Jim Blandy
2003-11-30  3:12           ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox