Skip to content

Commit

Permalink
Updated shared tasks iReport to have function pointer option
Browse files Browse the repository at this point in the history
  • Loading branch information
kylejacksonb committed Feb 24, 2025
1 parent f736b98 commit 36509df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 7 additions & 2 deletions Solutions/sharedTasks/sharedTasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, key: str, name: str, choices: list[str], default: str):
FUN_REF_KINDS_OPTION = ', Use Ptr'
OBJ_ENT_KINDS = 'Object'
OBJ_REF_KINDS = 'Modify, Set, Use'
OBJ_REF_KINDS_OPTION = ', Deref Call'

# Patterns to look for in sub-architectures
TASK_FIELDS = ('priority', 'core')
Expand Down Expand Up @@ -191,13 +192,17 @@ def globalObjRefs(function: Ent, options: dict[str, str | bool] | None = None) -

for otherFunction in [function] + function.ents('Instanceof'):
# Global objects
for ref in otherFunction.refs(OBJ_REF_KINDS, 'Global Object'):
refKinds = OBJ_REF_KINDS
if options[FUNCTION_POINTER] == 'On':
refKinds += OBJ_REF_KINDS_OPTION

for ref in otherFunction.refs(refKinds, 'Global Object'):
if not memberObjectParents and entHasMembers(ref.ent()):
continue
result.append(ref)
# Members of global objects
if memberObjects:
for ref in otherFunction.refs(OBJ_REF_KINDS, 'Member Object'):
for ref in otherFunction.refs(refKinds, 'Member Object'):
if not isMemberOfGlobal(ref.ent()):
continue
result.append(ref)
Expand Down
5 changes: 4 additions & 1 deletion Solutions/sharedTasks/sharedTasksCSV.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def generateCSVRows(db: Db, arch: Arch, options: dict[str, str | bool], lines: l
# header
headerFields = [field for field in TASK_FIELDS if field in foundFields]

header = 'Global Object, Shared, Protected, Function, Reference(M=Modify/S=Set/U=Use), File, Task'
referenceString = "Reference(M=Modify/S=Set/U=Use)"
if options[FUNCTION_POINTER] == 'On':
referenceString = "Reference(M=Modify/S=Set/U=Use/C=Call)"
header = 'Global Object, Shared, Protected, Function, ' + referenceString + ', File, Task'
if headerFields:
header += ', ' + ', '.join(field.capitalize() for field in headerFields)
header += '\n'
Expand Down
2 changes: 0 additions & 2 deletions Solutions/sharedTasks/sharedTasksCSV.upy
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def test_architecture(arch: Arch) -> bool:
def init(report: IReport):
for option in CSV_OPTIONS:
# Checkbox
if option.name == "Function Pointer":
continue
if option.choices == OPTION_BOOL_CHOICES:
report.options().checkbox(option.key, option.name, option.default == OPTION_BOOL_TRUE)
# Choice
Expand Down

0 comments on commit 36509df

Please sign in to comment.