Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
baf8fbe6
Unverified
Commit
baf8fbe6
authored
Feb 19, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Feb 19, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4286 from kimushu/mrdb-local-variables
mrdb: add "info locals" command
parents
8781596c
477ffc74
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
3 deletions
+40
-3
mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c
mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c
+6
-1
mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h
mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h
+1
-1
mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
+6
-0
mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c
mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c
+24
-1
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
+1
-0
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h
+2
-0
No files found.
mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c
View file @
baf8fbe6
...
...
@@ -31,7 +31,7 @@ mrdb_check_syntax(mrb_state *mrb, mrb_debug_context *dbg, const char *expr, size
}
mrb_value
mrb_debug_eval
(
mrb_state
*
mrb
,
mrb_debug_context
*
dbg
,
const
char
*
expr
,
size_t
len
,
mrb_bool
*
exc
)
mrb_debug_eval
(
mrb_state
*
mrb
,
mrb_debug_context
*
dbg
,
const
char
*
expr
,
size_t
len
,
mrb_bool
*
exc
,
int
direct_eval
)
{
void
(
*
tmp
)(
struct
mrb_state
*
,
struct
mrb_irep
*
,
mrb_code
*
,
mrb_value
*
);
mrb_value
ruby_code
;
...
...
@@ -48,6 +48,11 @@ mrb_debug_eval(mrb_state *mrb, mrb_debug_context *dbg, const char *expr, size_t
v
=
mrb_obj_value
(
mrb
->
exc
);
mrb
->
exc
=
0
;
}
else
if
(
direct_eval
)
{
recv
=
dbg
->
regs
[
0
];
v
=
mrb_funcall
(
mrb
,
recv
,
expr
,
0
);
}
else
{
/*
* begin
...
...
mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h
View file @
baf8fbe6
...
...
@@ -8,6 +8,6 @@
#include <mruby.h>
#include "mrdb.h"
mrb_value
mrb_debug_eval
(
mrb_state
*
,
mrb_debug_context
*
,
const
char
*
,
size_t
,
mrb_bool
*
);
mrb_value
mrb_debug_eval
(
mrb_state
*
,
mrb_debug_context
*
,
const
char
*
,
size_t
,
mrb_bool
*
,
int
);
#endif
/* APIPRINT_H_ */
mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
View file @
baf8fbe6
...
...
@@ -81,6 +81,12 @@ static help_msg help_msg_list[] = {
"Status of specified breakpoints (all user-settable breakpoints if no argument).
\n
"
"Arguments are breakpoint numbers with spaces in between.
\n
"
},
{
"i[nfo]"
,
"l[ocals]"
,
"Print name of local variables"
,
"Usage: info locals
\n
"
"
\n
"
"Print name of local variables.
\n
"
},
{
"l[ist]"
,
NULL
,
"List specified line"
,
"Usage: list
\n
"
...
...
mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c
View file @
baf8fbe6
...
...
@@ -36,7 +36,7 @@ dbgcmd_print(mrb_state *mrb, mrdb_state *mrdb)
expr
=
mrb_str_cat_cstr
(
mrb
,
expr
,
mrdb
->
words
[
wcnt
]);
}
result
=
mrb_debug_eval
(
mrb
,
mrdb
->
dbg
,
RSTRING_PTR
(
expr
),
RSTRING_LEN
(
expr
),
NULL
);
result
=
mrb_debug_eval
(
mrb
,
mrdb
->
dbg
,
RSTRING_PTR
(
expr
),
RSTRING_LEN
(
expr
),
NULL
,
0
);
/* $print_no = result */
s
=
mrb_str_cat_lit
(
mrb
,
result
,
"
\0
"
);
...
...
@@ -56,3 +56,26 @@ dbgcmd_eval(mrb_state *mrb, mrdb_state *mrdb)
{
return
dbgcmd_print
(
mrb
,
mrdb
);
}
dbgcmd_state
dbgcmd_info_local
(
mrb_state
*
mrb
,
mrdb_state
*
mrdb
)
{
mrb_value
result
;
mrb_value
s
;
int
ai
;
ai
=
mrb_gc_arena_save
(
mrb
);
result
=
mrb_debug_eval
(
mrb
,
mrdb
->
dbg
,
"local_variables"
,
0
,
NULL
,
1
);
s
=
mrb_str_cat_lit
(
mrb
,
result
,
"
\0
"
);
printf
(
"$%lu = %s
\n
"
,
(
unsigned
long
)
mrdb
->
print_no
++
,
RSTRING_PTR
(
s
));
if
(
mrdb
->
print_no
==
0
)
{
mrdb
->
print_no
=
1
;
}
mrb_gc_arena_restore
(
mrb
,
ai
);
return
DBGST_PROMPT
;
}
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
View file @
baf8fbe6
...
...
@@ -52,6 +52,7 @@ static const debug_command debug_command_list[] = {
{
"eval"
,
NULL
,
2
,
0
,
0
,
DBGCMD_EVAL
,
dbgcmd_eval
},
/* ev[al] */
{
"help"
,
NULL
,
1
,
0
,
1
,
DBGCMD_HELP
,
dbgcmd_help
},
/* h[elp] */
{
"info"
,
"breakpoints"
,
1
,
1
,
1
,
DBGCMD_INFO_BREAK
,
dbgcmd_info_break
},
/* i[nfo] b[reakpoints] */
{
"info"
,
"locals"
,
1
,
1
,
0
,
DBGCMD_INFO_LOCAL
,
dbgcmd_info_local
},
/* i[nfo] l[ocals] */
{
"list"
,
NULL
,
1
,
0
,
1
,
DBGCMD_LIST
,
dbgcmd_list
},
/* l[ist] */
{
"print"
,
NULL
,
1
,
0
,
0
,
DBGCMD_PRINT
,
dbgcmd_print
},
/* p[rint] */
{
"quit"
,
NULL
,
1
,
0
,
0
,
DBGCMD_QUIT
,
dbgcmd_quit
},
/* q[uit] */
...
...
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h
View file @
baf8fbe6
...
...
@@ -23,6 +23,7 @@ typedef enum debug_command_id {
DBGCMD_STEP
,
DBGCMD_BREAK
,
DBGCMD_INFO_BREAK
,
DBGCMD_INFO_LOCAL
,
DBGCMD_WATCH
,
DBGCMD_INFO_WATCH
,
DBGCMD_ENABLE
,
...
...
@@ -151,6 +152,7 @@ dbgcmd_state dbgcmd_next(mrb_state*, mrdb_state*);
/* cmdbreak.c */
dbgcmd_state
dbgcmd_break
(
mrb_state
*
,
mrdb_state
*
);
dbgcmd_state
dbgcmd_info_break
(
mrb_state
*
,
mrdb_state
*
);
dbgcmd_state
dbgcmd_info_local
(
mrb_state
*
,
mrdb_state
*
);
dbgcmd_state
dbgcmd_delete
(
mrb_state
*
,
mrdb_state
*
);
dbgcmd_state
dbgcmd_enable
(
mrb_state
*
,
mrdb_state
*
);
dbgcmd_state
dbgcmd_disable
(
mrb_state
*
,
mrdb_state
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment