开发者

Any mature solutions to create a instant shell with ELF symbols and c grammar command parser?

I need to make a debug shell inside each c exe(linux enviroment), and my solution is as follows:

  1. Read elf symbols from exe file, build a symbol->address table in memory;
  2. Run a thread calling readline to accept user input, some thing like a c function call;
  3. use Lex & yacc to parse the function name and arg list;
  4. Find address of the function in the symbol table;
  5. Call the function with args list;
  6. Every function written can be input as shell command instantly开发者_运维技巧.

I don't think this is a fresh idea, and my question is: Are there any mature codes implemented already? Thanks for your help!


Sure. If you had working with VxWorks, you'll find WindShell is what you're looking for. I had port a similar shell to Linux. You can download the source from: https://sourceforge.net/projects/zprj/

Note: don't use the source in commercial products, since they are ported from WindShell. If you do want a shell in commercial fields, then you shall develop one with LEX/YACC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜