mirror of https://github.com/Nonannet/copapy.git
asm html formatter added
This commit is contained in:
parent
00110f7747
commit
fcc5480126
|
|
@ -58,13 +58,11 @@ jobs:
|
||||||
python tools/make_example.py
|
python tools/make_example.py
|
||||||
python tools/extract_code.py "bin/test.copapy" "bin/test.copapy.bin"
|
python tools/extract_code.py "bin/test.copapy" "bin/test.copapy.bin"
|
||||||
objdump -D -b binary -m i386:x86-64 --adjust-vma=0x1000 bin/test.copapy.bin > bin/test.copapy.asm
|
objdump -D -b binary -m i386:x86-64 --adjust-vma=0x1000 bin/test.copapy.bin > bin/test.copapy.asm
|
||||||
echo '<p>test.copapy.asm</p><pre>' >> $GITHUB_STEP_SUMMARY
|
echo '<p>test.copapy.asm</p>' >> $GITHUB_STEP_SUMMARY
|
||||||
cat bin/test.copapy.asm >> $GITHUB_STEP_SUMMARY
|
python tools/clean_asm.py bin/test.copapy.asm >> $GITHUB_STEP_SUMMARY
|
||||||
echo '</pre>' >> $GITHUB_STEP_SUMMARY
|
objdump -d -x src/copapy/obj/stencils_x86_64_O3.o > bin/stencils_x86_64_O3.asm
|
||||||
objdump -d -j .text src/copapy/obj/stencils_x86_64_O3.o > bin/stencils_x86_64_O3.asm
|
echo '<p>stencils_x86_64_O3.asm</p>' >> $GITHUB_STEP_SUMMARY
|
||||||
echo '<p>stencils_x86_64_O3.asm</p><pre>' >> $GITHUB_STEP_SUMMARY
|
python tools/clean_asm.py bin/stencils_x86_64_O3.asm >> $GITHUB_STEP_SUMMARY
|
||||||
cat bin/stencils_x86_64_O3.asm >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo '</pre>' >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Run tests with pytest
|
- name: Run tests with pytest
|
||||||
run: pytest
|
run: pytest
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
import argparse
|
||||||
|
import re
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("path", type=str, help="Input file path")
|
||||||
|
#parser.add_argument("--abi", type=str, default="", help="Optionaler String (Standard: '')")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
regex = r"(\:\n)(.*?)(^[^\n]+\n[^\n]+result_.*?\n\n)"
|
||||||
|
subst = "\\g<1><b>\\g<2></b>\\g<3>"
|
||||||
|
|
||||||
|
with open(args.path, 'rt') as f:
|
||||||
|
text = f.read()
|
||||||
|
|
||||||
|
outp_flag = "Disassembly of section .text" not in text
|
||||||
|
|
||||||
|
text = text.replace('>', '>')
|
||||||
|
text = text.replace('<', '<')
|
||||||
|
|
||||||
|
text = re.sub(regex, subst, text, 0, re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
print('<code>')
|
||||||
|
for line in text.splitlines():
|
||||||
|
if outp_flag:
|
||||||
|
print(line.replace(' ', ' ') + '<br>')
|
||||||
|
|
||||||
|
if "Disassembly of section .text:" in line:
|
||||||
|
outp_flag = True
|
||||||
|
|
||||||
|
print('</code>')
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Loading…
Reference in New Issue