def inspect_stacktrace()

in crashclouseau/inspector.py [0:0]


def inspect_stacktrace(data, build_node):
    """Inspect the stack from the data and the check that the hg node
    from the build is the same that the one we have in stack data
    (the nodes could be different when the crash was occuring during an update)"""
    res = []
    files = set()
    dump = data["json_dump"]
    max_frames = 50
    if "threads" in dump:
        N = dump["crash_info"].get("crashing_thread")
        if N is not None:
            frames = dump["threads"][N]["frames"]
            frames = frames[0:max_frames]
            for n, frame in enumerate(frames):
                uri = frame.get("file")
                filename, node = get_path_node(uri)
                if node:
                    if node != build_node:
                        return [], set()
                    files.add(filename)
                fun = frame.get("function", "")
                line = frame.get("line", -1)
                module = frame.get("module", "")
                res.append(
                    {
                        "original": uri,
                        "filename": filename,
                        "changesets": [],
                        "module": module,
                        "function": fun,
                        "line": line,
                        "node": node,
                        "internal": node != "",
                        "stackpos": n,
                    }
                )
    return res, files