[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Customizing debug hierarchy and LaunchVMAdapter
|
Yeah, GdbExtendedAdapterFactory is 400 lines of copy-paste ;-)
I did succeed in extending it without repeating code, per patch below - is it about right?
Note that so far I've tweaked label for threads - so I might run into more troubles further.
- Volodya
On 09/12/2014 12:24 AM, Marc Khouzam wrote:
This is exactly what I was hoping to figure out. I've posted an example that extends DSF-GDB.
This is how I got things to work, but this is my first try at actually extending it.
http://eclip.se/441277
I also had a lot of trouble extending GdbAdapterFactory.
I was hoping others could provide feedback on what Vladimir is describing below to see
if there is a better way as of now.
From what I tried, we are good at extending the DSF services and handling GDB versions,
but we need to improve on allowing extension of the view model.
Vladimir seems to have experienced the same results.
Anyone else?
Index: org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java
===================================================================
--- org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java (revision 436379)
+++ org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java (working copy)
@@ -70,6 +70,7 @@
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMAdapter;
import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.DebugPlugin;
@@ -106,7 +107,7 @@
@Immutable
class SessionAdapterSet {
final GdbLaunch fLaunch;
- final GdbViewModelAdapter fViewModelAdapter;
+ final AbstractVMAdapter fViewModelAdapter;
final DsfSourceDisplayAdapter fSourceDisplayAdapter;
final DsfStepIntoCommand fStepIntoCommand;
final DsfStepIntoSelectionCommand fStepIntoSelectionCommand;
@@ -147,7 +148,7 @@
fSteppingController = new SteppingController(session);
session.registerModelAdapter(SteppingController.class, fSteppingController);
- fViewModelAdapter = new GdbViewModelAdapter(session, fSteppingController);
+ fViewModelAdapter = createViewModelAdapter(session, fSteppingController);
session.registerModelAdapter(IViewerInputProvider.class, fViewModelAdapter);
if (launch.getSourceLocator() instanceof ISourceLookupDirector) {
@@ -429,4 +430,9 @@
public void launchesChanged(ILaunch[] launches) {
}
+ protected AbstractVMAdapter createViewModelAdapter(DsfSession session, SteppingController steppingController)
+ {
+ return new GdbViewModelAdapter(session, steppingController);
+ }
+
}
Index: org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java
===================================================================
--- org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java (revision 436379)
+++ org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java (working copy)
@@ -57,7 +57,11 @@
{
super(adapter, presentationContext, session);
- IRootVMNode launchNode = new LaunchRootVMNode(this);
+ createNodes();
+ }
+
+ protected void createNodes() {
+ IRootVMNode launchNode = new LaunchRootVMNode(this);
setRootNode(launchNode);
// Container node to contain all processes and threads
@@ -70,7 +74,7 @@
IVMNode stackFramesNode = new StackFramesVMNode(this, getSession());
addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
- }
+ }
@Override
protected boolean canSkipHandlingEvent(Object newEvent, Object eventToSkip) {
--
Vladimir Prus
CodeSourcery / Mentor Graphics
http://www.mentor.com/embedded-software/