mirror of
https://github.com/TheOnlyZac/sly1.git
synced 2024-11-26 23:20:43 +00:00
Add linux CodeMatcher and new scripts
This commit is contained in:
parent
dba5ceba88
commit
0f9c7b7498
BIN
tools/codematcher
Executable file
BIN
tools/codematcher
Executable file
Binary file not shown.
8
tools/match_all.sh
Executable file
8
tools/match_all.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source tree path is absolute path to ../src/P2
|
||||
source_tree_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../src/P2"
|
||||
|
||||
# Invoke codematcher to compile and match source tree
|
||||
echo "Matching source tree..."
|
||||
./codematcher may_proto.elf --compile $source_tree_path
|
35
tools/match_file.sh
Executable file
35
tools/match_file.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the name of the source file as a parameter
|
||||
source_file="$1"
|
||||
|
||||
# Check if the source file parameter is empty
|
||||
if [ -z "$source_file" ]; then
|
||||
echo "No source file specified!"
|
||||
echo " Usage: $0 <source_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Strip the extension from the source file
|
||||
source_basename="$(basename "$source_file" | cut -d. -f1)"
|
||||
|
||||
# Get the directory of the script
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Move one level above the script
|
||||
pushd "$script_dir/.." >/dev/null
|
||||
|
||||
# Call make to compile the object file
|
||||
echo "Compiling $source_basename.o..."
|
||||
make "obj/debug/$source_basename.o"
|
||||
|
||||
# Move to the script directory
|
||||
popd >/dev/null
|
||||
pushd "$script_dir" >/dev/null
|
||||
|
||||
# Invoke codematcher with the compiled object file
|
||||
echo "Matching $source_basename.o..."
|
||||
./codematcher may_proto.elf --match "../obj/debug/$source_basename.o"
|
||||
|
||||
# Move back to the original directory
|
||||
popd >/dev/null
|
31
tools/match_function_live.sh
Executable file
31
tools/match_function_live.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get name of source file and target function as parameters
|
||||
source_file="$1"
|
||||
target_function="$2"
|
||||
|
||||
# Check if the source file parameter is empty
|
||||
if [ -z "$source_file" ]; then
|
||||
echo "No source file specified!"
|
||||
echo " Usage: $0 <source_file> <target_function>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the target function parameter is empty
|
||||
if [ -z "$target_function" ]; then
|
||||
echo "No target function specified!"
|
||||
echo " Usage: $0 <source_file> <target_function>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Strip the extension from the source file
|
||||
source_basename="$(basename "$source_file" | cut -d. -f1)"
|
||||
|
||||
# Match command: match_file script grepped with relevant lines
|
||||
match_file_cmd="./match_file.sh $source_file | grep -e'------------' -e'+' -e'$target_function'"
|
||||
|
||||
# Dump command: ee-objdump grepped with regex matching everything from the function name to a blank line
|
||||
dump_file_cmd="wine ~/.wine/drive_c/usr/local/sce/ee/gcc/bin/ee-objdump.exe -d ../obj/debug/$source_basename.o | grep -e'$target_function' -A1000 -e'^$'"
|
||||
|
||||
# Watch the match_single script with the source file and dump file commands
|
||||
watch -n 1 --color "( $match_file_cmd && $dump_file_cmd )"
|
Loading…
Reference in New Issue
Block a user