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

Waiting for a response after the response #37

Open
an-dr opened this issue Mar 11, 2019 · 11 comments
Open

Waiting for a response after the response #37

an-dr opened this issue Mar 11, 2019 · 11 comments

Comments

@an-dr
Copy link

an-dr commented Mar 11, 2019

while True:

Hello! If I understand correctly, the one way to exit from mentioned While loop - timeout. Maybe it could be better to add something like

            if len(responses) is not 0:
                if responses[-1].get('message') == 'done':
                    break

because right now, for example, inserting several breakpoints in windows takes (N_breakpionts * timeout) seconds. GdbController could already have a responce, but continue to wait a timeout.

@roar180
Copy link

roar180 commented Sep 19, 2019

Hello, I concur.
I dont understand why the timeout value is actually the time spent for each command.
This makes the execution time for a script the worst timing, unless you tailor the timeout value for each and every command (if you happen to know this value for sure, or you would have to devise a retry mecanism on top)...

@cs01
Copy link
Owner

cs01 commented Sep 20, 2019

I added this because oftentimes a valid response would be returned, but gdb had not finished writing all its responses. I get where you are coming from though. I will add a new keyword argument, return_on_first_response which will return as soon it has a response even if it hasn't timed out yet. Does that sound good?

@roar180
Copy link

roar180 commented Sep 20, 2019

Well, I actually like the Unix behavior : a two level timeout.
The first one being when you have not received anything yet, the second one (time_to_check_for_additional_output_sec), much less, each time you receive new packets from gdb. Any reason why you did not implement it that way on Windows ?

@cs01
Copy link
Owner

cs01 commented Sep 21, 2019

Oh, hmm. Are you both using windows? It's been a while since I added that but my guess is there was no technical reason it wasn't done. I don't use windows so I probably just forgot to add it. Would that be a good solution instead of return_on_first_response?

@roar180
Copy link

roar180 commented Sep 22, 2019

Looks like, yes.
I like the 2 level timeout better, because I believe that allows to capture anything gdbmi might send after the done message (unless we are sure it is the last thing we should be expecting)

@H0bo
Copy link
Contributor

H0bo commented Apr 7, 2020

Hello cs01! I'm using pygdbmi on windows and I would really like to cut down on waiting times. I implemented the same timeout mechanism as the unix codepath uses in my fork. Though I can't get all tests to succeed (only test_controller fails), but this was the case before I made any changes.
In my application the speedup is very big and everything is working.

@jhajdu
Copy link

jhajdu commented Apr 8, 2020

Hi,
Was the windows timeout issue resolved already?
Sorry but I couldn't find the resolution in the source (maybe it's just my bad).

Many thanks.

@H0bo
Copy link
Contributor

H0bo commented May 26, 2020

Hey @cs01, did you consider including the changes?

@cs01
Copy link
Owner

cs01 commented May 26, 2020

Oh sorry I didn't know this was blocked on me. I have no objection to it and would be happy to review a PR, but I am not able to make this change myself.

@Xtyll
Copy link

Xtyll commented Jul 22, 2023

Hello @cs01. I think your idea with return_on_first_response will extra useful. In the case when we sure that GDB will return only one reponse we able to use this approach. In my case it worked. With some haks I do it and tested. Works corerctly witl 1M iterations. Are you able to implement it soon? or better to do it in my side and open PR?

@cs01
Copy link
Owner

cs01 commented Jul 22, 2023

I don’t have the time to work on open source any more but if you submit a pr, @barisione or I can review it

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

6 participants