source: EcnlProtoTool/trunk/mruby-1.3.0/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 1.2 KB
Line 
1/*
2** cmdprint.c - mruby debugger print command functions
3**
4*/
5
6#include <string.h>
7#include "mrdb.h"
8#include <mruby/value.h>
9#include <mruby/class.h>
10#include <mruby/compile.h>
11#include <mruby/error.h>
12#include <mruby/numeric.h>
13#include <mruby/string.h>
14#include "apiprint.h"
15
16dbgcmd_state
17dbgcmd_print(mrb_state *mrb, mrdb_state *mrdb)
18{
19 mrb_value expr;
20 mrb_value result;
21 mrb_value s;
22 uint8_t wcnt;
23 int ai;
24
25 if (mrdb->wcnt <= 1) {
26 puts("Parameter not specified.");
27 return DBGST_PROMPT;
28 }
29
30 ai = mrb_gc_arena_save(mrb);
31
32 /* eval expr */
33 expr = mrb_str_new_cstr(mrb, NULL);
34 for (wcnt=1; wcnt<mrdb->wcnt; wcnt++) {
35 expr = mrb_str_cat_lit(mrb, expr, " ");
36 expr = mrb_str_cat_cstr(mrb, expr, mrdb->words[wcnt]);
37 }
38
39 result = mrb_debug_eval(mrb, mrdb->dbg, RSTRING_PTR(expr), RSTRING_LEN(expr), NULL);
40
41 /* $print_no = result */
42 s = mrb_str_cat_lit(mrb, result, "\0");
43 printf("$%lu = %s\n", (unsigned long)mrdb->print_no++, RSTRING_PTR(s));
44
45 if (mrdb->print_no == 0) {
46 mrdb->print_no = 1;
47 }
48
49 mrb_gc_arena_restore(mrb, ai);
50
51 return DBGST_PROMPT;
52}
53
54dbgcmd_state
55dbgcmd_eval(mrb_state *mrb, mrdb_state *mrdb)
56{
57 return dbgcmd_print(mrb, mrdb);
58}
Note: See TracBrowser for help on using the repository browser.