* question about method naming
@ 2002-05-06 10:44 Tom Tromey
2002-05-06 12:33 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2002-05-06 10:44 UTC (permalink / raw)
To: Gdb List
I compiled the appended code with `gcj -g'. I'm using the trunk cvs
gcj. Then I ran gdb on the program.
If I type:
b x.main
gdb tells me that there is no such method.
I tracked the problem down to linespec.c:find_methods().
Here we end up in the loop, and method_name for the 0th method is:
(gdb) p method_name
$27 = 0x83e9a52 "x.main(java.lang.String[])"
So of course we fail to match this against "main".
Is this a gdb bug or a gcj bug? Or just a disagreement?
I'm guessing that method_name should not be fully qualified.
Is that correct?
Tom
public class x
{
public static void main (String[] args)
{
char c = args[0].charAt(0);
System.out.println(c);
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: question about method naming
2002-05-06 10:44 question about method naming Tom Tromey
@ 2002-05-06 12:33 ` Daniel Jacobowitz
2002-05-06 15:53 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-05-06 12:33 UTC (permalink / raw)
To: Gdb List
On Mon, May 06, 2002 at 11:53:52AM -0600, Tom Tromey wrote:
> I compiled the appended code with `gcj -g'. I'm using the trunk cvs
> gcj. Then I ran gdb on the program.
>
> If I type:
>
> b x.main
>
> gdb tells me that there is no such method.
Are you working on a very current gcj? I.E. one that defaults to
DWARF-2 output? I observe the same thing in 3.0.4 with -gdwarf-2, but
not with -gstabs+.
In this version, the stabs debug info claims that 'class x' has a
member function 'main'. In DWARF-2 it claims that 'class x' has a
member function 'x.main(java.lang.String[])'. If this is still the
case in your compiler (check readelf -w output, search for a
DW_TAG_subprogram whose name contains main) then I believe it is
a gcj bug.
<2><16d>: Abbrev Number: 4 (DW_TAG_subprogram)
DW_AT_sibling : <1c4>
DW_AT_external : 1
DW_AT_name : x.main(java.lang.String[])
DW_AT_decl_file : 1
DW_AT_decl_line : 458756
DW_AT_MIPS_linkage_name: _ZN1x4mainEP6JArrayIPN4java4lang6StringEE
DW_AT_declaration : 1
Also amusing:
<2><1c4>: Abbrev Number: 6 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : ()
DW_AT_MIPS_linkage_name: _ZN1xC1Ev
DW_AT_artificial : 1
DW_AT_declaration : 1
The constructor's name is obviously wrong...
>
> I tracked the problem down to linespec.c:find_methods().
>
> Here we end up in the loop, and method_name for the 0th method is:
>
> (gdb) p method_name
> $27 = 0x83e9a52 "x.main(java.lang.String[])"
>
> So of course we fail to match this against "main".
>
> Is this a gdb bug or a gcj bug? Or just a disagreement?
>
> I'm guessing that method_name should not be fully qualified.
> Is that correct?
I believe so.
>
> Tom
>
> public class x
> {
> public static void main (String[] args)
> {
> char c = args[0].charAt(0);
> System.out.println(c);
> }
> }
>
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: question about method naming
2002-05-06 12:33 ` Daniel Jacobowitz
@ 2002-05-06 15:53 ` Tom Tromey
2002-05-06 16:07 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2002-05-06 15:53 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Gdb List
>>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:
Tom> If I type:
Tom> b x.main
Tom> gdb tells me that there is no such method.
Daniel> Are you working on a very current gcj? I.E. one that defaults
Daniel> to DWARF-2 output? I observe the same thing in 3.0.4 with
Daniel> -gdwarf-2, but not with -gstabs+.
Yes. I'm using the trunk cvs gcj.
Daniel> In this version, the stabs debug info claims that 'class x'
Daniel> has a member function 'main'. In DWARF-2 it claims that
Daniel> 'class x' has a member function 'x.main(java.lang.String[])'.
Daniel> If this is still the case in your compiler (check readelf -w
Daniel> output, search for a DW_TAG_subprogram whose name contains
Daniel> main) then I believe it is a gcj bug.
Ok. What is the correct output? `main(java.lang.String[])'?
I wonder if this was done because of the lack of namespace support in
gdb? In this case that would be strange (`x' is a class, not a
namespace). This is something I'll note in the bug report.
Daniel> Also amusing:
Daniel> <2><1c4>: Abbrev Number: 6 (DW_TAG_subprogram)
Daniel> DW_AT_external : 1
Daniel> DW_AT_name : ()
Daniel> DW_AT_MIPS_linkage_name: _ZN1xC1Ev
Daniel> DW_AT_artificial : 1
Daniel> DW_AT_declaration : 1
Daniel> The constructor's name is obviously wrong...
I saw this too.
Thanks for your insight,
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: question about method naming
2002-05-06 15:53 ` Tom Tromey
@ 2002-05-06 16:07 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-05-06 16:07 UTC (permalink / raw)
To: Gdb List
On Mon, May 06, 2002 at 05:03:19PM -0600, Tom Tromey wrote:
> >>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:
>
> Tom> If I type:
> Tom> b x.main
> Tom> gdb tells me that there is no such method.
>
> Daniel> Are you working on a very current gcj? I.E. one that defaults
> Daniel> to DWARF-2 output? I observe the same thing in 3.0.4 with
> Daniel> -gdwarf-2, but not with -gstabs+.
>
> Yes. I'm using the trunk cvs gcj.
>
> Daniel> In this version, the stabs debug info claims that 'class x'
> Daniel> has a member function 'main'. In DWARF-2 it claims that
> Daniel> 'class x' has a member function 'x.main(java.lang.String[])'.
> Daniel> If this is still the case in your compiler (check readelf -w
> Daniel> output, search for a DW_TAG_subprogram whose name contains
> Daniel> main) then I believe it is a gcj bug.
>
> Ok. What is the correct output? `main(java.lang.String[])'?
No, `main'. The type should not be there at all. Breaking on
`x.main(java.lang.String[])' or something similar should still work,
because the mangled name is in scope...
> I wonder if this was done because of the lack of namespace support in
> gdb? In this case that would be strange (`x' is a class, not a
> namespace). This is something I'll note in the bug report.
That may be why.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-05-06 23:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-06 10:44 question about method naming Tom Tromey
2002-05-06 12:33 ` Daniel Jacobowitz
2002-05-06 15:53 ` Tom Tromey
2002-05-06 16:07 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox