OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [libdbg64g/] [services/] [exec/] [cmdexec.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 sergeykhbr
/*
2
 *  Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
3
 *
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
 *  you may not use this file except in compliance with the License.
6
 *  You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *  Unless required by applicable law or agreed to in writing, software
11
 *  distributed under the License is distributed on an "AS IS" BASIS,
12
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *  See the License for the specific language governing permissions and
14
 *  limitations under the License.
15 3 sergeykhbr
 */
16
 
17
#ifndef __DEBUGGER_CMDEXECUTOR_H__
18
#define __DEBUGGER_CMDEXECUTOR_H__
19
 
20
#include "iclass.h"
21
#include "iservice.h"
22
#include "coreservices/icmdexec.h"
23
#include "coreservices/itap.h"
24
#include "coreservices/iautocomplete.h"
25
#include "coreservices/isocinfo.h"
26
#include "coreservices/icommand.h"
27
#include <string>
28
#include <stdarg.h>
29
 
30
namespace debugger {
31
 
32
class CmdExecutor : public IService,
33
                    public ICmdExecutor {
34
public:
35
    explicit CmdExecutor(const char *name);
36
    virtual ~CmdExecutor();
37
 
38
    /** IService interface */
39
    virtual void postinitService();
40
 
41
    /** ICmdExecutor */
42
    virtual void registerCommand(ICommand *icmd);
43
    virtual void unregisterCommand(ICommand *icmd);
44
    virtual void exec(const char *line, AttributeType *res, bool silent);
45
    virtual void commands(const char *substr, AttributeType *res);
46
 
47
private:
48
    void processSimple(AttributeType *cmd, AttributeType *res);
49
    void processScript(AttributeType *cmd, AttributeType *res);
50
    void splitLine(char *str, AttributeType *listArgs);
51
 
52
    int outf(const char *fmt, ...);
53
    bool cmdIsError(AttributeType *res);
54
    ICommand *getICommand(AttributeType *args);
55
    ICommand *getICommand(const char *name);
56
 
57
private:
58
    AttributeType tap_;
59
    AttributeType socInfo_;
60
    AttributeType cmds_;
61
 
62
    ITap *itap_;
63
    ISocInfo *info_;
64
 
65
    mutex_def mutexExec_;
66
 
67
    char cmdbuf_[4096];
68
    char *outbuf_;
69
    int outbuf_size_;
70
    int outbuf_cnt_;
71
    uint8_t *tmpbuf_;
72
    int tmpbuf_size_;
73
};
74
 
75
DECLARE_CLASS(CmdExecutor)
76
 
77
}  // namespace debugger
78
 
79
#endif  // __DEBUGGER_CMDEXECUTOR_H__

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.