-
Notifications
You must be signed in to change notification settings - Fork 691
Add start to backtrace for debugger #2407
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
Conversation
jerry-core/debugger/debugger.h
Outdated
| typedef struct | ||
| { | ||
| uint8_t type; /**< type of the message */ | ||
| uint8_t start; /**< starting point (0 - max_depth)*/ |
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 should be:
uint8_t min_depth[sizeof (uint32_t)]; /**< minimum depth */
Similar to:
uint8_t max_depth[sizeof (uint32_t)]; /**< maximum depth (0 - unlimited) */
3e43863 to
2732312
Compare
|
@zherczeg Changed what was requested |
jerry-debugger/jerry-client-ws.py
Outdated
| max_depth = int(args) | ||
| if max_depth <= 0: | ||
| min_depth = int(args[0]) | ||
| max_depth = int(args[1]) |
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.
What happens if there is args length is 1 and there is no second element?
Both bt max_value and bt min_value max_value commands should work.
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 see now, this is intentional and the bt command has two mandatory arguments. IMHO this should be changed. One argument should mean a max_value and two arguments should mean min_value max_value pair.
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 don't mind having two mandatory arguments.
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.
Sorry I misunderstood you. Yes, in the python debugger, only one argument must be mandatory. In the message, both values must be sent.
jerry-debugger/jerry-client-ws.py
Outdated
| max_depth = int(args) | ||
| if max_depth <= 0: | ||
| min_depth = int(args[0]) | ||
| max_depth = int(args[1]) |
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.
Sorry I misunderstood you. Yes, in the python debugger, only one argument must be mandatory. In the message, both values must be sent.
| Frame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1) | ||
| Frame 2: tests/debugger/do_backtrace.js:40 | ||
| (jerry-debugger) bt 1 1 | ||
| Frame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) |
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.
When you specify a min, then maximum (max-min) items could be sent. Here (1-1)==0, so the backtrace should be empty (empty backtrace is valid, you need to test it!!!)
So "bt 1 2" above should only send 1 item. Please also test a large number, e.g. "bt 1000 1001".
tests/debugger/do_backtrace.expected
Outdated
| (jerry-debugger) s | ||
| Stopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) | ||
| (jerry-debugger) bt 1 2 | ||
| Frame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) |
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.
Is this intentional? I thought this should be Frame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
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 agree. Hm, this can be confusing. The second number is the count, while the first number is the starting index. So bt 4 4 never returns with anything, since frame index 4 is bigger than the maximum number of frames.
| backtrace | ||
| bt 4 4 | ||
| bt 600 919 | ||
| bt 3 500 |
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.
What happens if min greater than the max? Can we test it?
|
@LaszloLango Fixed what was requested, and added the test case that was missing. |
tests/debugger/do_backtrace.expected
Outdated
| (jerry-debugger) s | ||
| Stopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) | ||
| (jerry-debugger) bt 1 2 | ||
| Frame 0: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1) |
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.
Frame 1
b44eb58 to
829e97f
Compare
tests/debugger/do_backtrace.expected
Outdated
| (jerry-debugger) s | ||
| Stopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) | ||
| (jerry-debugger) bt 1 2 | ||
| Frame 1: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) |
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.
the frame index is still wrong
| typedef struct | ||
| { | ||
| uint8_t type; /**< type of the message */ | ||
| uint8_t min_depth[sizeof (uint32_t)]; /**< minimum depth*/ |
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.
Why don't we use uint16_t for both min_depth and max_depth? @zherczeg, what do you think?
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.
Currently only uint8, cpointer, and uint32 types are used by the protocol. Adding new types would require adding new encoders/decoders for clients. This is certainly possible, but for this it does not seem worth the effort.
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 see. Thanks for the explanation.
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
jerry-core/debugger/debugger.c
Outdated
| if (min_depth <= max_depth) | ||
| { | ||
| if (frame_ctx_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE) | ||
| uint32_t min_depth_offset = 1; |
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.
Why the start depth is 1?
tests/debugger/do_backtrace.expected
Outdated
| (jerry-debugger) s | ||
| Stopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) | ||
| (jerry-debugger) bt 1 2 | ||
| Frame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1) |
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 agree. Hm, this can be confusing. The second number is the count, while the first number is the starting index. So bt 4 4 never returns with anything, since frame index 4 is bigger than the maximum number of frames.
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.
Only one minor thing.
jerry-debugger/jerry-client-ws.py
Outdated
| print("Error: Positive integer number expected") | ||
| return | ||
| if self.min_depth > max_depth: | ||
| print("Error: Start needs to be lower than depth") |
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.
Error: start depth needs to be less equal than max depth
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
|
@zherczeg Fixed that minor issue |
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
With this you can add a start where you want to start listing the backtraces, not just maximum depth.
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu