Skip to content

Commit

Permalink
Added Debugging Logs: (#4130)
Browse files Browse the repository at this point in the history
Logs have been added to debug and resolve the following issues:
1. AttributeError: 'NoneType' object has no attribute 'stdin'
2. Line is too long for a stacktrace
  • Loading branch information
aditya-wazir committed Aug 14, 2024
1 parent 295208c commit 8451175
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def __init__(self, symbolizer_path, default_arch, system, dsym_hints=[]):

def open_llvm_symbolizer(self):
if not os.path.exists(self.symbolizer_path):
logs.info(f'os.path() does not have {self.symbolizer_path}')
return None

# Setup symbolizer command line.
Expand Down Expand Up @@ -274,6 +275,7 @@ def open_llvm_symbolizer(self):
global pipes
pipes.append(pipe)

logs.info(f'created pipe - {pipe}')
return pipe

def symbolize(self, addr, binary, offset):
Expand Down
4 changes: 4 additions & 0 deletions src/clusterfuzz/_internal/system/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import yaml

from clusterfuzz._internal import fuzzing
from clusterfuzz._internal.metrics import logs

# Tools supporting customization of options via ADDITIONAL_{TOOL_NAME}_OPTIONS.
# FIXME: Support ADDITIONAL_UBSAN_OPTIONS and ADDITIONAL_LSAN_OPTIONS in an
Expand Down Expand Up @@ -355,6 +356,7 @@ def get_llvm_symbolizer_path():
stderr=subprocess.DEVNULL)
if return_code == 0:
# llvm-symbolize works, return it.
logs.info(f'Environment Symbolizer Path :- {llvm_symbolizer_path}')
return llvm_symbolizer_path

# Either
Expand All @@ -365,10 +367,12 @@ def get_llvm_symbolizer_path():

# Make sure that we have a default llvm-symbolizer for this platform.
if not os.path.exists(llvm_symbolizer_path):
logs.info(f'None Symbolizer Path :- {llvm_symbolizer_path}')
return None

# Make sure that llvm symbolizer binary is executable.
os.chmod(llvm_symbolizer_path, 0o750)
logs.info(f'Default Symbolizer Path :- {llvm_symbolizer_path}')
return llvm_symbolizer_path


Expand Down
2 changes: 1 addition & 1 deletion src/clusterfuzz/stacktraces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ def should_ignore_line_for_crash_processing(line, state):
return True

if len(line) > 1024**2:
logs.error('Line is too long for a stacktrace.')
logs.error('Line is too long for a stacktrace', engine_output=line)
return True

return False
Expand Down

0 comments on commit 8451175

Please sign in to comment.