Skip to content
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

Problems with conditional breakpoints defined with "break {...} if {condition}" command. #13

Open
asoriano-stratio opened this issue Apr 5, 2018 · 1 comment

Comments

@asoriano-stratio
Copy link

Hi,

I have been testing conditional breakpoints, but I have found some problems applying the condition directly when defining the breakpoints:

Python script used as example:

import sys
def main(arguments):
    for i in range(10):
        print(i)
        print("Test")

if __name__ == '__main__':
    main(sys.argv)

Defining condition in break-point creation:

trepan3k --highlight=plain --different test.py 
(/tmp/python_example/test.py:1): <module>
-> 1 import sys
(trepan3k) break 4 if i==5
Breakpoint 1 set at line 4 of file /tmp/python_example/test.py
(trepan3k) break 5 if i==3
Breakpoint 2 set at line 5 of file /tmp/python_example/test.py
(trepan3k) info break
Num Type          Disp Enb    Where
-----------------------------------
1   breakpoint    keep y   at /tmp/python_example/test.py:4
	stop only if if i==5
2   breakpoint    keep y   at /tmp/python_example/test.py:5
	stop only if if i==3
(trepan3k) continue
(/tmp/python_example/test.py:4 @19): main
xx 4         print(i)

When printing breakpoints information, I have seen that 'if' word appears two times in condition definition information (stop only if if ...).

Defining condition after break-point creation:

trepan3k --highlight=plain --different test.py 
(/tmp/python_example/test.py:1): <module>
-> 1 import sys
(trepan3k) break 4
Breakpoint 1 set at line 4 of file /tmp/python_example/test.py
(trepan3k) condition 1 i==5
(trepan3k) break 5
Breakpoint 2 set at line 5 of file /tmp/python_example/test.py
(trepan3k) condition 2 i==3
(trepan3k) info break
Num Type          Disp Enb    Where
-----------------------------------
1   breakpoint    keep y   at /tmp/python_example/test.py:4
	stop only if i==5
2   breakpoint    keep y   at /tmp/python_example/test.py:5
	stop only if i==3
(trepan3k) continue
0
Test
1
Test
2
Test
3
(/tmp/python_example/test.py:5 @29): main
xx 5         print("Test")
(trepan3k) eval i
3

I hope that this information can be helpful.

@asoriano-stratio asoriano-stratio changed the title Problems with conditional breakpoints when defined with "break {...} if {condition}" command. Problems with conditional breakpoints defined with "break {...} if {condition}" command. Apr 5, 2018
@rocky
Copy link
Collaborator

rocky commented Apr 5, 2018

Thanks for the detailed report.

Commit d311dca addresses this problem. But it reveals that there may be other bugs I need to go over in the parsing of break statements. which I'll do in the following days.

Recently, I added this fancy parser for handling location specification. Shame on my for not having written unit tests for those.

One other note: because this project's rating is low compared to rating of other projects, I'll tend to work less on this one over the others, and there are likely to be more bugs.

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

No branches or pull requests

2 participants