diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-21 22:25:00 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-21 22:25:00 -0700 |
commit | d47f3a82786c7d3abdb1001c2562780d0e1fab2e (patch) | |
tree | cd30cf4975ab70ceb427ee0f025f0804885fd8d8 /subx/examples/ex7 | |
parent | ef47911ff39c865aa2e65af442a03ddd8c2b1aa4 (diff) | |
download | mu-d47f3a82786c7d3abdb1001c2562780d0e1fab2e.tar.gz |
4584 - discrepancy between SubX and native x86
One of the more painful things I had to debug with machine code. Tricks I used can be seen in ex10.subx: - printing argv[1] in various places - printing a single 'X' in various places to count how many times we get to different instructions - exiting with the current value of EAX in various places I repeatedly went down the wrong trail in several ways: - forgetting that the problem lay in native runs, and accidentally switching to subx runs during debugging. - forgetting to pass commandline args, because ex10 doesn't check its argv - writing the wrong comment for an instruction, and then miscalculating the set of registers that need to be saved. - forgetting that syscalls clobber EAX. Debugging native runs is hard, because you have to write non-trivial code to instrument the binary, and instrumentation can itself be buggy. When we finally tracked it down, I recognized the problem immediately. I'd meant to confirm the behavior of opcode 8a against bare metal, and then forgot. In any case, opcode 8a was inconsistent with 88. Sloppy.
Diffstat (limited to 'subx/examples/ex7')
0 files changed, 0 insertions, 0 deletions