#ifndef __NASAL_DBG_H__ #define __NASAL_DBG_H__ #include "nasal_vm.h" class nasal_dbg:public nasal_vm { private: bool next_step; usize fsize; u16 bk_fidx; u32 bk_line; fstreamline src; std::vector parse(const std::string&); u16 fileindex(const std::string&); void err(); void help(); void stepinfo(); void interact(); public: nasal_dbg(): next_step(false),fsize(0), bk_fidx(0),bk_line(0){} void run( const nasal_codegen&, const nasal_import&, const std::vector& ); }; std::vector nasal_dbg::parse(const std::string& cmd) { std::vector res; usize last=0,pos=cmd.find(" ",0); while(pos!=std::string::npos) { if(pos>last) res.push_back(cmd.substr(last,pos-last)); last=pos+1; pos=cmd.find(" ",last); } if(last\n" <<"\th, help | get help\n" <<"\tbt, backtrace | get function call trace\n" <<"\tc, continue | run program until break point or exit\n" <<"\tf, file | see all the compiled files\n" <<"\tg, global | see global values\n" <<"\tl, local | see local values\n" <<"\tu, upval | see upvalue\n" <<"\tr, register | show vm register detail\n" <<"\ta, all | show global,local and upvalue\n" <<"\tn, next | execute next bytecode\n" <<"\tq, exit | exit debugger\n" <<"