libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libunwind] problem unwinding signal handler on HPUX


From: Rob Faught
Subject: [libunwind] problem unwinding signal handler on HPUX
Date: Tue, 04 Nov 2003 19:06:02 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901

Hello David,

It seems that the third argument to a signal handler is not a pointer to a full (48640 byte) ucontext_t. That is, sizeof(ucontext_t) is much larger than the data pushed on the stack. When ia64_uc_access_reg copies the ucontext its src pointer falls off the top of the stack with bad results. Instead grab the size field out of the ucontext_t and use that.

Rob Faught
Etnus



The following works for me:



diff -c -r1.2 Ginit-ia64.c
*** src/ia64/Ginit-ia64.c       12 Sep 2003 18:13:39 -0000      1.2
--- src/ia64/Ginit-ia64.c       4 Nov 2003 23:33:23 -0000
***************
*** 469,476 ****
      {
        unw_word_t *dst, src;

        /* Need to copy-in ucontext_t first.  */
!       ucp = alloca (sizeof (ucontext_t));
        if (!ucp)
        return -UNW_ENOMEM;

--- 469,481 ----
      {
        unw_word_t *dst, src;

+       unw_word_t headr;
+ if ((ret = (*c->as->acc.access_mem) (c->as, uc_addr, &headr, 0, c->as_arg)) < 0)
+       return ret;
+       long usize = headr & 0x00000000ffffffff;
+
        /* Need to copy-in ucontext_t first.  */
!       ucp = alloca (usize);
        if (!ucp)
        return -UNW_ENOMEM;

***************
*** 483,489 ****
        assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN));

        dst = (unw_word_t *) ucp;
!       for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8)
        if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg))
            < 0)
          return ret;
--- 488,494 ----
        assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN));

        dst = (unw_word_t *) ucp;
!       for (src = uc_addr; src < uc_addr + usize; src += 8)
        if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg))
            < 0)
          return ret;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]