bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/16396] Can't get address、filename、line number on aix 6.1 b


From: dongbiao830415 at foxmail dot com
Subject: [Bug binutils/16396] Can't get address、filename、line number on aix 6.1 by addr2line!
Date: Sun, 05 Jan 2014 16:23:30 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=16396

--- Comment #1 from DongBiao <dongbiao830415 at foxmail dot com> ---
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/ldr.h>
#include <errno.h>

typedef struct stackFrame {
    struct stackFrame *back;             /* -> previous stack.*/
    void              *savedCR;
    void              *savedLR;          /* Saved link address.*/  
} stackFrame;

void GetBackTrace()
{
    /*Get current stack pointer*/
    ucontext_t u;
    if(0 != getcontext(&u))
        return;
    stackFrame* sp = (stackFrame *)u.uc_mcontext.jmp_context.gpr[1];
    while(sp)
    {
    printf("%p\n",  sp->savedLR);
        sp=sp->back;
    }
}

void func1()
{
    GetBackTrace();
}

void func2()
{
    func1();
}

/*cc  -qtbtable=full -qlinedebug -q64 -g -o stack stack.c*/
int main()
{
    GetModuleName();
    func2();
    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

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