-
Notifications
You must be signed in to change notification settings - Fork 157
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
Exception in DOS #22
Comments
Well, this is where it stops being funny. These are not C++ exceptions, but memory safety issues. DPMI32 executables are also unstable for me. I don't know if this is a memory issue in Turbo Vision that can be easily fixed, or if it's just a limitation of the DPMI32 model. I'm not even sure this can be debugged with
Then it should be possible to debug with
Did you copy it manually from the manual? The C++ manual was written for Turbo Vision 1.0, so the program could contain a bug. If you are familiar with Linux development and valgrind, you can try it there first. My point is: as long as the program logic does not depend on DOS, it can be tested on a platform that's easier to debug for. I said Linux, but this is valid for Visual Studio as well. |
Building my code against the Borland-supplied TV works. If nothing else, I can fall back to that for DOS. The code I'm using is basically what is in the TV C++ manual but sanity checked against the tutorial code provided by this port: I'll try to get a debugger going after I get some more TV under my belt. Right now I only know enough to be dangerous. |
Hey Sduensin. as far as I can tell, this port is closer to original then set-soft's (based on the readme anyways) I'll tell you the same on discord as well. |
Okay, I can reproduce. It seems that you can work around the issue by changing !if $d(DOS32)
# This is done in several variables to work around the 'Command arguments too
-EXCLUDE2 = TVEXPOSD.CPP TVWRITE.ASM
+EXCLUDE2 = TVEXPOSD.CPP TVWRITE.CPP
EXCLUDE1 = EDITS.ASM FRAMELIN.ASM TVCURSOR.ASM TGRMV.ASM TTPRVLNS.ASM
!else
Yes, this is right. This port is backward-compatible, and most code that compiles for the original also compiles for this one. |
I recompiled Turbo Vision, and I can no longer reproduce. This is a serious issue, because I haven't changed a single line of code (not even the makefile suggestion above). |
If you can reproduce the issue with a debug build, please share the binary. |
Probably useless, but here are disassembles of the instructions with illegal memory access (typed from screenshots, disassembled at https://defuse.ca/online-x86-assembler.htm) At least it's surely not the code in tvwrite.asm (no
|
But it indeed does look like it overruns some buffer, and it's just a matter of luck whether memory allocator already allocated adjacent pages from OS (in that case it goes unnoticed) or not (in which case memory protection triggers). |
Hi @mooskagh, thanks for investigating. I was able to get a trace the first time I reproduced the issue, and it was something like this:
This made me suspect of But I absolutely wasn't expecting the issue to disappear after rebuilding. I cannot reproduce it anymore. So if anyone else can reproduce with a debug build, please share the binaries. |
I found this while investigating #22, but I doubt this is the cause of that issue, since the disassebly points out to a write instruction.
Problem user here again. :-) This is the demo program from the TV C++ manual. Pressing F4 should open a window that displays a source file. Instead it throws an exception.
Pressing F4 should open a dialog but I get another exception:
I am able to pull down menus but that's it.
(To be sure it's not DOSBox, I also tried it in VirtualBox in an NT 4.0 command prompt.)
The text was updated successfully, but these errors were encountered: