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

Incorrect Debug Exception Highlighting with Multiple Files of the Same Name #721

Closed
ghost opened this issue May 14, 2020 · 8 comments
Closed
Labels
bug Incorrect behaviour of the tool
Milestone

Comments

@ghost
Copy link

ghost commented May 14, 2020

Description

When an exception occurs, Overture attempts to highlight the line which the exception occurred on, however when a project contains multiple files with the same name in different directories, Overture displays the file in the first directory (alphabetically), and not the correct file.

Steps to Reproduce

  1. Create a project with at least two directories, for instance, dir1/ and dir2/.
  2. Create a .vdmsl file with the same name in each directory, for instance, dir1/type.vdmsl and dir2/type.vdmsl.
    structure
  3. Create a valid file in dir1/type.vdmsl.
    goodFile
  4. Create an invalid file / erroneous function in dir2/vdmsl.
    badFile
  5. Run the erroneous function.
    cmd

Expected behavior: The debugger highlights the erroneous line in the file where the exception occurred.
goodDebug

Actual behavior: The debugger highlights the corresponding line in the first file it finds, matching the name of the erroneous file.

badDebug

Reproduces how often: Always

Versions

Overture 2.7.2 Windows 10 x64

Additional Information

The issue was found when running the project as a console.

The exception chosen is one which occurs at runtime (Error 4: Cannot get bind values for type nat in 'DEFAULT'), although this is irrelavent for this bug.

@nickbattle
Copy link
Contributor

Thanks for reporting this. I can confirm that it is reproducible on the latest Overture 2.7.4 (on Linux, but it is unlikely to be a platform issue). It is the same whether launched from the console or a launcher.

I'll take a look. But it looks like it's making a naive file lookup at some point.

If it's causing a problem, an obvious workaround is to rename the file, though clearly this should work as expected.

@nickbattle nickbattle added the bug Incorrect behaviour of the tool label May 14, 2020
@nickbattle
Copy link
Contributor

It is behaving correctly in the pure command line - that is, the stand alone Overture jar. This suggests the problem is with the IDE/VDM communication of the stack location.

Parsed 1 module in 0.185 secs. No syntax errors
Type checked 1 module in 0.187 secs. No type errors
Initialized 1 module in 0.408 secs. 
Interpreter started
> p f(1)
Error 4134: Infinite or NaN trouble in 'DEFAULT' (dir2/types.vdmsl) at line 6:14
Stopped in 'DEFAULT' (dir2/types.vdmsl) at line 6:14
6:  	f(a) == a/0;
[MainThread-3]> q
Exception: terminated
Runtime: Error 4134: Infinite or NaN trouble in 'DEFAULT' (dir2/types.vdmsl) at line 6:14
> 

@ghost
Copy link
Author

ghost commented May 14, 2020

I assumed this would be the case, apologies for not testing direct execution of the jar myself, I could have narrowed down the issue a little more for you.

I only came across the issue as I was revising for an exam on VDM, and ended up with 2 different files named set.vdmsl. This is where I received the initial runtime error, and was suprised when Overture shows the line in the wrong file.

I'd love to suggest a solution myself, but I'm completely unfamiliar with the eclipse framework, and only know the very basics of Java File IO.

@nickbattle
Copy link
Contributor

I always test the stand-alone jar first, so I know whether it's the language engine or the IDE. If it's the language side, I'll know how to fix it :-)

It definitely looks like the IDE though, because the comms between the IDE and language engine includes the qualified file information:

>>	run -i 101
<<	<?xml version="1.0" encoding="UTF-8"?><response command="run" status="break" reason="error" transaction_id="101"><internal threadId="3" threadName="MainThread-3" threadState="RUNNING" /></response>
>>	stack_get -i 102
<<	<?xml version="1.0" encoding="UTF-8"?><response command="stack_get" transaction_id="102"><stack level="0" type="file" filename="file:/home/nick/FMIWorkspace/TestSL/dir2/types.vdmsl" lineno="6" cmdbegin="6:11"/></response>

So now I need to find someone who understands the IDE... :-(

@nickbattle
Copy link
Contributor

Thanks Hugo!

@nickbattle
Copy link
Contributor

I think there may be a problem with this fix.

I'm trying to do some "serious" debugging on the FMI spec, rather than the test example above. When it stops at a breakpoint and trying to open the source file concerned, it uses a bizarre paths like:

../../INTO-CPS-Association/FMI-VDM-Model/FMI3/ModelVariables_2.2.10.vdmsl line: 435	

I'll re-open this issue, as it looks like this is linked to the fix above?

@nickbattle nickbattle reopened this May 22, 2020
@nickbattle
Copy link
Contributor

(and those paths are not found, incidentally. So you get a blank editor pane with an invite to "Edit Source Path Lookup")

@nickbattle
Copy link
Contributor

Easiest way to reproduce this is to load the FMI2 model (https://github.com/INTO-CPS-Association/FMI-VDM-Model/tree/master/FMI2), and put a breakpoint on the start of the tests() function at the end of Tests.vdmsl:

	tests: () +> seq of bool
	tests() ==
	[
		testCausalityVariabilityInitial(),      <---- add a BREAK on this line
		isValidFMIModelDescription(example),
		isValidFMIModelDescription(springMassDamper)
	]
	^	testStructuredNames()

	post elems RESULT = {true};

Then just run DEFAULT'tests(). You'll see it stop on the line, but the file is reported (in my case) as ../../INTO-CPS-Association/FMI-VDM-Model/FMI2/Tests/Tests.vdmsl. This file is not found.

@idhugoid idhugoid added this to the v3.0.0 milestone Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behaviour of the tool
Projects
None yet
Development

No branches or pull requests

2 participants