Gstep.c revision 9e98f15e9aee12e67cd5956d06ccb559f6a06213
1a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock/* libunwind - a platform-independent unwind library 217bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm Copyright (C) 2002-2004 Hewlett-Packard Co 3a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 4a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 5a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock Modified for x86_64 by Max Asbock <masbock@us.ibm.com> 6a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 7a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockThis file is part of libunwind. 8a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 9a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockPermission is hereby granted, free of charge, to any person obtaining 10a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbocka copy of this software and associated documentation files (the 11a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock"Software"), to deal in the Software without restriction, including 12a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockwithout limitation the rights to use, copy, modify, merge, publish, 13a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockdistribute, sublicense, and/or sell copies of the Software, and to 14a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockpermit persons to whom the Software is furnished to do so, subject to 15a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockthe following conditions: 16a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 17a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockThe above copyright notice and this permission notice shall be 18a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockincluded in all copies or substantial portions of the Software. 19a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 20a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 27a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 28a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock#include "unwind_i.h" 29a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock#include <signal.h> 30c64723835c0c855fde5bec3d7528db64fe539015Konstantin Belousov 31aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma/* Recognise PLT entries such as: 32aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma 3bdf0: ff 25 e2 49 13 00 jmpq *0x1349e2(%rip) 33aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma 3bdf6: 68 ae 03 00 00 pushq $0x3ae 34aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma 3bdfb: e9 00 c5 ff ff jmpq 38300 <_init+0x18> */ 35aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharmastatic int 36aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharmais_plt_entry (struct dwarf_cursor *c) 37aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma{ 38aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma unw_word_t w0, w1; 39aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma unw_accessors_t *a; 40aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma int ret; 41aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma 42aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma a = unw_get_accessors (c->as); 43aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma if ((ret = (*a->access_mem) (c->as, c->ip, &w0, 0, c->as_arg)) < 0 44aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma || (ret = (*a->access_mem) (c->as, c->ip + 8, &w1, 0, c->as_arg)) < 0) 45aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma return 0; 46aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma 47aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma ret = (((w0 & 0xffff) == 0x25ff) 48aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma && (((w0 >> 48) & 0xff) == 0x68) 49aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma && (((w1 >> 24) & 0xff) == 0xe9)); 50aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma 51aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma Debug (14, "ip=0x%lx => 0x%016lx 0x%016lx, ret = %d\n", c->ip, w0, w1, ret); 52aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma return ret; 53aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma} 54aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma 55a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockPROTECTED int 56a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbockunw_step (unw_cursor_t *cursor) 57a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock{ 58a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock struct cursor *c = (struct cursor *) cursor; 59a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock int ret, i; 60a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 619e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura#if CONSERVATIVE_CHECKS 629e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura int val = c->validate; 639e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->validate = 1; 649e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura#endif 659e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura 66aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx)\n", 67aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma c, c->dwarf.ip, c->dwarf.cfa); 6817bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm 696058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm /* Try DWARF-based unwinding... */ 70dac2d001afb1fa7040ca7d8ae57032f684d7023eLassi Tuura c->sigcontext_format = X86_64_SCF_NONE; 716058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm ret = dwarf_step (&c->dwarf); 72a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 739e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura#if CONSERVATIVE_CHECKS 749e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->validate = val; 759e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura#endif 769e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura 7717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm if (ret < 0 && ret != -UNW_ENOINFO) 7817bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm { 7917bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm Debug (2, "returning %d\n", ret); 8017bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm return ret; 8117bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm } 826058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm 836058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm if (likely (ret >= 0)) 84a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock { 856058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm /* x86_64 ABI specifies that end of call-chain is marked with a 866058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm NULL RBP. */ 876058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP])) 886058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm c->dwarf.ip = 0; 89a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock } 90a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock else 91a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock { 9217bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm /* DWARF failed. There isn't much of a usable frame-chain on x86-64, 9317bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm but we do need to handle two special-cases: 9417bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm 9517bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm (i) signal trampoline: Old kernels and older libcs don't 9617bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm export the vDSO needed to get proper unwind info for the 9717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm trampoline. Recognize that case by looking at the code 9817bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm and filling in things by hand. 9917bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm 10017bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm (ii) PLT (shared-library) call-stubs: PLT stubs are invoked 10117bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm via CALLQ. Try this for all non-signal trampoline 10217bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm code. */ 10317bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm 10417bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm unw_word_t prev_ip = c->dwarf.ip, prev_cfa = c->dwarf.cfa; 105a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock struct dwarf_loc rbp_loc, rsp_loc, rip_loc; 106a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 107649f1fb3449a65dd0626a709432d8b02a7c56bbcArun Sharma /* We could get here because of missing/bad unwind information. 108649f1fb3449a65dd0626a709432d8b02a7c56bbcArun Sharma Validate all addresses before dereferencing. */ 109649f1fb3449a65dd0626a709432d8b02a7c56bbcArun Sharma c->validate = 1; 110649f1fb3449a65dd0626a709432d8b02a7c56bbcArun Sharma 1116058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret); 1126058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm 113ccc0ae665baa67ae3df8595ab7bb0ef8cbc0e5c4Konstantin Belousov if (unw_is_signal_frame (cursor)) 1146058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm { 1158e53e62db913470952b8eb541834b876f7a6882cArun Sharma ret = unw_handle_signal_frame(cursor); 1166058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm if (ret < 0) 11717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm { 1188e53e62db913470952b8eb541834b876f7a6882cArun Sharma Debug (2, "returning 0\n"); 1198e53e62db913470952b8eb541834b876f7a6882cArun Sharma return 0; 12017bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm } 1216058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm } 122aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma else if (is_plt_entry (&c->dwarf)) 123aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma { 1249e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura /* Like regular frame, CFA = RSP+8, RA = [CFA-8], no regs saved. */ 125aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma Debug (2, "found plt entry\n"); 1269e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->frame_info.cfa_reg_offset = 8; 1279e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->frame_info.cfa_reg_rsp = -1; 1289e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->frame_info.frame_type = UNW_X86_64_FRAME_STANDARD; 129aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0); 130aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma c->dwarf.cfa += 8; 131aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma } 132d4fbc8326a91d246af29ff17131a12ed7ae87140Lassi Tuura else if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP])) 133d4fbc8326a91d246af29ff17131a12ed7ae87140Lassi Tuura { 134d4fbc8326a91d246af29ff17131a12ed7ae87140Lassi Tuura for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) 135d4fbc8326a91d246af29ff17131a12ed7ae87140Lassi Tuura c->dwarf.loc[i] = DWARF_NULL_LOC; 136d4fbc8326a91d246af29ff17131a12ed7ae87140Lassi Tuura } 1376058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm else 1386058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm { 13917bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm unw_word_t rbp; 1406058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm 14117bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm ret = dwarf_get (&c->dwarf, c->dwarf.loc[RBP], &rbp); 14217bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm if (ret < 0) 14317bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm { 144d4fbc8326a91d246af29ff17131a12ed7ae87140Lassi Tuura Debug (2, "returning %d [RBP=0x%lx]\n", ret, 145d4fbc8326a91d246af29ff17131a12ed7ae87140Lassi Tuura DWARF_GET_LOC (c->dwarf.loc[RBP])); 14617bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm return ret; 14717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm } 14817bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm 14917bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm if (!rbp) 15017bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm { 15117bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm /* Looks like we may have reached the end of the call-chain. */ 15217bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm rbp_loc = DWARF_NULL_LOC; 15317bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm rsp_loc = DWARF_NULL_LOC; 15417bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm rip_loc = DWARF_NULL_LOC; 15517bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm } 15617bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm else 15717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm { 1589e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura unw_word_t rbp1 = 0; 15906d2ffa41abd7a13a0580492fb2ae76dc0f728e6Arun Sharma rbp_loc = DWARF_LOC(rbp, 0); 16017bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm rsp_loc = DWARF_NULL_LOC; 16106d2ffa41abd7a13a0580492fb2ae76dc0f728e6Arun Sharma rip_loc = DWARF_LOC (rbp + 8, 0); 16206d2ffa41abd7a13a0580492fb2ae76dc0f728e6Arun Sharma ret = dwarf_get (&c->dwarf, rbp_loc, &rbp1); 1639e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura Debug (1, "[RBP=0x%lx] = 0x%lx (cfa = 0x%lx) -> 0x%lx\n", 1649e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura (unsigned long) DWARF_GET_LOC (c->dwarf.loc[RBP]), 1659e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura rbp, c->dwarf.cfa, rbp1); 1669e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura 1679e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura /* Heuristic to determine incorrect guess. For RBP to be a 1689e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura valid frame it needs to be above current CFA, but don't 1699e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura let it go more than a little. Note that we can't deduce 1709e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura anything about new RBP (rbp1) since it may not be a frame 1719e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura pointer in the frame above. Just check we get the value. */ 1729e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura if (ret < 0 1739e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura || rbp <= c->dwarf.cfa 1749e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura || (rbp - c->dwarf.cfa) > 0x4000) 1759e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura { 1769e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura rip_loc = DWARF_NULL_LOC; 1779e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura rbp_loc = DWARF_NULL_LOC; 1789e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura } 1799e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura 1809e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->frame_info.frame_type = UNW_X86_64_FRAME_GUESSED; 1819e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->frame_info.cfa_reg_rsp = 0; 1829e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->frame_info.cfa_reg_offset = 16; 1839e98f15e9aee12e67cd5956d06ccb559f6a06213Lassi Tuura c->frame_info.rbp_cfa_offset = -16; 1848297866bd4dbe239fc778ac5a971aca9b80325d7Arun Sharma c->dwarf.cfa += 16; 18517bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm } 18617bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm 18717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm /* Mark all registers unsaved */ 18817bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) 18917bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm c->dwarf.loc[i] = DWARF_NULL_LOC; 1908e53e62db913470952b8eb541834b876f7a6882cArun Sharma 1918e53e62db913470952b8eb541834b876f7a6882cArun Sharma c->dwarf.loc[RBP] = rbp_loc; 1928e53e62db913470952b8eb541834b876f7a6882cArun Sharma c->dwarf.loc[RSP] = rsp_loc; 1938e53e62db913470952b8eb541834b876f7a6882cArun Sharma c->dwarf.loc[RIP] = rip_loc; 1946058013abe5b60291211458b0b71b87fad053ab9homeip.net!davidm } 195a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 196a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock c->dwarf.ret_addr_column = RIP; 197a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock 198aa3bb307a30a5b78bf1ae4ac843ae53e354736f5Arun Sharma if (!DWARF_IS_NULL_LOC (c->dwarf.loc[RIP])) 199a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock { 200a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip); 20106d2ffa41abd7a13a0580492fb2ae76dc0f728e6Arun Sharma Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n", 20206d2ffa41abd7a13a0580492fb2ae76dc0f728e6Arun Sharma (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]), 20306d2ffa41abd7a13a0580492fb2ae76dc0f728e6Arun Sharma (unsigned long long) c->dwarf.ip); 204a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock if (ret < 0) 20517bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm { 20617bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm Debug (2, "returning %d\n", ret); 20717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm return ret; 20817bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm } 209a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock } 210a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock else 211a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock c->dwarf.ip = 0; 21217bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm 21317bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm if (c->dwarf.ip == prev_ip && c->dwarf.cfa == prev_cfa) 21417bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm return -UNW_EBADFRAME; 215a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock } 21617bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm ret = (c->dwarf.ip == 0) ? 0 : 1; 21717bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm Debug (2, "returning %d\n", ret); 21817bf4d0af84466787d06f90c832dc93d3cd8843amostang.com!davidm return ret; 219a766efd844260866e0d216f6eeef87f4593f60b2ibm.com!masbock} 220