public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* libunwind  Cursor.step() return values
@ 2007-12-06 16:23 Phil Muldoon
  2007-12-06 18:02 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Muldoon @ 2007-12-06 16:23 UTC (permalink / raw)
  To: Frysk Hackers

I've been looking at a fd 0 close when opening a corefile on x86 via 
fhpd. The last few of the console trace are:

-Dec-07 10:13:10 AM lib.unwind.Cursor <init>
FINE: lib.unwind.Cursor@54e690 Create Cursor
 
6-Dec-07 10:13:10 AM lib.unwind.UnwindX86 step
FINE: lib.unwind.UnwindX86@376460 step cursor: 0x1ccc00
 
6-Dec-07 10:13:10 AM frysk.stack.LibunwindAddressSpace findProcInfo
FINE: Entering findProcInfo, ip: 804854a
 
6-Dec-07 10:13:10 AM frysk.stack.LibunwindAddressSpace getElfImage
FINE: frysk.stack.LibunwindAddressSpace@28ab40 Entering getElfImage, addr: 0x804854a
 
6-Dec-07 10:13:10 AM frysk.stack.LibunwindAddressSpace getElfImage
FINEST: Handling regular map name: 
6-Dec-07 10:13:10 AM frysk.stack.LibunwindAddressSpace getElfImage
FINER: Leaving getElfImage
6-Dec-07 10:13:10 AM frysk.stack.LibunwindAddressSpace findProcInfo
FINEST: Obtained elfImage: Bad Elf Image, ret: -1
 
6-Dec-07 10:13:10 AM lib.unwind.UnwindX86 createProcInfoFromElfImage
FINE: lib.unwind.UnwindX86@376460 Pre unw_get_unwind_table
 
6-Dec-07 10:13:10 AM lib.unwind.UnwindX86 createProcInfoFromElfImage
FINE: lib.unwind.UnwindX86@376460 Post unw_get_unwind_table
 
6-Dec-07 10:13:10 AM frysk.stack.LibunwindAddressSpace findProcInfo
FINE: post procInfo ProcInfo Error: -1
 
6-Dec-07 10:13:10 AM lib.unwind.Cursor unwind
FINEST: lib.unwind.Cursor@42dac8, unwind, step returned: -1


And the exception returned after that is:

(fhpd) ERROR: Could not read from command line
Bad file descriptorException in thread "main" frysk.sys.Errno$Ebadf: tcsetattr: Bad file descriptor (fd 0)
   at frysk.sys.termios.Termios.set(fhpd)
   at frysk.sys.termios.Termios.set(fhpd)
   at frysk.util.PtyTerminal$1.start(fhpd)
   at java.lang.Runtime.runShutdownHooks(libgcj.so.8rh)
   at java.lang.Runtime.exitNoChecks(libgcj.so.8rh)
   at java.lang.Runtime.exitNoChecksAccessor(libgcj.so.8rh)

Looking at: ~/frysk/frysk-sys/lib/unwind/Cursor.java I see this code in question:


    public Cursor unwind() {
        logger.log(Level.FINE, "{0}, unwind\n", this);

        //XXX: Don't unwind if no more, or unknown frames.
        if (step == 0 || getIP() == 0)
            return null;

        Cursor newCursor = new Cursor(addressSpace,
                                      unwinder.copyCursor(cursor), unwinder);

        step = newCursor.step();

        logger.log(Level.FINEST, "{0}, unwind, step returned: {1}\n",
                   new Object[] {this, new Integer(step)});

        if (step > 0)
            return newCursor;

        return null;
    }

I see that step == 0 means no more or unknown frames. Further down the:

step = newCursor.step()

returns -1 in this case. What does that mean in this case?

Regards

Phil



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

* Re: libunwind  Cursor.step() return values
  2007-12-06 16:23 libunwind Cursor.step() return values Phil Muldoon
@ 2007-12-06 18:02 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2007-12-06 18:02 UTC (permalink / raw)
  To: Phil Muldoon; +Cc: Frysk Hackers

Hi Phil,

On Thu, 2007-12-06 at 16:22 +0000, Phil Muldoon wrote:
> I see that step == 0 means no more or unknown frames. Further down the:
> 
> step = newCursor.step()
> 
> returns -1 in this case. What does that mean in this case?

A mixup of error codes... It is the result of an open() call passed
around as libunwind error code, which it isn't.
I am in the middle of rewriting this code.

But -1 could be returned in theory and then would mean:
UNW_EUNSPEC,                /* unspecified (general) error */
If so a new cursor couldn't be created, but that should still not lead
to the closing of fd 0 by some other code.

On irc (and a quick pair programming on vnc - that is actually pretty
cute) we tried to get the right error code across. Which seems to happen
(then -10 UNW_ENOINFO is returned), but that didn't fix bad file
descriptor closing. So I think it is unrelated, but actually some code
trying to shut down and messing up the tty.

Maybe one of the places found in the System.exit() bugzilla?
http://sourceware.org/bugzilla/show_bug.cgi?id=4299

Cheers,

Mark

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

end of thread, other threads:[~2007-12-06 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-06 16:23 libunwind Cursor.step() return values Phil Muldoon
2007-12-06 18:02 ` Mark Wielaard

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 read-only IMAP folder(s) and NNTP newsgroup(s).