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
2fe64f24
Commit
2fe64f24
authored
Sep 03, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove Exception#verbose_backtrace; #1495
parent
d606f9d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
49 deletions
+6
-49
src/backtrace.c
src/backtrace.c
+6
-37
src/error.c
src/error.c
+0
-2
test/t/exception.rb
test/t/exception.rb
+0
-10
No files found.
src/backtrace.c
View file @
2fe64f24
...
...
@@ -57,7 +57,7 @@ get_backtrace_i(mrb_state *mrb, void *stream, int level, const char *format, ...
}
static
void
mrb_output_backtrace
(
mrb_state
*
mrb
,
struct
RObject
*
exc
,
output_stream_func
func
,
void
*
stream
,
mrb_bool
verbose
)
mrb_output_backtrace
(
mrb_state
*
mrb
,
struct
RObject
*
exc
,
output_stream_func
func
,
void
*
stream
)
{
mrb_callinfo
*
ci
;
mrb_int
ciidx
;
...
...
@@ -74,7 +74,7 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun
filename
=
NULL
;
line
=
-
1
;
if
(
!
verbose
&&
MRB_PROC_CFUNC_P
(
ci
->
proc
))
{
if
(
MRB_PROC_CFUNC_P
(
ci
->
proc
))
{
continue
;
}
if
(
!
MRB_PROC_CFUNC_P
(
ci
->
proc
))
{
...
...
@@ -90,7 +90,7 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun
filename
=
mrb_debug_get_filename
(
irep
,
pc
-
irep
->
iseq
-
1
);
line
=
mrb_debug_get_line
(
irep
,
pc
-
irep
->
iseq
-
1
);
}
if
(
!
verbose
&&
line
==
-
1
)
continue
;
if
(
line
==
-
1
)
continue
;
if
(
ci
->
target_class
==
ci
->
proc
->
target_class
)
sep
=
"."
;
else
...
...
@@ -101,20 +101,8 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun
}
method
=
mrb_sym2name
(
mrb
,
ci
->
mid
);
if
(
verbose
&&
!
method
&&
ci
->
proc
->
env
)
{
method
=
mrb_sym2name
(
mrb
,
ci
->
proc
->
env
->
mid
);
}
if
(
method
)
{
const
char
*
cn
=
NULL
;
if
(
verbose
&&
ci
->
proc
->
target_class
->
tt
==
MRB_TT_SCLASS
)
{
cn
=
RSTRING_PTR
(
mrb_str_cat_cstr
(
mrb
,
mrb_str_new_cstr
(
mrb
,
"(singleton class of)"
),
mrb_class_name
(
mrb
,
mrb_class_ptr
(
mrb_mod_cv_get
(
mrb
,
ci
->
proc
->
target_class
,
mrb_intern_cstr
(
mrb
,
"__attached__"
))))));
}
else
{
cn
=
mrb_class_name
(
mrb
,
ci
->
proc
->
target_class
);
}
const
char
*
cn
=
mrb_class_name
(
mrb
,
ci
->
proc
->
target_class
);
if
(
cn
)
{
func
(
mrb
,
stream
,
1
,
"
\t
[%d] "
,
i
);
...
...
@@ -139,15 +127,7 @@ void
mrb_print_backtrace
(
mrb_state
*
mrb
)
{
#ifdef ENABLE_STDIO
mrb_output_backtrace
(
mrb
,
mrb
->
exc
,
print_backtrace_i
,
(
void
*
)
stderr
,
0
);
#endif
}
void
mrb_print_verbose_backtrace
(
mrb_state
*
mrb
)
{
#ifdef ENABLE_STDIO
mrb_output_backtrace
(
mrb
,
mrb
->
exc
,
print_backtrace_i
,
(
void
*
)
stderr
,
1
);
mrb_output_backtrace
(
mrb
,
mrb
->
exc
,
print_backtrace_i
,
(
void
*
)
stderr
);
#endif
}
...
...
@@ -157,18 +137,7 @@ mrb_get_backtrace(mrb_state *mrb, mrb_value self)
mrb_value
ary
;
ary
=
mrb_ary_new
(
mrb
);
mrb_output_backtrace
(
mrb
,
mrb_obj_ptr
(
self
),
get_backtrace_i
,
(
void
*
)
mrb_ary_ptr
(
ary
),
0
);
return
ary
;
}
mrb_value
mrb_get_verbose_backtrace
(
mrb_state
*
mrb
,
mrb_value
self
)
{
mrb_value
ary
;
ary
=
mrb_ary_new
(
mrb
);
mrb_output_backtrace
(
mrb
,
mrb_obj_ptr
(
self
),
get_backtrace_i
,
(
void
*
)
mrb_ary_ptr
(
ary
),
1
);
mrb_output_backtrace
(
mrb
,
mrb_obj_ptr
(
self
),
get_backtrace_i
,
(
void
*
)
mrb_ary_ptr
(
ary
));
return
ary
;
}
src/error.c
View file @
2fe64f24
...
...
@@ -439,7 +439,6 @@ mrb_sys_fail(mrb_state *mrb, const char *mesg)
}
mrb_value
mrb_get_backtrace
(
mrb_state
*
,
mrb_value
);
mrb_value
mrb_get_verbose_backtrace
(
mrb_state
*
,
mrb_value
);
void
mrb_init_exception
(
mrb_state
*
mrb
)
...
...
@@ -455,7 +454,6 @@ mrb_init_exception(mrb_state *mrb)
mrb_define_method
(
mrb
,
e
,
"message"
,
exc_message
,
MRB_ARGS_NONE
());
mrb_define_method
(
mrb
,
e
,
"inspect"
,
exc_inspect
,
MRB_ARGS_NONE
());
mrb_define_method
(
mrb
,
e
,
"backtrace"
,
mrb_get_backtrace
,
MRB_ARGS_NONE
());
mrb_define_method
(
mrb
,
e
,
"verbose_backtrace"
,
mrb_get_verbose_backtrace
,
MRB_ARGS_NONE
());
mrb
->
eStandardError_class
=
mrb_define_class
(
mrb
,
"StandardError"
,
mrb
->
eException_class
);
/* 15.2.23 */
mrb_define_class
(
mrb
,
"RuntimeError"
,
mrb
->
eStandardError_class
);
/* 15.2.28 */
...
...
test/t/exception.rb
View file @
2fe64f24
...
...
@@ -345,13 +345,3 @@ assert('Exception#backtrace') do
true
end
assert
(
'Exception#verbose_backtrace'
)
do
begin
raise
"get backtrace"
rescue
=>
e
e
.
verbose_backtrace
end
true
end
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