Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Disassembly Editor(I'd like to open the disassembly editor on default on an attached process instead of the Source Not Found Editor)
Disassembly Editor [message #1724410] Tue, 23 February 2016 18:10 Go to next message
Marc Kunze is currently offline Marc KunzeFriend
Messages: 6
Registered: May 2014
Junior Member
When attaching to a process without having any source code, it shows the "No source available" editor.
This can lead to a situation where only the "View Disassembly" button is visible:
index.php/fa/25085/0/

In that case, it seems it would make more sense to use the Disassembly Editor instead of the Disassembly View. Also, if there is only one option for the user "View Disassembly", why not show directly the disassembly editor without clicking on a button first?
That way, if the user clicks on a method in the debug view, the disassembly editor is shown directly.

I wanted to implement this by myself, but I am not very deep into the CDT code.
I figured out that it probably would be best to implement it in the DsfSourceDisplayAdapter class, which can set the editor to the disassembly editor.
I am not sure how I to construct the DisassemblyEditorInput.
But I think I'd need a ICDebugElement for this. But aren't these only available when I have a normal C(++) debug target, which is not the case here?
How can I use a DisassemblyEditor with an attached process?

Thank you very much in advance

[Updated on: Tue, 23 February 2016 18:12]

Report message to a moderator

Re: Disassembly Editor [message #1724411 is a reply to message #1724410] Tue, 23 February 2016 18:41 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
I don't know the current state of the disassembly editor, I know it was more in use in CDI (the older/deprecated debug interface that is replaced by DSF).

Have a look at org.eclipse.cdt.debug.internal.ui.disassembly.commands.OpenDisassemblyHandler. It uses the CDebugUIPlugin.getDefault().getDisassemblyEditorManager().openEditor(...) method to open the editor.

Also, if you look at CDI's equivalent of DsfSourceDisplayAdapter, org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceDisplayAdapter, you will find it also uses the getDisassemblyEditorManager() to open the editor, but it has extra logic to reuse current editor so that a new editor is not unnecessarily opened.

Jonah
Re: Disassembly Editor [message #1724413 is a reply to message #1724411] Tue, 23 February 2016 18:43 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
BTW What I forgot to mention is that above mentioned openEditor(...) is what indirectly creates the editor input (see org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorManager.getSourcePresentation().new ISourcePresentation() {...}.getEditorInput(Object))

Good luck.

Jonah
Re: Disassembly Editor [message #1724421 is a reply to message #1724413] Tue, 23 February 2016 19:57 Go to previous messageGo to next message
Marc Kunze is currently offline Marc KunzeFriend
Messages: 6
Registered: May 2014
Junior Member
OK, the disassembly editor seems to work in the same way as the disassembly view, but this is fine for me.
That way, only one disassembly editor can be active at the same time, showing the disassembly of the currently selected thread.
This is only shown case no file is in the frame data, so the user couldn't attach source anyway.
I am planning to prepare a pull request. Do you want to have a option to get the previous behaviour back? If yes, which should be the default?

Marc
Re: Disassembly Editor [message #1724431 is a reply to message #1724421] Tue, 23 February 2016 22:03 Go to previous message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Marc,

Can you repost this last question on cdt-dev mailing list https://dev.eclipse.org/mailman/listinfo/cdt-dev . The forum is primarily user support and cdt-dev is developing CDT itself as you are now doing!

I am not too sure about what the default should be. There are two use cases, each of which needs a different default, or other dealing with:

1) User is doing (typically) embedded development with their source code in an editor (on the left) and the disassembly view (on the right). In this case if I stepped into some code that did not have source lookup option (i.e. your above screenshot case) I wouldn't want or expect the location of my disassembly stepping to change.

2) User is doing (typically) host development where they would rarely or ever use the disassembly view because it is too low level. In this case having the disassembly editor used in your above case makes perfect sense.

That said, you can mitigate against option 1 by having the disassembly in both the editor and the view for your use case.



Jonah
Previous Topic:Eclipse debug setup
Next Topic:Selecting file from Search panel overwrites previous file
Goto Forum:
  


Current Time: Fri Apr 19 00:48:50 GMT 2024

Powered by FUDForum. Page generated in 0.02840 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top