mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* ptrace() associated seg faults using GDB, PowerPC versus x86
@ 2006-06-22  1:04 Thomas E. Besemer
  0 siblings, 0 replies; only message in thread
From: Thomas E. Besemer @ 2006-06-22  1:04 UTC (permalink / raw)
  To: linux-kernel

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

Using 2.6.16.20, on both x86 and PowerPC, I am finding that
GDB will cause a seg fault on PowerPC, but not x86, using
the same test fixture.

The problem is associated with calling a subroutine in a
stopped process.  The attached C file provides a very
reproducible fault:

 - In x86, I can attach to the running process, and call
   'runStub()' without problems.

 - In PowerPC, I can attach.  I call 'runStub()', but it
   does not return until the sleep() times out, and then
   there is a seg fault.

I do not believe this is a GDB issue; GDB was used to help
diagnose the original problem in my application - using
ptrace() to invoke subroutines on a stopped process.  I
was met with continued seg faults on PowerPC, but not in
x86 world.  I have spent a lot of time looking at this, and
am extremely comfortable that the problem lay in either the
ptrace() implementation, or possibly the signal handling
functions.  More likely ptrace().

I have looked at the ~arch specific routines for ptrace, and
signal handling.  I believe that these machine specific
files behave very differently, due to architecture specific
issues.

I am interested in finding a person who understands how
ptrace() works on the PowerPC, possibly the maintainer of
it, to do some back and forth to resolve/understand these
issues.  I will be happy to find/fix, with some guidance and
understanding.


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

#include	<stdio.h>
#include	<stdlib.h>

void runStdio()
    {
    char  inBuff[ 200 ];
    char  *tmpPtr;

    for (;;)
        {
        tmpPtr = fgets (inBuff, 200, stdin );
        if (tmpPtr)
            printf ("string: %s", tmpPtr);
        else
            exit (1);
        }

    }

void runSleep()
    {
    int  timeLeft;

    for (;;)
        {
	timeLeft = sleep(40);
        printf( "time left == %d\n", timeLeft);
        }
    }

void  runStub()
    {
    }

void  runStubIo()
    {
    printf ("runStubIo(): called\n");
    }

main()
    {
    int cpid;

#ifdef	USE_FORK
    cpid = fork ();
    if (cpid)
        runSleep ();
    else
        runStdio ();
#else
    runSleep ();
#endif

    }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-06-22  1:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-22  1:04 ptrace() associated seg faults using GDB, PowerPC versus x86 Thomas E. Besemer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®