[Gambas-user] Debugging Gambas (again)

Jussi Lahtinen jussi.lahtinen at gmail.com
Sun Apr 28 00:24:27 CEST 2019


BTW, Jussi, I wrote a comprehensive byte-code interpreter in 8086 assembly
> in Real Mode as a DOS 3.1 TSR that was used in production for several
> years, circa 1988
>

Segmentation fault means that the program is trying to access memory
address, which it doesn't have privileges to access. So, you can right away
say it is *definitely not *capacity issue or "bad case scenario" in the
program logic, as you suggested. How could it be? Also whether the program
causes crash right away or later, says absolutely *nothing* about where the
bug is. It just cannot, not even in theory.

Test this:

Dim p As Pointer = 1
Dim hStream As Stream

hStream = Memory p For Write
Print #hStream, "hello!"
Close hStream

There is no segmentation fault, but "write error" from Gambas. Why? Because
if errors are not caught by Gambas, then they can lead to undetermined
behaviour later. Thus this "However, adding parameter validation testing to
every function call is a questionable endeavor" is also sign of not
understanding at all what you are talking about.

Once more:
Segmentation fault = operating system tells that Gambas tried to do
something illegal.
The "clean" errors = Gambas tells the programmer, that he tried to do
something illegal.


Jussi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190428/9897e268/attachment.html>


More information about the User mailing list