linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Remote Multithread debugging problems
@ 2002-08-20 14:47 Owen Green
  2002-08-20 14:58 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Owen Green @ 2002-08-20 14:47 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]

Hi all,

I`m trying to debug a multi-threaded application using
gdbserver on the remote/target side and I`m having
some problems, the output I got is depicted below:

TARGET SIDE:(NORMAL OUTPUT)
--------------------------------------------------------------------
# threadTest
Break Function Reached
Init....
Passed 0 times
Main Thread
Passed 1 times
Main Thread
Passed 2 times
Main Thread
Passed 3 times

TARGET SIDE:(DEBUGGING)
--------------------------------------------------------------------
# gdbserver :6666 /bin/threadTest
Process /bin/threadTest created; pid = 32
Remote debugging from host 192.168.0.155
Break Function Reached
Init....
Passed 0 times
GDB bug: target.c (target_signal_from_host):
unrecognized real-time signal
Passed 1 times
Passed 2 times
Passed 3 times
Passed 4 times

HOST SIDE:
--------------------------------------------------------------------
(gdb) target remote 192.168.0.238:6666
0x30012f40 in ?? ()
(gdb) add-symbol-file /usr/src/threadTest 0x30012f40
add symbol table from file "/usr/src/threadTest" at
	.text_addr = 0x30012f40
(gdb) b funcToBreak
Breakpoint 1 at 0x300131b8: file threadTest.c, line
42.
(gdb) b main
Breakpoint 2 at 0x30013130: file threadTest.c, line
22.
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) next
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) next
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
Breakpoint 1, funcToBreak () at threadTest.c:42
(gdb) c
---------------------------------------------------------------------

Note that till the last continue, nothing have been
written on the target`s console, it seems like gdb and
gdbserver are having problems and do restart the
application several times... and finally the main
thread is killed(!?).
And if I try info threads, I got this:

(gdb) info threads
warning: RMT ERROR : failed to get remote thread list

I`m using gdbserver5.2.1 (I tried the one from HHL-2.0
Journeyman and didn`t worked too) compiled by myself
using Mvista HHL 2.0 tools and gdb 5.2.1 on my i386.
Am I doing something wrong or remote thread debugging
is not supported by gdb? I have read something about
problems with multi-thread application debugging but I
thought that it may be OK at this time...
Could someone explain to me what`s happening?
I`ve attached de source of threadTest application on
this mail...

Any comment, insight and/or help will be very
appreciate,

thanks in advance,

Owen.



[-- Attachment #2: threadTest.c --]
[-- Type: application/octet-stream, Size: 642 bytes --]

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>	//pthreads
#include <assert.h>

void funcToBreak (void);
void *threadFunc(void *args);

void *threadFunc(void *args)
{
	static int testCount=0;
	while (1) {
		printf ("Passed %d times\n", testCount);
		testCount++;
		sleep(10);
	}
}


int main(void)
{
  pthread_t threadTest;

  funcToBreak();

  printf("Init....\n");

  pthread_create(&threadTest, NULL, (void*)threadFunc, NULL);

  while (1) {
    sleep(10);
    printf("Main Thread\n");
  }

  printf("Exited....\n");

  exit (0);
}

void funcToBreak(void)
{
	printf ("Break Function Reached\n");
	return;
}

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

* Re: Remote Multithread debugging problems
  2002-08-20 14:47 Remote Multithread debugging problems Owen Green
@ 2002-08-20 14:58 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2002-08-20 14:58 UTC (permalink / raw)
  To: Owen Green; +Cc: linuxppc-embedded


Dear Owen,

in message <20020820144703.16442.qmail@web20107.mail.yahoo.com> you wrote:
>
> I`m trying to debug a multi-threaded application using
> gdbserver on the remote/target side and I`m having
> some problems, the output I got is depicted below:

I'm not surprised. This is broken in most versions of GDB / gdbserver
floating around.

> I`m using gdbserver5.2.1 (I tried the one from HHL-2.0
> Journeyman and didn`t worked too) compiled by myself
> using Mvista HHL 2.0 tools and gdb 5.2.1 on my i386.
> Am I doing something wrong or remote thread debugging
> is not supported by gdb? I have read something about

Let's say the support is incomplete :-)

> problems with multi-thread application debugging but I
> thought that it may be OK at this time...
> Could someone explain to me what`s happening?

Check out our ELDK  (see  http://www.denx.de/ELDK);  it  contains  an
extended  /  bug  fixed  version  of  GDB  / gdbserver; remote target
debugging of MT applications was one of the areas where we spend some
work.

If you're just looking for the patches: these can be found on our FTP
server; the README including description of the test procedure is at
ftp://ftp.denx.de/pub/ppc/patches/README-GDB-MT-Support

Hope this helps.

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
That's the thing about people who think  they  hate  computers.  What
they really hate is lousy programmers.
- Larry Niven and Jerry Pournelle in "Oath of Fealty"

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2002-08-20 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-20 14:47 Remote Multithread debugging problems Owen Green
2002-08-20 14:58 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).