gaasedelen / tenet

A Trace Explorer for Reverse Engineers
MIT License
1.33k stars 131 forks source link

error loading trace file #6

Closed zixcoolx closed 3 years ago

zixcoolx commented 3 years ago

when loading trace file it shows this error:

[TENET] Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\context.py", line 270, in interactive_load_trace
    self.load_trace(filepath)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\context.py", line 177, in load_trace
    self.trace.attach_reader(self.reader)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\ui\trace_view.py", line 715, in attach_reader
    self.view.attach_reader(reader)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\ui\trace_view.py", line 621, in attach_reader
    self.trace_global.attach_reader(reader)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\ui\trace_view.py", line 126, in attach_reader
    self.set_zoom(0, reader.trace.length)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\ui\trace_view.py", line 264, in set_zoom
    self.refresh()
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\ui\trace_view.py", line 155, in refresh
    self._draw_trace()
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\ui\trace_view.py", line 334, in _draw_trace
    self._draw_cursor(painter)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\ui\trace_view.py", line 379, in _draw_cursor
    cursor_y = int(relative_idx / self.density) + BORDER_SIZE
ZeroDivisionError: float division by zero

Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_lines_rendering_info'
Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 397, in _render_lines
    self._highlight_disassesmbly(lines_out, widget, lines_in)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 449, in _highlight_disassesmbly
    if address == ctx.reader.ip:
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 79, in ip
    return self.get_register(self.arch.IP)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1462, in get_register
    return self.get_registers([reg_name], idx)[reg_name]
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1519, in get_registers
    output_registers[self.arch.IP] = self.trace.get_ip(idx)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 590, in get_ip
    raise ValueError("Invalid IDX")
ValueError: Invalid IDX
Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_lines_rendering_info'
Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 397, in _render_lines
    self._highlight_disassesmbly(lines_out, widget, lines_in)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 449, in _highlight_disassesmbly
    if address == ctx.reader.ip:
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 79, in ip
    return self.get_register(self.arch.IP)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1462, in get_register
    return self.get_registers([reg_name], idx)[reg_name]
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1519, in get_registers
    output_registers[self.arch.IP] = self.trace.get_ip(idx)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 590, in get_ip
    raise ValueError("Invalid IDX")
ValueError: Invalid IDX
Rebasing program to 0x56646000...
Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_lines_rendering_info'
Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 397, in _render_lines
    self._highlight_disassesmbly(lines_out, widget, lines_in)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 449, in _highlight_disassesmbly
    if address == ctx.reader.ip:
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 79, in ip
    return self.get_register(self.arch.IP)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1462, in get_register
    return self.get_registers([reg_name], idx)[reg_name]
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1519, in get_registers
    output_registers[self.arch.IP] = self.trace.get_ip(idx)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 590, in get_ip
    raise ValueError("Invalid IDX")
ValueError: Invalid IDX
Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_lines_rendering_info'
Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 397, in _render_lines
    self._highlight_disassesmbly(lines_out, widget, lines_in)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 449, in _highlight_disassesmbly
    if address == ctx.reader.ip:
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 79, in ip
    return self.get_register(self.arch.IP)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1462, in get_register
    return self.get_registers([reg_name], idx)[reg_name]
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1519, in get_registers
    output_registers[self.arch.IP] = self.trace.get_ip(idx)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 590, in get_ip
    raise ValueError("Invalid IDX")
ValueError: Invalid IDX
Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_lines_rendering_info'
Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 397, in _render_lines
    self._highlight_disassesmbly(lines_out, widget, lines_in)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 449, in _highlight_disassesmbly
    if address == ctx.reader.ip:
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 79, in ip
    return self.get_register(self.arch.IP)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1462, in get_register
    return self.get_registers([reg_name], idx)[reg_name]
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1519, in get_registers
    output_registers[self.arch.IP] = self.trace.get_ip(idx)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 590, in get_ip
    raise ValueError("Invalid IDX")
ValueError: Invalid IDX
Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_lines_rendering_info'
Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 397, in _render_lines
    self._highlight_disassesmbly(lines_out, widget, lines_in)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 449, in _highlight_disassesmbly
    if address == ctx.reader.ip:
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 79, in ip
    return self.get_register(self.arch.IP)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1462, in get_register
    return self.get_registers([reg_name], idx)[reg_name]
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1519, in get_registers
    output_registers[self.arch.IP] = self.trace.get_ip(idx)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 590, in get_ip
    raise ValueError("Invalid IDX")
ValueError: Invalid IDX
[TENET] Failed to load trace...
[TENET] Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\context.py", line 270, in interactive_load_trace
    self.load_trace(filepath)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\context.py", line 159, in load_trace
    self.reader = TraceReader(filepath, self.arch, disassembler[self])
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 59, in __init__
    self.trace = TraceFile(filepath, architecture)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 294, in __init__
    self._load_trace()
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 459, in _load_trace
    self._load_packed_trace(self.packed_filepath)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 470, in _load_packed_trace
    self._load_segments(zip_archive)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 533, in _load_segments
    segment.from_file(f)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 946, in from_file
    self.load(f)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 1196, in load
    ip_itemsize = info.ip_length // info.ip_num
ZeroDivisionError: integer division or modulo by zero

Exception in ida_kernwin.UI_Hooks dispatcher function: SWIG director method error. Error detected when calling 'UI_Hooks.get_lines_rendering_info'
Traceback (most recent call last):
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 397, in _render_lines
    self._highlight_disassesmbly(lines_out, widget, lines_in)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\integration\ida_integration.py", line 449, in _highlight_disassesmbly
    if address == ctx.reader.ip:
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 79, in ip
    return self.get_register(self.arch.IP)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1462, in get_register
    return self.get_registers([reg_name], idx)[reg_name]
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\reader.py", line 1519, in get_registers
    output_registers[self.arch.IP] = self.trace.get_ip(idx)
  File "C:/Users/alex/AppData/Roaming/Hex-Rays/IDA Pro/plugins\tenet\trace\file.py", line 590, in get_ip
    raise ValueError("Invalid IDX")
ValueError: Invalid IDX
gaasedelen commented 3 years ago

Can you provide the trace file and executable?

It looks like maybe the trace is empty? But it's hard to tell. I'm not sure why density would be 0.

zixcoolx commented 3 years ago

bin-trace.zip

gaasedelen commented 3 years ago

Hmm.. I was able to load the provided trace okay.

I think what happened is that you had a leftover .tt trace file that was 'empty' (e.g. from your previous, buggy traces) and Tenet was trying to load that over your new plaintext trace. I don't have any heuristics in place yet to see if the compressed trace with an identical filename matches the plaintext trace.

image

Please note, you will need to rebase the database to match the trace, though. I rebased to 0x56646000 and Tenet was able to track it.