>Category:       gcj
>Synopsis:       GDB java problems: constructors and 'ptype'
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Class:          sw-bug
>Submitter-Id:   net
>Originator:     Bryce McKinlay
>Release:        unknown-1.0
>Environment:
gcj 20000422 and gdb 20000423
>Description:
GDB has various annoying glitches when debugging java code.
Here is a couple that I tracked down.

Given the following code:

public class TestGDB
{
  String str1 = "some string"; 
  
  public static void main(String args[])
  {
    new TestGDB();
  }

  public TestGDB ()
  {
    int a = 6;
    System.out.println(a);
  }  
}

One can successfully run gdb and put a breakpoint on the 
constructor for "TestGDB" using "b TestGDB.TestGDB". However,
ptype doesn't work: 

(gdb) ptype TestGDB
type = <unknown type>

Now, comment out the field "str1" and recompile the example.
Suddenly, ptype works:

(gdb) ptype TestGDB
type = class TestGDB  extends java.lang.Object {

    void main(java.lang.String[]);
    void <init>(void);
}

But the constructor "TestGDB" is missing from the type info,
and we cant set a breakpoint on it either:

(gdb) b TestGDB.TestGDB
the class TestGDB does not have any method named TestGDB
Hint: try 'TestGDB.TestGDB<TAB> or 'TestGDB.TestGDB<ESC-?>
(Note leading single quote.)

>How-To-Repeat:

>Fix:

>Unformatted:

Reply via email to