mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas E. Besemer" <tbesemer@tbcorp.com>
To: <linux-kernel@vger.kernel.org>
Subject: ptrace() associated seg faults using GDB, PowerPC versus x86
Date: Wed, 21 Jun 2006 18:04:53 -0700	[thread overview]
Message-ID: <INEDKMDHFAPNJHHJCFHOMEJFCIAA.tbesemer@tbcorp.com> (raw)

[-- 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

    }


                 reply	other threads:[~2006-06-22  1:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=INEDKMDHFAPNJHHJCFHOMEJFCIAA.tbesemer@tbcorp.com \
    --to=tbesemer@tbcorp.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®