-
Notifications
You must be signed in to change notification settings - Fork 686
Add debugger support on nuttx-smt32f4 target #1591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add debugger support on nuttx-smt32f4 target #1591
Conversation
a666e1e to
b28347a
Compare
| * Read source code into buffer. | ||
| * | ||
| * @return concatenated source files | ||
| * Returned value must be freed with jmem_heap_free_block if it's not NULL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@return missing
targets/nuttx-stm32f4/jerry_main.c
Outdated
| size_t *out_source_size_p) | ||
| static const uint8_t * | ||
| read_file (const char *file_name, | ||
| size_t *out_size_p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments are needed for these arguments.
b28347a to
db81b13
Compare
zherczeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few more changes.
targets/nuttx-stm32f4/jerry_main.c
Outdated
|
|
||
| fclose (file); | ||
| file = NULL; | ||
| jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Error: failed to open file: %s\n", file_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot open file
targets/nuttx-stm32f4/jerry_main.c
Outdated
| if (fseek_status != 0) | ||
| { | ||
| jerry_port_log (JERRY_LOG_LEVEL_ERROR, "There's nothing to read\n"); | ||
| jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Failed to fseek fseek_status(%d)\n", fseek_status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to seek (error: %d)
targets/nuttx-stm32f4/jerry_main.c
Outdated
| if (script_len < 0) | ||
| { | ||
| jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Out of memory error\n"); | ||
| jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Failed to ftell script_len(%ld)\n", script_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to get the file size (error: %d)
targets/nuttx-stm32f4/jerry_main.c
Outdated
| rewind (file); | ||
|
|
||
| rewind (file); | ||
| uint8_t *buffer = jmem_heap_alloc_block (script_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variant cannot return with NULL. It is a good idea to use the other here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand you correctly, but the jmem_heap_alloc_block can return with NULL if there is not enough memory. What do you mean 'other'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void *jmem_heap_alloc_block (const size_t size);
void *jmem_heap_alloc_block_null_on_error (const size_t size);
The jmem_heap_alloc_block crashes on error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, I missed it, thanks! I've updated the PR.
0185228 to
39da457
Compare
LaszloLango
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, after the comment fix
targets/nuttx-stm32f4/jerry_main.c
Outdated
| size_t *out_source_size_p) | ||
| static const uint8_t * | ||
| read_file (const char *file_name, /**< source code */ | ||
| size_t *out_size_p) /**< number of bytes successfully read from source */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**< [out] number of bytes successfully read from source */
zherczeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Using jerry_parse_named_resource to parse script and construct an EcmaScript function. The file name will also passed to this function which is used by the debugger to find the source code. Run the constructed EcmaScript function instead of using the simple jerry runner. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
39da457 to
38b0f87
Compare
Using jerry_parse_named_resource to parse script and construct an EcmaScript function.
The file name will also passed to this function which is used by the debugger to find
the source code.
Run the constructed EcmaScript function instead of using the simple jerry runner.