Skip to content

Conversation

@DanielBallaSZTE
Copy link

Make a next command more gdb like.
If an argument is given next 10, it does 10 nexts.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu

""" Next breakpoint in the same context """
self.exec_command(args, JERRY_DEBUGGER_NEXT)
if args == "":
args = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preferred way to check that a string is empty (if you know that your variable is a string) is this: if not args:

If your variable could also be some other type then you should use this form if args == "":, but as I saw in the following code, it always waiting for string and then you cast that into an integer.

args = min(args, len(self.debugger.last_breakpoint_hit.function.lines) -
self.debugger.last_breakpoint_hit.function.line) - 1
self.debugger.nexts_remain = args
except ValueError as val_errno:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it's necessary to put it all in a try block, because you only use cast in the first command.

try:
args = int(args)
args = min(args, len(self.debugger.last_breakpoint_hit.function.lines) -
self.debugger.last_breakpoint_hit.function.line) - 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition can not be negative here?

self.debugger.last_breakpoint_hit.function.line) - 1
self.debugger.nexts_remain = args
except ValueError as val_errno:
print("Error: expected a positive integer: %s" % val_errno)
Copy link
Contributor

@robertsipka robertsipka Feb 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about those cases when the args value is a zero or negative number?

@DanielBallaSZTE
Copy link
Author

DanielBallaSZTE commented Mar 5, 2018

@robertsipka I've updated the PR, thank you for the review.

self.src_offset_diff = 0
self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.client_socket.connect((self.host, self.port))
self.nexts_remain = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call this as repeat, so we could extend this to step etc. later.

Make a next command more gdb like.
If an argument is given `next 10`, it does 10 nexts.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
Copy link
Member

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LaszloLango LaszloLango merged commit 685af74 into jerryscript-project:master Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants