Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembler terminates without error message #64

Closed
pol-rivero opened this issue Jan 4, 2021 · 1 comment
Closed

Assembler terminates without error message #64

pol-rivero opened this issue Jan 4, 2021 · 1 comment

Comments

@pol-rivero
Copy link

I found a small bug on the latest version 0.11.3. Let's say I want to assemble the following code:

#subruledef REG {
    my_reg => 0xA
}
#ruledef {
    test {Addr: u16} => 0x1 @ Addr
    test {register: REG} + {Not_Imm: u16} => register`4 @ Imm
}

test my_reg + 1

Version 0.11.2 succesfully identifies that I was trying to use the second instruction (test {register: REG} + {Not_Imm: u16}), and that I had made a typo (I typed Not_Imm: u16 instead of Imm: u16). Therefore, it correcly displays the error message

error: unknown variable
test {register: REG} + {Not_Imm: u16} => register`4 @ Imm
                                                      ^^^

However, version 0.11.3 doesn't show any error message and just terminates with exit code 1. Its only output is

customasm v0.11.3 (2020-12-05, x86_64-pc-windows-gnu)
assembling `test.asm`...

Again, it's a pretty small bug that only happens on this edge case, but it's rather confusing to not have any indication on what went wrong, specially when assembling large files.

@clubby789
Copy link
Contributor

clubby789 commented Jan 4, 2021

Tracked the problem down to

pub fn print_all(&self, writer: &mut dyn Write, fileserver: &dyn FileServer)
{
for msg in &self.messages
{
self.print_msg(writer, fileserver, msg, 0);
writeln!(writer).unwrap();
}
}
The for loop isn't run at all. Printing the length of report.messages every time a new message is pushed outputs '1' several times, so somewhere the messages seem to be getting lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants