eclipse-xtext / eclipse-xtext/xtext

[JvmModelGenerator] No Debug Trace Region created for Method as a whole

Open
#2,347 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

Consider following (Xtend) code

package xxxxx

class Foo {
	
	def void foo1() {
		foo2
 		println("bar")
	}
	
	def void foo2() {
		
	}
	
	def static void main(String[] args) {
		new Foo().foo1
	}
	
}

when debugging inside foo1 and doing a step into foo2 (which is an empty method)
then you will get following situation

bug_debug1

as you can see the (closing) bracket in foo2 gets labled as line: not available

this is caused by how we create the trace regions

  [18[public [19,20[void]20,19] [21[foo2]21]() {                                                               | 	}]18]
  }]18]   

18:   198-024     DebugTraceBasedRegion -> LocationData[79,23] {
19:   205-004       DebugTraceBasedRegion -> LocationData[83,4] {
20:   205-004         DebugTraceBasedRegion -> LocationData[83,4]
19:                 }
21:   210-004       DebugTraceBasedRegion -> LocationData[88,4]
18:     

as you can see e.g. 18 is not marked as "Debug" (letter D after debug region)

if i have a look at the source code

org.eclipse.xtext.xbase.compiler.TreeAppendableUtil.traceWithComments(ITreeAppendable, EObject)

called from org.eclipse.xtext.xbase.compiler.JvmModelGenerator.generateMembersInBody(JvmDeclaredType, ITreeAppendable, GeneratorConfig)

i can see that org.eclipse.xtext.xbase.compiler.output.TreeAppendable.trace is called with useForDebugging=false

do i overlook something?

@svenefftinge @spoenemann @szarnekow can you give some hints

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in org.eclipse.xtext.xbase.compiler.TreeAppendableUtil.traceWithComments(ITreeAppendable, EObject), following its call from JvmModelGenerator.generateMembersInBody and the TreeAppendable.trace invocation. Compare the generated trace regions for an empty foo2 method, and consider the issue resolved when the method as a whole receives a debug trace region and its closing bracket no longer shows “line: not available”.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.