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

Fixed ‘vs’ command by: #92

Merged
merged 4 commits into from
May 7, 2015
Merged

Fixed ‘vs’ command by: #92

merged 4 commits into from
May 7, 2015

Conversation

palcalde
Copy link

@palcalde palcalde commented May 4, 2015

Fixed ‘vs’ command by (Issue #88 (comment)):

  • Stop using FBInputHandler. This class uses SBInputReader which no
    longer exist in the lldb version that comes bundled with XCode (that’s
    why the command was broken), even tho it does exist in the official
    lldb documentation
    (http://lldb.llvm.org/python_reference/lldb.SBInputReader-class.html).
  • Now the script uses the standard stdin library to read from terminal.
  • Removed the ‘Flickering’ of the selected view, instead we now use
    mask which is a lot more useful visually.

NOTE: As mentioned this fix doesn't use the class FBInputHandler at all to avoid SBInputReader, but if we have that class back in next versions of XCode we can always revert this fix-commit.

- Stop using FBInputHandler. This class uses SBInputReader which no
longer exist in the lldb version that comes bundled with XCode (that’s
why the command was broken), even tho it does exist in the official
lldb documentation
(http://lldb.llvm.org/python_reference/lldb.SBInputReader-class.html).

- Now the script uses the standard stdin library to read from terminal.

- Removed the ‘Flickering’ of the selected view, instead we now use
mask which is a lot more useful visually.

viewHelpers.setViewHidden(oldView, False)

def setCurrentView(self, view):
def setCurrentView(self, view, oldView):
Copy link
Contributor

Choose a reason for hiding this comment

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

Default oldView to None?

@kastiglione
Copy link
Contributor

@palcalde Thanks!

I've left a couple comments.

Also, can we make the mask a flag? (You can see examples of how to do flags in other chisel commands.) I'd prefer not to arbitrarily change the command from flickering to masking. Ideally, this could also use a border instead of flicker or mask, but I'm not asking you to go that far 😜 .

@palcalde
Copy link
Author

palcalde commented May 4, 2015

@kastiglione thanks for reviewing. I will add a comment about the async mode. The reason is because if you are on lldb console and type vs, the script blocks the thread waiting for user input. That is expected, however, if you type on continue in the debugger XCode enables the simulator again but lldb becomes absolutely blocked. You can't stop the execution or anything like that. The only thing you can do is quit simulator to kill the lldb process.

I found that if you run in async mode, lldb runs in a diff thread so it doesn't become blocked when you continue debugger in vs mode. You can stop again and keep using it normally.

About the border instead of masking, I will investigate and try to see if I can put it in the open PR.

@kastiglione
Copy link
Contributor

About the border instead of masking, I will investigate and try to see if I can put it in the open PR.

To be clear, it's not important to add border support. I'm only concerned about keeping flicker support. I'd rather not remove flicker support, but if we want to augment it with mask support, 👍.

For async mode, are there consequences to leaving it in async mode? Or should it be returned to off after vs completes?

Removed spaces.
Added default None to setCurrentView
@palcalde
Copy link
Author

palcalde commented May 5, 2015

@kastiglione The only reason I moved flickering to masking is because the new implementation doesn't use SBInputReader, it uses stdin which blocks the thread waiting for user input. SBInputReader was a separated buffer so the previous implementation did a while loop hiding/showing the view every 0.1 sec.

Since adding an async implementation with stdin in python is not trivial (it would require a Queue a Thread and a couple of methods) I just thought it wasn't worth it and just went for a simple mask behavior, which is also great to see what view you are on. That is the only reason why I change it :)

I added one more commit fixing the issues you mentioned.


self.handler = inputHelpers.FBInputHandler(lldb.debugger, self.inputCallback)
self.handler.start()
self.setCurrentView(startView, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that oldView defaults to None, the None here can be removed.

@kastiglione
Copy link
Contributor

Thanks for the explanation. Let's do it. A masking vs is better than a broken vs.

I have one more comment, otherwise looks good and thank you so much for the pull request!

@palcalde
Copy link
Author

palcalde commented May 5, 2015

Sure, no worries it was fun dealing with lldb and Python a little bit! 👍
I will update the pull request with your comment.

@palcalde
Copy link
Author

palcalde commented May 6, 2015

Pull Request updated.

print '\nI really have no idea what you meant by \'' + input + '\'... =\\\n'

viewHelpers.setViewHidden(oldView, False)
print '\nChisel - VS Mode: I really have no idea what you meant by \'' + input + '\'... =\\\n'
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticed this. We don't really do this anywhere else with any output. Do you think it's necessary to mention Chisel and VS by name?

@palcalde
Copy link
Author

palcalde commented May 6, 2015

The only reason why I put that in the message is because is the only command in Chisel (that I know) that stops lldb waiting for user input.

I thought it could be useful to remind people they are in vs mode.

I can reverse it if you feel more comfortable. Just let me know!

@palcalde
Copy link
Author

palcalde commented May 7, 2015

@kastiglione reverted message so is consistent with the rest of commands.

@kastiglione
Copy link
Contributor

🎆

kastiglione added a commit that referenced this pull request May 7, 2015
Fixed ‘vs’ command by:
@kastiglione kastiglione merged commit 3ce4d58 into facebook:master May 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants