Debugging HelloWorld program

Tom.Williams@diversifiedsoftware.com Tom.Williams@diversifiedsoftware.com
Wed Oct 11 15:18:00 GMT 2000


Thanks for the info.  I tried using the "bt" command and it shows the stack
with the suspend code (from the Ctrl-C).  I do see main and JvRunMain but
not much else that looks meaningful.

I'll keep poking around......

Here's the output:

bash$ gdb ./HelloWorld
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-pc-linux-gnu"...
(gdb) r
Starting program: /home/tomw/./HelloWorld
[New Thread 1024 (runnable)]
[New Thread 2049 (runnable)]
[New Thread 1026 (runnable)]

Program received signal SIGINT, Interrupt.
[Switching to Thread 1024 (runnable)]
0x4040dcbe in __sigsuspend (set=0xbffff99c) at ../sysdeps/unix/sysv/linux/sigsuspend.c:48
48      ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.
(gdb) bt
#0  0x4040dcbe in __sigsuspend (set=0xbffff99c) at ../sysdeps/unix/sysv/linux/sigsuspend.c:48
#1  0x403d1e44 in __pthread_wait_for_restart_signal (self=0x403d9b60) at pthread.c:785
#2  0x403ceb30 in pthread_cond_wait (cond=0x40385740, mutex=0x40385728) at restart.h:26
#3  0x40246f8c in _Jv_ThreadWait () at ../../../libjava/posix-threads.cc:410
#4  0x40134a98 in JvRunMain (klass=0x804cae0, argc=1, argv=0xbffffb54) at ../../../libjava/prims.cc:888
#5  0x804b8e3 in main (argc=1, argv=0xbffffb54) at /tmp/ccO6XxTUmain.i:11
#6  0x40407d2e in __libc_start_main (main=0x804b8c0 <main>, argc=1, argv=0xbffffb54, init=0x8048f40 <_init>, fini=0x804b92c <_fini>,
rtld_fini=0x4000a720 <_dl_fini>, stack_end=0xbffffb4c)
    at ../sysdeps/generic/libc-start.c:92
(gdb) continue
Continuing.

Program received signal SIGINT, Interrupt.
0x4040dcbe in __sigsuspend (set=0xbffff99c) at ../sysdeps/unix/sysv/linux/sigsuspend.c:48
48      in ../sysdeps/unix/sysv/linux/sigsuspend.c
(gdb) bt
#0  0x4040dcbe in __sigsuspend (set=0xbffff99c) at ../sysdeps/unix/sysv/linux/sigsuspend.c:48
#1  0x403d1e44 in __pthread_wait_for_restart_signal (self=0x403d9b60) at pthread.c:785
#2  0x403ceb30 in pthread_cond_wait (cond=0x40385740, mutex=0x40385728) at restart.h:26
#3  0x40246f8c in _Jv_ThreadWait () at ../../../libjava/posix-threads.cc:410
#4  0x40134a98 in JvRunMain (klass=0x804cae0, argc=1, argv=0xbffffb54) at ../../../libjava/prims.cc:888
#5  0x804b8e3 in main (argc=1, argv=0xbffffb54) at /tmp/ccO6XxTUmain.i:11
#6  0x40407d2e in __libc_start_main (main=0x804b8c0 <main>, argc=1, argv=0xbffffb54, init=0x8048f40 <_init>, fini=0x804b92c <_fini>,
rtld_fini=0x4000a720 <_dl_fini>, stack_end=0xbffffb4c)
    at ../sysdeps/generic/libc-start.c:92
(gdb)

Peace......

Tom




Bryce McKinlay
10/12/2000 03:05 AM

Sent by:  bryce


To:   Tom.Williams@diversifiedsoftware.com
cc:   java-discuss@sources.redhat.com

Subject:  Re: Debugging HelloWorld program


Tom.Williams@diversifiedsoftware.com wrote:

> I tried setting "LANG=en_US.UTF-8" to get the program to run and it still
> isn't running (or I'm just not patient enough).  I let the program run
for
> about an hour or so and it still didn't print out my "Hello World"
message.

This isn't a problem I've seen, but I'm running on Red Hat 6.2 and 7.0
systems. Perhaps its dependent on the glibc version.

> So basically, I want to make sure I'm using a good debugger version and I
> need to know if I need to set the "GCJ_PROPERTIES" environment variable
and
> if so to what?

GCJ_PROPERTIES is an environment var that maps into java properties:

* Support for specifying java system properties. Properties can either be
set
at runtime via the GCJ_PROPERTIES environment variable in the format
"<name>=<value> ..."'; or can be compiled into an application binary using
-D<name>=<value>.

You shouldn't need to set it unless you want to set properties that are
viewable from your Java program via the System.getProperties() call.

gdb 5.0 should work fine for most debugging tasks. I would suggest running
your program for a while, then hitting ctrl-C after its been "hung" for a
few
seconds. Then enter "bt" and you should get a fairly good idea of where the
problem is.

regards

  [ bryce ]







More information about the Java mailing list