示例#1
0
文件: thread.c 项目: abrt/btparser
int thread_rebuild_python_list(ThreadObject *thread)
{
    struct btp_frame *newlinkedlist = btp_frame_dup(thread->thread->frames, true);
    if (thread_free_frame_python_list(thread) < 0)
    {
        struct btp_frame *next;
        while (newlinkedlist)
        {
            next = newlinkedlist->next;
            btp_frame_free(newlinkedlist);
            newlinkedlist = next;
        }
        return -1;
    }
    /* linked list */
    thread->thread->frames = newlinkedlist;
    /* python list */
    thread->frames = frame_linked_list_to_python_list(thread->thread);
    if (!thread->frames)
    {
        struct btp_frame *next;
        while (newlinkedlist)
        {
            next = newlinkedlist->next;
            btp_frame_free(newlinkedlist);
            newlinkedlist = next;
        }
        return -1;
    }

    return 0;
}
示例#2
0
文件: frame.c 项目: abrt/btparser
/* methods */
PyObject *p_btp_frame_dup(PyObject *self, PyObject *args)
{
    FrameObject *this = (FrameObject *)self;
    FrameObject *fo = (FrameObject *)PyObject_New(FrameObject, &FrameTypeObject);
    if (!fo)
        return PyErr_NoMemory();
    fo->frame = btp_frame_dup(this->frame, false);

    return (PyObject *)fo;
}
示例#3
0
文件: backtrace.c 项目: abrt/btparser
struct btp_backtrace *
btp_backtrace_dup(struct btp_backtrace *backtrace)
{
    struct btp_backtrace *result = btp_backtrace_new();
    memcpy(result, backtrace, sizeof(struct btp_backtrace));

    if (backtrace->crash)
        result->crash = btp_frame_dup(backtrace->crash, false);
    if (backtrace->threads)
        result->threads = btp_thread_dup(backtrace->threads, true);
    if (backtrace->libs)
        result->libs = btp_sharedlib_dup(backtrace->libs, true);

    return result;
}
示例#4
0
文件: backtrace.c 项目: abrt/btparser
struct btp_frame *
btp_backtrace_get_crash_frame(struct btp_backtrace *backtrace)
{
    backtrace = btp_backtrace_dup(backtrace);

    struct btp_thread *crash_thread = btp_backtrace_find_crash_thread(backtrace);
    if (!crash_thread)
    {
        btp_backtrace_free(backtrace);
        return NULL;
    }

    btp_normalize_backtrace(backtrace);
    struct btp_frame *crash_frame = crash_thread->frames;
    crash_frame = btp_frame_dup(crash_frame, false);
    btp_backtrace_free(backtrace);
    return crash_frame;
}
示例#5
0
文件: thread.c 项目: rplnt/abrt
struct btp_thread *
btp_thread_dup(struct btp_thread *thread, bool siblings)
{
    struct btp_thread *result = btp_thread_new();
    memcpy(result, thread, sizeof(struct btp_thread));

    /* Handle siblings. */
    if (siblings)
    {
        if (result->next)
            result->next = btp_thread_dup(result->next, true);
    }
    else
        result->next = NULL; /* Do not copy that. */

    result->frames = btp_frame_dup(result->frames, true);

    return result;
}