Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
magic-lantern
magic-lantern
Commits
85bf3dbc3cfa
Commit
ef57b62c
authored
Jul 01, 2017
by
alex@thinkpad
Browse files
Stack traces for crash and assert logs, using the backtrace backend
--HG-- branch : backtrace
parent
bd2144bbbec2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/boot-hack.c
View file @
85bf3dbc
...
...
@@ -41,6 +41,7 @@
#include "reloc.h"
#include "ml-cbr.h"
#include "backtrace.h"
#if defined(FEATURE_GPS_TWEAKS)
#include "gps.h"
...
...
@@ -583,34 +584,36 @@ void hold_your_horses()
* Custom assert handler - intercept ERR70 and try to save a crash log.
* Crash log should contain Canon error message.
*/
static
char
assert_msg
[
256
]
=
""
;
static
char
assert_msg
[
512
]
=
""
;
static
int
(
*
old_assert_handler
)(
char
*
,
char
*
,
int
,
int
)
=
0
;
const
char
*
get_assert_msg
()
{
return
assert_msg
;
}
static
int
my_assert_handler
(
char
*
msg
,
char
*
file
,
int
line
,
int
arg4
)
{
snprintf
(
assert_msg
,
sizeof
(
assert_msg
),
int
len
=
snprintf
(
assert_msg
,
sizeof
(
assert_msg
),
"ASSERT: %s
\n
"
"at %s:%d, task %s
\n
"
"lv:%d mode:%d
\n
"
,
"lv:%d mode:%d
\n
\n
"
,
msg
,
file
,
line
,
get_current_task_name
(),
lv
,
shooting_mode
);
backtrace_getstr
(
assert_msg
+
len
,
sizeof
(
assert_msg
)
-
len
);
request_crash_log
(
1
);
return
old_assert_handler
(
msg
,
file
,
line
,
arg4
);
}
void
ml_assert_handler
(
char
*
msg
,
char
*
file
,
int
line
,
const
char
*
func
)
{
snprintf
(
assert_msg
,
sizeof
(
assert_msg
),
int
len
=
snprintf
(
assert_msg
,
sizeof
(
assert_msg
),
"ML ASSERT:
\n
%s
\n
"
"at %s:%d (%s), task %s
\n
"
"lv:%d mode:%d
\n
"
,
"lv:%d mode:%d
\n
\n
"
,
msg
,
file
,
line
,
func
,
get_current_task_name
(),
lv
,
shooting_mode
);
backtrace_getstr
(
assert_msg
+
len
,
sizeof
(
assert_msg
)
-
len
);
request_crash_log
(
2
);
}
...
...
src/debug.c
View file @
85bf3dbc
...
...
@@ -458,7 +458,7 @@ static void save_crash_log()
FILE
*
f
=
FIO_CreateFile
(
log_filename
);
if
(
f
)
{
my_fprintf
(
f
,
"%s
\n
\n
"
,
get_assert_msg
());
my_fprintf
(
f
,
"%s
\n
"
,
get_assert_msg
());
my_fprintf
(
f
,
"Magic Lantern version : %s
\n
"
"Mercurial changeset : %s
\n
"
...
...
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