From 7cb29c5b89dbea487a3e1b35a61b18c42da559ef Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 18 Apr 2021 18:49:27 +0200 Subject: [PATCH] added escape character deocoding for ascii and asciiz pseudo-ops --- riscemu/ExecutableParser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riscemu/ExecutableParser.py b/riscemu/ExecutableParser.py index f8a438f..aef7b37 100644 --- a/riscemu/ExecutableParser.py +++ b/riscemu/ExecutableParser.py @@ -87,13 +87,13 @@ class ExecutableParser: def op_ascii(self, op: 'RiscVPseudoOpToken'): ASSERT_IN(self.active_section, ('data', 'rodata')) ASSERT_LEN(op.args, 1) - str = op.args[0][1:-1] + str = op.args[0][1:-1].encode('ascii').decode('unicode_escape') self.curr_sec().add(bytearray(str, 'ascii')) def op_asciiz(self, op: 'RiscVPseudoOpToken'): ASSERT_IN(self.active_section, ('data', 'rodata')) ASSERT_LEN(op.args, 1) - str = op.args[0][1:-1] + str = op.args[0][1:-1].encode('ascii').decode('unicode_escape') self.curr_sec().add(bytearray(str + '\0', 'ascii')) def op_stack(self, op: 'RiscVPseudoOpToken'):