Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8bcf2e757bd59f550f8eb91b0b394e27a76405d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*******************************************************************************
 * Copyright (c) 2007 Wind River Systems, Inc. and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution, and is available at 
 * http://www.eclipse.org/legal/epl-v10.html 
 *  
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/
package com.windriver.debug.tcf.ui.model;

import com.windriver.tcf.api.protocol.IToken;
import com.windriver.tcf.api.services.IStackTrace;

public class TCFChildrenStackTrace extends TCFChildren {

    private final TCFChildren children_regs;

    TCFChildrenStackTrace(TCFNode node, TCFChildren children_regs) {
        super(node);
        this.children_regs = children_regs;
    }
    
    @Override
    boolean validate(TCFRunnable done) {
        children_next.clear();
        String addr = node.getAddress();
        if (addr == null) {
            doneValidate();
            return true;
        }
        String nm = node.id + "-TF";
        TCFNode n = children.get(nm);
        if (n == null) n = new TCFNodeStackFrame(node, nm, children_regs);
        children_next.put(n.id, n);
        IStackTrace st = node.model.getLaunch().getService(IStackTrace.class);
        if (st == null) {
            doneValidate();
            return true;
        }
        assert node.data_command == null;
        if (done != null) node.wait_list.add(done);
        node.data_command = st.getChildren(node.id, new IStackTrace.DoneGetChildren() {
            public void doneGetChildren(IToken token, Exception error, String[] contexts) {
                if (node.data_command != token) return;
                node.data_command = null;
                if (error != null) {
                    node.node_error = error;
                }
                else {
                    int cnt = contexts.length;
                    for (String id : contexts) {
                        TCFNode n = node.model.getNode(id);
                        if (n == null || ((TCFNodeStackFrame)n).getFrameNo() != cnt) {
                            n = new TCFNodeStackFrame(node, id, cnt);
                        }
                        assert ((TCFNodeStackFrame)n).getFrameNo() == cnt;
                        assert n.id.equals(id);
                        children_next.put(id, n);
                        cnt--;
                    }
                }
                doneValidate();
                node.validateNode(null);
            }
        });
        return false;
    }
}

Back to the top