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
aab52be1
Commit
aab52be1
authored
Apr 29, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2156 from cremno/fix-disabled-stdio-2
fix disabled stdio
parents
5fb5c2a4
01b76630
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
10 deletions
+29
-10
src/backtrace.c
src/backtrace.c
+25
-5
src/dump.c
src/dump.c
+4
-5
No files found.
src/backtrace.c
View file @
aab52be1
...
...
@@ -14,9 +14,10 @@
#include "mruby/debug.h"
#include "mruby/error.h"
#ifdef ENABLE_STDIO
typedef
void
(
*
output_stream_func
)(
mrb_state
*
,
void
*
,
int
,
const
char
*
,
...);
#ifdef ENABLE_STDIO
static
void
print_backtrace_i
(
mrb_state
*
mrb
,
void
*
stream
,
int
level
,
const
char
*
format
,
...)
{
...
...
@@ -26,7 +27,7 @@ print_backtrace_i(mrb_state *mrb, void *stream, int level, const char *format, .
vfprintf
((
FILE
*
)
stream
,
format
,
ap
);
va_end
(
ap
);
}
#endif
#define MIN_BUFSIZE 127
...
...
@@ -142,14 +143,12 @@ exc_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun
function to retrieve backtrace information from the exception.
note that if you call method after the exception, call stack will be
overwritten. So invoke these functions just after detecting exceptions.
*/
*/
void
mrb_print_backtrace
(
mrb_state
*
mrb
)
{
#ifdef ENABLE_STDIO
exc_output_backtrace
(
mrb
,
mrb
->
exc
,
print_backtrace_i
,
(
void
*
)
stderr
);
#endif
}
mrb_value
...
...
@@ -177,3 +176,24 @@ mrb_get_backtrace(mrb_state *mrb)
return
ary
;
}
#else
void
mrb_print_backtrace
(
mrb_state
*
mrb
)
{
}
mrb_value
mrb_exc_backtrace
(
mrb_state
*
mrb
,
mrb_value
self
)
{
return
mrb_ary_new
(
mrb
);
}
mrb_value
mrb_get_backtrace
(
mrb_state
*
mrb
)
{
return
mrb_ary_new
(
mrb
);
}
#endif
src/dump.c
View file @
aab52be1
...
...
@@ -13,6 +13,8 @@
#include "mruby/numeric.h"
#include "mruby/debug.h"
#ifdef ENABLE_STDIO
static
size_t
get_irep_record_size_1
(
mrb_state
*
mrb
,
mrb_irep
*
irep
);
#if UINT32_MAX > SIZE_MAX
...
...
@@ -252,7 +254,7 @@ get_irep_record_size(mrb_state *mrb, mrb_irep *irep)
{
size_t
size
=
0
;
size_t
irep_no
;
size
=
get_irep_record_size_1
(
mrb
,
irep
);
for
(
irep_no
=
0
;
irep_no
<
irep
->
rlen
;
irep_no
++
)
{
size
+=
get_irep_record_size
(
mrb
,
irep
->
reps
[
irep_no
]);
...
...
@@ -603,7 +605,7 @@ write_debug_record(mrb_state *mrb, mrb_irep *irep, uint8_t *bin, mrb_sym const*
{
size_t
size
,
len
;
size_t
irep_no
;
size
=
len
=
write_debug_record_1
(
mrb
,
irep
,
bin
,
filenames
,
filenames_len
);
bin
+=
len
;
for
(
irep_no
=
0
;
irep_no
<
irep
->
rlen
;
irep_no
++
)
{
...
...
@@ -802,9 +804,6 @@ error_exit:
return
result
;
}
#ifdef ENABLE_STDIO
int
mrb_dump_irep_binary
(
mrb_state
*
mrb
,
mrb_irep
*
irep
,
int
debug_info
,
FILE
*
fp
)
{
...
...
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