This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb with gcj


It appears that gdb is just not working right. I was able to at least step through a bit of code on Friday, but today I can't even do that.

My platform:
- Apple G4
- YellowDog Linux 3.0.1
- gcc (GCC) 3.2.2 20030217
- GNU gdb Yellow Dog Linux (5.2.1-4b)

test.java:
public class test {
   public static final void main(String[] args) {
       test runme = new test();
       runme.run();
   }

   public void run() {
       int value1 = 1;
       int value100 = 100;

       if (value1 < value100) {
           value1 = 10;
       }

       System.out.println("value1 = " + value1);
       System.out.println("value100 = " + value100);
   }
}

compilation and gdb steps:
%gcj -C -g test.java
%gcj -g --main=test test.class
%gdb a.out

[I have tried using the -O0 option when I compile and link, with no success as well]

gdb steps:
(gdb) handle SIGPWR nostop noprint
Signal Stop Print Pass to program Description
SIGPWR No No Yes Power fail/restart
(gdb) handle SIGXCPU nostop noprint
Signal Stop Print Pass to program Description
SIGXCPU No No Yes CPU time limit exceeded
[at this point I have to type break test.main; I get a message saying to try tab;
onlty THEN can I set the break point]
(gdb) break test.main(java.lang.String[])
Breakpoint 1 at 0x10001be0: file test.java, line 3.
(gdb) run
Starting program: /home/levinv/dev/GcjDebugTest/a.out
[New Thread 16384 (LWP 2154)]
[New Thread 32769 (LWP 2155)]
[New Thread 16386 (LWP 2156)]
[Switching to Thread 16384 (LWP 2154)]


Breakpoint 1, test.main(java.lang.String[]) (args=@1003bfe8) at test.java:3
3 test runme = new test();
Current language: auto; currently java
(gdb) step
0x30024f60 in __cache_line_size () from /lib/ld.so.1
[As you can see, I cannot even step through the program without it leaving Java mode. On Friday I was able to do that (not sure why), but no luck today. ]
(gdb) print value1
No symbol "value1" in current context.
(gdb) continue
Continuing.
value1 = 10
value100 = 100


Program exited normally.

Andrew Haley wrote:

Unoptimized code should work, though.  Vladimir, if you find a program
compiled with no optimization that has no debug info for local
variables, please let me know.  Tell me the exact version of gcj and
gdb.

Andrew.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]