Bug 412115 - Runcontrol resume on an unsupported mode reports context resumed.
Summary: Runcontrol resume on an unsupported mode reports context resumed.
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Agent (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.2   Edit
Assignee: Didier Brachet CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-02 10:46 EDT by Frederic Leger CLA
Modified: 2014-02-25 05:50 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Leger CLA 2013-07-02 10:46:55 EDT
While testing the RunControl resume command, I tried to send a resume request with an unsupported mode, but got a 'contextResumed' event.

On an opensource agent (linux), I tried to do a resume(RM_REVERSE_RESUME), and got a 'contextResumed' event, which I guess, is not true.

2013-07-02 16:38:23,669 : ---> C 20 RunControl getContext "P7571.7571" 
2013-07-02 16:38:23,675 : <--- R 20 None None  {"ID":"P7571.7571","ParentID":"P7571","ProcessID":"P7571","CanSuspend":true,"CanResume":12351,"HasState":true,"WordSize":8,"CanTerminate":true,"RCGroup":"P7571.7571","BPGroup":"P7571","SymbolsGroup":"P7571","CPUGroup":"CPU"} 
2013-07-02 16:38:23,693 : ---> C 21 RunControl getChildren "P7571" 
2013-07-02 16:38:23,694 : <--- R 21 None None  ["P7571.7571"] 
2013-07-02 16:38:23,717 : ---> C 22 RunControl resume "P7571.7571" 6 1 
2013-07-02 16:38:23,719 : <--- E None RunControl contextResumed "P7571.7571" 
2013-07-02 16:38:23,722 : <--- R 22 None None  
2013-07-02 16:38:23,724 : <--- E None RunControl contextChanged [{"ID":"P7571.7571","ParentID":"P7571","ProcessID":"P7571","CanSuspend":true,"CanResume":12351,"HasState":true,"WordSize":8,"CanTerminate":true,"RCGroup":"P7571.7571","BPGroup":"P7571","SymbolsGroup":"P7571","CPUGroup":"CPU"}] 
2013-07-02 16:38:23,732 : <--- E None RunControl contextSuspended "P7571.7571" 139777022629552 "Cannot resume. Unsupported command" {}

I agree that there is a :

2013-07-02 16:38:23,732 : <--- E None RunControl contextSuspended "P7571.7571" 139777022629552 "Cannot resume. Unsupported command" {}

Coming later on, but the fact that the context has been marked as 'Resumed' at a time is wrong to me.

The command should return an error from m y point of view, since the context says 'I cannot resume this mode' ...

Thanks
Comment 1 Didier Brachet CLA 2013-07-03 10:37:31 EDT
Eugene, do you foresee any problem if we test the resume mode in continue_debug_context() routine:

    else if (count != 1) {
        err = EINVAL;
    } 
    else if (!context_can_resume(ctx, mode)) {
        err = ERR_UNSUPPORTED;
    }
    else if (resume_context_tree(ctx) < 0) {
        err = errno;
    }

I have seen some ACPM code in runctrl.c especially when calling context_resume(); I was wondering if this could be problematic or not but I can't figure out why ACPM is used (run-control commands are not yet implemented in context-proxy.c).

Thanks,
Didier
Comment 2 Eugene Tarassov CLA 2013-07-03 14:08:50 EDT
(In reply to comment #1)
> Eugene, do you foresee any problem if we test the resume mode in
> continue_debug_context() routine:

Most resume modes are implemented by the service itself, not by context.c. So, yes, using context_can_resume() like that will cause problems.

> I have seen some ACPM code in runctrl.c especially when
> calling context_resume(); I was wondering if this could be problematic or
> not but I can't figure out why ACPM is used (run-control commands are not
> yet implemented in context-proxy.c).

Resume modes like "step over line" need line numbers and symbols info. Since the info can be provided by a remote services, resume command must use ACPM.
Comment 3 Didier Brachet CLA 2013-07-04 08:10:06 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Eugene, do you foresee any problem if we test the resume mode in
> > continue_debug_context() routine:
> 
> Most resume modes are implemented by the service itself, not by context.c.
> So, yes, using context_can_resume() like that will cause problems.

Of course, you are right. We should not use context_can_resume() but instead implement a routine to compute available modes similar to what is done in write_context(). 
> 
> > I have seen some ACPM code in runctrl.c especially when
> > calling context_resume(); I was wondering if this could be problematic or
> > not but I can't figure out why ACPM is used (run-control commands are not
> > yet implemented in context-proxy.c).
> 
> Resume modes like "step over line" need line numbers and symbols info. Since
> the info can be provided by a remote services, resume command must use ACPM.

But still, I don't understand why we have this code:

            if (context_resume(ctx, md, 0, 0) < 0) {
                int error = errno;
                if (get_error_code(error) == ERR_CACHE_MISS) return;
                resume_error(ctx, error);
            }

context_resume() cannot return ERR_CACHE_MISS (but maybe it will in the future).
Comment 4 Eugene Tarassov CLA 2013-07-05 11:59:32 EDT
(In reply to comment #3)

> Of course, you are right. We should not use
> context_can_resume() but instead implement a routine to compute available
> modes similar to what is done in write_context().

Yes, this would work.

> context_resume() cannot return ERR_CACHE_MISS (but maybe it will in the
> future).

In our proprietary implementation, context_resume() can return ERR_CACHE_MISS, because we use ACPM in our USB-JTAG access code.
Comment 5 Didier Brachet CLA 2013-07-11 04:14:22 EDT
Fix commited:

https://git.eclipse.org/r/#/c/14436/