Skip to content

Commit 9c05ef0

Browse files
committed
Add tool to extract input bytes from debu glog
1 parent ed0f4cd commit 9c05ef0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/extract_bytes_from_debuglog

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# The file name is passed as an argument to the script
4+
file=$1
5+
6+
# Use awk to extract the relevant lines and the hex bytes
7+
hex_values=$(awk '
8+
BEGIN { output = "" }
9+
/VT100Parser.m:309/ {
10+
# Split the line into fields using a colon as the delimiter
11+
split($0, fields, ":")
12+
# The hex bytes are in the last field, remove the trailing part
13+
sub(/ \(.*/, "", fields[5])
14+
# Add the hex bytes to the output string
15+
output = output fields[5]
16+
}
17+
END {
18+
# Trim leading and trailing spaces
19+
gsub(/^ +| +$/, "", output)
20+
print output
21+
}' $file)
22+
23+
# Convert the hex values to ASCII
24+
for hex in $hex_values; do
25+
printf "\x$hex"
26+
done
27+
echo
28+
29+

0 commit comments

Comments
 (0)