libunwind-devel
[Top][All Lists]
Advanced

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

Re: [libunwind] bug in ia64_put ?


From: Mark Young
Subject: Re: [libunwind] bug in ia64_put ?
Date: Tue, 12 Nov 2002 18:25:45 -0800
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0

The problem shows up when using unw_set_reg to poke a register value into the unwind cursor. Here's a simple modification to tests/bt.c which demonstrates it:

--- libunwind/tests/bt.c    Mon Nov 11 23:31:39 2002
+++ ./bt.c    Tue Nov 12 17:43:01 2002
@@ -38,6 +38,7 @@
   do
     {
       unw_get_reg (&cursor, UNW_REG_IP, &ip);
+      unw_set_reg (&cursor, UNW_REG_IP, ip);
       unw_get_reg (&cursor, UNW_REG_SP, &sp);
       printf ("ip=%016lx sp=%016lx\n", ip, sp);
 

As this traceback shows, the inlined ia64_put in _Uia64_access_reg mistakenly calls the access_mem function and causes a segmentation violation:

Program received signal SIGSEGV, Segmentation fault.
access_mem (addr=4188, val=0x60000fffffffa580, write=1, arg=0x60000fffffffa9c0) at ia64/unw_init_local.c:96
96          *(unw_word_t *) addr = *val;
(gdb) bt
#0  access_mem (addr=4188, val=0x60000fffffffa580, write=1, arg=0x60000fffffffa9c0) at ia64/unw_init_local.c:96
#1  0x2000000000054250 in _Uia64_access_reg (c=0x60000fffffffa5b0, reg=-23168, valp=0x60000fffffffa5a0, write=1) at ia64/unwind_i.h:321
#2  0x20000000000586b0 in _Uia64_set_reg (cursor=0x105c, regnum=-23168, valp=4611686018427391712) at ia64/unw_set_reg.c:31
#3  0x4000000000000ff0 in do_backtrace () at bt.c:41
#4  0x4000000000001240 in foo () at bt.c:65
#5  0x4000000000001540 in main (argc=1, argv=0x60000fffffffb508) at bt.c:85


My intent was to skip over frames associated with dynamically-generated code by setting new values in the cursor and calling unw_step again. Admittedly it may be wrong-headed to use unw_set_reg in this way.
--Mark


David Mosberger wrote:
On Tue, 12 Nov 2002 14:27:08 -0800, Mark Young <address@hidden> said:
            

  Mark> I suspect a bug distinguishing register from memory locations
  Mark> in the !UNW_LOCAL_ONLY version of ia64_put(). Here's a patch:

For completeness' sake, could you describe the bug you're trying to
fix?  (along with a simple test-case, ideally).

	--david
  








reply via email to

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