Skip to content

Cannot set breakpoint in decompiled class during debugging #44

@helospark

Description

@helospark

Description

When trying to set a breakpoint in a ECD decompiled class file, the toggle action is ignored without any log or exception.

Repro:

  • Start debugging a project
  • Open a class with decompiler editor
  • Try to set breakpoint
  • Observe there are no logs and the breakpoint is not added either

Cause

I've done a little investigation, and it may a regression after #37 .
In the DecompileUtil.mapSources method a fallback is applied in case of the "mapSource" method is not found here. This is triggered by NoSuchMethodError, however ReflectionUtil.invokeMethod fails silently here and here, therefore the code can never get to the fallback.

And the already existing sourceRange mapping is removed by this time in DecompileUtil, which later causes org.eclipse.debug to fail to find the source and ignore the add breakpoint toggle.

Another issue (?) seems to be, that the DecompileUtil is called with org.eclipse.jdt.internal.core.SourceMapper instance, not DecompilerSourceMapper which contains switchMapSource when invoked during debugging (class is opened by ctrl+shift+t -> Open Type).

Solution could be to find the correct method using ReflectionUtils.getDeclaredMethod and once the method is found call that (and not rely on the exceptions, or on switchMapSource).

This may also cause #35

If you want I can open a PR with the fix.

Installation info

ECD: 3.1.0
Eclipse: Photon (I20180611-0500)
Platform: Windows and Linux

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions