Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] Questions about Parallel Debug View


On Aug 9, 2013, at 12:06 AM, Krime <krimelam@xxxxxxxxx> wrote:

In Parallel Debug View, esp. an DebugAction or ParallelAction
1. How to get the nodes of current set? Can I get them by the view object?

I assume you mean the processes (tasks) of the current set? Sets don't contain nodes.

You would do something like this:

IElementManager manager = view.getUIManager();
if (manager instanceof UIDebugManager) {
UIDebugManager debugManager = (UIDebugManager)manager;
String currentSet = debugManager.getCurrentSetId();
TaskSet tasks = debugManager.getTasks(currentSet);
}

2. Suppose there's an IPSession object session, the following _expression_:
session.getPDISession().getExpressionManager().getExpressionValue(session.getTasks(), expr)
 will return an org.eclipse.ptp.debug.core.pdi.model.aif.IAIF object. I got confused that what if
 the 2nd parameter expr (String type) comes different results of all the task IDs (as the first
 parameter, TaskSet type)? I tried to assign it (or them?) to an aif object, but when I use
 aif.getValue().toString(), but it contains only 1 result, how can I get all of the different results?

It looks like getExpressionValue() only returns the value from the set of tasks exactly matching the argument, or if there is none, the value from a set of tasks that intersects the argument. 


 There's another _expression_
session.getPDISession().getExpressionManager().getMultiExpression(expr).getExpressions()
 will return an org.eclipse.ptp.debug.core.pdi.model.IPDIExpression array object, does it contain all
 of the available results?

Yes, it looks like getExpressions() should return all the different values. You can also use getExpressions(int) to get the result for a single task.

3. There's 2 kinds of pdi evaluate _expression_ requests about AIF, the IPDIEvaluateExpressionRequest
 and the IPDIEvaluateExpressionRequest, what's the difference between them? When and where can I use
 each of them?

Do you mean IPDIEvaluatePartialExpressionRequest?

The IPDIEvaluateExpressionRequest will obtain the complete value of an _expression_. For example, if the _expression_ evaluates to the contents of a multidimensional array, then the entire array will be returned. This also applies to other data structures, such as lists, so the entire list will be returned, not just the value of the first element. 

The IPDIEvaluatePartialExpressionRequest just returns the first "level" of the data structure. For a multidimensional array, this would be the values from the left most index of the array (multidimensional  arrays are represented as arrays of arrays). For a list, this would be the first element of the list.

Note however, I would advise against using the PDI interfaces directly if possible (it may not be possible). There are actually two levels of abstraction here. The top level is an extension of the platform debug API, and these interfaces are found in the org.eclipse.ptp.debug.* packages. The PDI API is a lower level abstraction of a parallel debugger and is  designed to allow different implementations to be used (although only one was ever developed). IMHO it was a mistake to provide ISession#getPDISession() and IDebugTarget#getPDITarget() since this implies that there is something missing from the top level API, whereas everything you need to do should be available via ISession and IDebugTarget directly. This is one part of the debugger I've been meaning to fix, but never had the time.


P.S. Can you give an example for all of the questions above respectively? Thanks a lot!!!
Btw: What does AIF stand for? What's it by the way?

AIF stands for Architecture Independent Format. It is a way of describing the data type and value of a variable (or _expression_) from the target program. It differs from other representations because it allows an entire data structure to be described. For example, if you have a binary tree, you could represent both the data type and the entire tree in AIF. It also provides an architecture neutral data representation, so variables from different architectures (e.g. big endian/little endian) will have the same representation.

It was originally created to support relative debugging. This is a debugging technique that allows two debug sessions to be run simultaneously, and the values of variables to be compared at trigger points during the application execution. This comparison extends to complex data types like arrays and lists, and the executing programs may be on different architectures, hence the requirement for a format like AIF.

This is another part of the debugger that I've been meaning to change. Supporting AIF adds considerable complexity that makes porting the SDM to use different back-end debuggers (currently gdb) much more difficult. It also adds complexity to the front-end (i.e. the Eclipse part). Currently the debugger doesn't implement relative debugging (and it seems unlikely that it ever will), nor does it use any of the support for complex data types, so all this extra complexity is not really benefiting anyone.

Initially, I'd like to drop support for complex data types since this is where the bulk of the back-end complexity arises. Ultimately I'd like to replace AIF altogether and just use simple strings, much the way that CDT does it now.


Thanks regards,
 Krime

_______________________________________________
ptp-dev mailing list
ptp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-dev

Cheers,
Greg

Back to the top