Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to call existing C functions in executable file during debug session?
How to call existing C functions in executable file during debug session? [message #677655] Thu, 09 June 2011 04:54 Go to next message
Krasimir.K is currently offline Krasimir.KFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,
Before DSF I was able to call functions and evaluate variable/array values existing in executable program with a single code:
ICDITarget target;
ICDIStackFrame stackFrame;
....(wait on suspend and get target and stackFrame)...
String result = target.evaluateExpressionToString(stackFrame, "X");
where X can be variable, element of array, function, field in struct etc.

Now with DSF I'm able to read and set variables and array values with following code, but not to call function:


IExpressionDMContext expression = expr.createExpression(dmContext, "float_array[0]");
String formatId = IFormattedValues.NATURAL_FORMAT;
FormattedValueDMContext valueDmc = service.getFormattedValueContext(expression, formatId);
final DataRequestMonitor<IExpressionDMData> drm = new DataRequestMonitor<IExpressionDMData>(session.getExecutor(), null){
@Override
protected void handleCompleted() {
IExpressionDMData data = getData();
System.out.println("handleCompleted = " + getData());
}
};

final DataRequestMonitor<FormattedValueDMData> drmf = new DataRequestMonitor<FormattedValueDMData>(session.getExecutor(), null){
@Override
protected void handleCompleted() {
FormattedValueDMData data = getData();
String formattedValue = data.getFormattedValue();
System.out.println("handleCompleted formattedValue = " + formattedValue);
}
};

service.getExpressionData(expression, drm);
service.writeExpression(expression, "42", formatId, drmf);

I tried to create function expression with :
IExpressionDMContext funcCall = expr.createExpression(dmContext, "printX(\"5.5\")");
where printX is function in C source code (not mangled CPP function)
but getData() in DataRequestMonitor return null.

I tried to got answer from cdt/dsf plugins source but the only place which I found uses DebugPlugin.getDefault().getExpressionManager();
But this code include my function in Expression view, where I don't want to see it.

Can somebody give me a hint how I can do it?

BTW : I think that current DSF is much flexible then CDI and adding new debuggers can increase popularity of Eclipse in embedded world.

[Updated on: Thu, 09 June 2011 06:09]

Report message to a moderator

Re: How to call existing C functions in executable file during debug session? [message #684744 is a reply to message #677655] Thu, 16 June 2011 07:02 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
You should post your question on the CDT developer mailing list.

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:Setting breakpoint to running program and other bugs???
Next Topic:How to set environment variables from a script ?
Goto Forum:
  


Current Time: Fri Apr 19 20:08:16 GMT 2024

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

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

Back to the top