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
b4d946f6
Commit
b4d946f6
authored
9 years ago
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3129 from kou/fix-segv-by-backtrace-and-gc
Fix SEGV by backtrace and GC
parents
1a4540fb
f1eb3aea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
src/backtrace.c
src/backtrace.c
+2
-7
src/error.c
src/error.c
+7
-2
src/gc.c
src/gc.c
+5
-0
No files found.
src/backtrace.c
View file @
b4d946f6
...
...
@@ -111,8 +111,6 @@ each_backtrace(mrb_state *mrb, mrb_int ciidx, mrb_code *pc0, each_backtrace_func
mrb_callinfo
*
ci
;
mrb_irep
*
irep
;
mrb_code
*
pc
;
loc
.
lineno
=
-
1
;
ci
=
&
mrb
->
c
->
cibase
[
i
];
...
...
@@ -130,11 +128,8 @@ each_backtrace(mrb_state *mrb, mrb_int ciidx, mrb_code *pc0, each_backtrace_func
else
{
pc
=
pc0
;
}
if
(
irep
)
{
loc
.
filename
=
mrb_debug_get_filename
(
irep
,
(
uint32_t
)(
pc
-
irep
->
iseq
));
loc
.
lineno
=
mrb_debug_get_line
(
irep
,
(
uint32_t
)(
pc
-
irep
->
iseq
));
}
loc
.
filename
=
mrb_debug_get_filename
(
irep
,
(
uint32_t
)(
pc
-
irep
->
iseq
));
loc
.
lineno
=
mrb_debug_get_line
(
irep
,
(
uint32_t
)(
pc
-
irep
->
iseq
));
if
(
loc
.
lineno
==
-
1
)
continue
;
...
...
This diff is collapsed.
Click to expand it.
src/error.c
View file @
b4d946f6
...
...
@@ -255,17 +255,22 @@ mrb_exc_set(mrb_state *mrb, mrb_value exc)
{
if
(
!
mrb
->
gc
.
out_of_memory
&&
mrb
->
backtrace
.
n
>
0
)
{
mrb_value
target_exc
=
mrb_nil_value
();
int
ai
;
ai
=
mrb_gc_arena_save
(
mrb
);
if
((
mrb
->
exc
&&
!
have_backtrace
(
mrb
,
mrb
->
exc
)))
{
target_exc
=
mrb_obj_value
(
mrb
->
exc
);
}
else
if
(
!
mrb_nil_p
(
exc
)
&&
mrb_obj_ptr
(
exc
)
==
mrb
->
backtrace
.
exc
)
{
target_exc
=
exc
;
else
if
(
!
mrb_nil_p
(
exc
)
&&
mrb
->
backtrace
.
exc
)
{
target_exc
=
mrb_obj_value
(
mrb
->
backtrace
.
exc
);
mrb_gc_protect
(
mrb
,
target_exc
);
}
if
(
!
mrb_nil_p
(
target_exc
))
{
mrb_value
backtrace
;
backtrace
=
mrb_restore_backtrace
(
mrb
);
set_backtrace
(
mrb
,
target_exc
,
backtrace
);
}
mrb_gc_arena_restore
(
mrb
,
ai
);
}
mrb
->
backtrace
.
n
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/gc.c
View file @
b4d946f6
...
...
@@ -695,8 +695,13 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
#endif
case
MRB_TT_OBJECT
:
mrb_gc_free_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
break
;
case
MRB_TT_EXCEPTION
:
mrb_gc_free_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
if
((
struct
RObject
*
)
obj
==
mrb
->
backtrace
.
exc
)
mrb
->
backtrace
.
exc
=
0
;
break
;
case
MRB_TT_CLASS
:
...
...
This diff is collapsed.
Click to expand it.
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