Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
62ad189a
Commit
62ad189a
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Add compile option to enable/disable source line numbers.
parent
2d15c121
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
py/emitbc.c
+2
-0
2 additions, 0 deletions
py/emitbc.c
py/mpconfig.h
+6
-0
6 additions, 0 deletions
py/mpconfig.h
py/obj.c
+4
-0
4 additions, 0 deletions
py/obj.c
unix/mpconfigport.h
+1
-0
1 addition, 0 deletions
unix/mpconfigport.h
with
13 additions
and
0 deletions
py/emitbc.c
+
2
−
0
View file @
62ad189a
...
@@ -249,6 +249,7 @@ static void emit_bc_set_stack_size(emit_t *emit, int size) {
...
@@ -249,6 +249,7 @@ static void emit_bc_set_stack_size(emit_t *emit, int size) {
static
void
emit_bc_set_source_line
(
emit_t
*
emit
,
int
source_line
)
{
static
void
emit_bc_set_source_line
(
emit_t
*
emit
,
int
source_line
)
{
//printf("source: line %d -> %d offset %d -> %d\n", emit->last_source_line, source_line, emit->last_source_line_offset, emit->byte_code_offset);
//printf("source: line %d -> %d offset %d -> %d\n", emit->last_source_line, source_line, emit->last_source_line_offset, emit->byte_code_offset);
#if MICROPY_ENABLE_SOURCE_LINE
if
(
source_line
>
emit
->
last_source_line
)
{
if
(
source_line
>
emit
->
last_source_line
)
{
uint
bytes_to_skip
=
emit
->
byte_code_offset
-
emit
->
last_source_line_offset
;
uint
bytes_to_skip
=
emit
->
byte_code_offset
-
emit
->
last_source_line_offset
;
uint
lines_to_skip
=
source_line
-
emit
->
last_source_line
;
uint
lines_to_skip
=
source_line
-
emit
->
last_source_line
;
...
@@ -257,6 +258,7 @@ static void emit_bc_set_source_line(emit_t *emit, int source_line) {
...
@@ -257,6 +258,7 @@ static void emit_bc_set_source_line(emit_t *emit, int source_line) {
emit
->
last_source_line_offset
=
emit
->
byte_code_offset
;
emit
->
last_source_line_offset
=
emit
->
byte_code_offset
;
emit
->
last_source_line
=
source_line
;
emit
->
last_source_line
=
source_line
;
}
}
#endif
}
}
static
void
emit_bc_load_id
(
emit_t
*
emit
,
qstr
qstr
)
{
static
void
emit_bc_load_id
(
emit_t
*
emit
,
qstr
qstr
)
{
...
...
This diff is collapsed.
Click to expand it.
py/mpconfig.h
+
6
−
0
View file @
62ad189a
...
@@ -76,6 +76,12 @@
...
@@ -76,6 +76,12 @@
typedef
long
long
mp_longint_impl_t
;
typedef
long
long
mp_longint_impl_t
;
#endif
#endif
// Whether to include information in the byte code to determine source
// line number (increases RAM usage, but doesn't slow byte code execution)
#ifndef MICROPY_ENABLE_SOURCE_LINE
#define MICROPY_ENABLE_SOURCE_LINE (0)
#endif
// Whether to support float and complex types
// Whether to support float and complex types
#ifndef MICROPY_ENABLE_FLOAT
#ifndef MICROPY_ENABLE_FLOAT
#define MICROPY_ENABLE_FLOAT (0)
#define MICROPY_ENABLE_FLOAT (0)
...
...
This diff is collapsed.
Click to expand it.
py/obj.c
+
4
−
0
View file @
62ad189a
...
@@ -57,7 +57,11 @@ void mp_obj_print_exception(mp_obj_t exc) {
...
@@ -57,7 +57,11 @@ void mp_obj_print_exception(mp_obj_t exc) {
if
(
n
>
0
)
{
if
(
n
>
0
)
{
printf
(
"Traceback (most recent call last):
\n
"
);
printf
(
"Traceback (most recent call last):
\n
"
);
for
(
int
i
=
n
-
3
;
i
>=
0
;
i
-=
3
)
{
for
(
int
i
=
n
-
3
;
i
>=
0
;
i
-=
3
)
{
#if MICROPY_ENABLE_SOURCE_LINE
printf
(
" File
\"
%s
\"
, line %d, in %s
\n
"
,
qstr_str
(
values
[
i
]),
(
int
)
values
[
i
+
1
],
qstr_str
(
values
[
i
+
2
]));
printf
(
" File
\"
%s
\"
, line %d, in %s
\n
"
,
qstr_str
(
values
[
i
]),
(
int
)
values
[
i
+
1
],
qstr_str
(
values
[
i
+
2
]));
#else
printf
(
" File
\"
%s
\"
, in %s
\n
"
,
qstr_str
(
values
[
i
]),
qstr_str
(
values
[
i
+
2
]));
#endif
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
unix/mpconfigport.h
+
1
−
0
View file @
62ad189a
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#define MICROPY_DEBUG_PRINTERS (1)
#define MICROPY_DEBUG_PRINTERS (1)
#define MICROPY_ENABLE_REPL_HELPERS (1)
#define MICROPY_ENABLE_REPL_HELPERS (1)
#define MICROPY_ENABLE_LEXER_UNIX (1)
#define MICROPY_ENABLE_LEXER_UNIX (1)
#define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_ENABLE_FLOAT (1)
#define MICROPY_ENABLE_FLOAT (1)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment