Skip to content

Commit

Permalink
move tuple to global scope
Browse files Browse the repository at this point in the history
  • Loading branch information
alfister authored and disconnect3d committed Oct 4, 2023
1 parent 2ad4a02 commit 72ab4aa
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions pwndbg/gdblib/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,25 @@
import pwndbg.ida
import pwndbg.lib.cache

# Symbol lookup only throws exceptions on errors, not if it failed to
# look up a symbol. We want to raise these errors so we can handle them
# properly, but there are some we haven't figured out how to fix yet, so
# we ignore those here
skipped_exceptions = None

skipped_exceptions = (
# This exception is being thrown by the Go typeinfo tests, we should
# investigate why this is happening and see if we can explicitly check
# for it with `gdb.selected_frame()`
"No frame selected",
# If we try to look up a TLS variable when there is no TLS, this
# exception occurs. Ideally we should come up with a way to check for
# this case before calling `gdb.lookup_symbol`
"Cannot find thread-local",
# This reproduced on GDB 12.1 and caused #1878
"Symbol requires a frame to compute its value",
)


def _get_debug_file_directory():
"""
Expand Down Expand Up @@ -122,25 +139,6 @@ def address(symbol: str) -> int:
if symbol_obj:
return int(symbol_obj.value().address)
except gdb.error as e:
# Symbol lookup only throws exceptions on errors, not if it failed to
# look up a symbol. We want to raise these errors so we can handle them
# properly, but there are some we haven't figured out how to fix yet, so
# we ignore those here
global skipped_exceptions

skipped_exceptions = (
# This exception is being thrown by the Go typeinfo tests, we should
# investigate why this is happening and see if we can explicitly check
# for it with `gdb.selected_frame()`
"No frame selected",
# If we try to look up a TLS variable when there is no TLS, this
# exception occurs. Ideally we should come up with a way to check for
# this case before calling `gdb.lookup_symbol`
"Cannot find thread-local",
# This reproduced on GDB 12.1 and caused #1878
"Symbol requires a frame to compute its value",
)

if all(x not in str(e) for x in skipped_exceptions):
raise e

Expand Down

0 comments on commit 72ab4aa

Please sign in to comment.