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

Unable to use command line arguments for non standard port #5

Open
epeters-jrmngndr opened this issue Mar 10, 2021 · 6 comments
Open

Comments

@epeters-jrmngndr
Copy link

epeters-jrmngndr commented Mar 10, 2021

Hi @Sasanidas ,

Thank you for your work on this, and for making it publicly available!

I will try to make this work on my own time, but, I was trying to use this realgud interface with xdebug, but didn't succeed since I need to use port 9005.

If I need to add an argument to the command execution, how would I do that? I was able to use this to target the correct executable, but I couldn't use it to add arguments:

(custom-set-variables
     '(realgud:xdebug-command-name "xdebug"))
@epeters-jrmngndr
Copy link
Author

I made this work by using a script for my xdebug-command-name, and putting the call to xdebug including the -p parameter inside. Still it would be nice to have a way to apply command line arguments to the xdebug command via settings.

@rocky
Copy link

rocky commented Mar 12, 2021

In general open-source moves ahead by the contributions of many people. Consider working up a soluition and posting a Pull Request for it.

@Sasanidas
Copy link
Collaborator

Hello @emil-r-petersen , I know about that limitation, the package is still in a "pre-alpha" state, I can use it and it works for me, but I can understand these kind of edge cases, it is fairy easy to add command line arguments.

I don't have too much time now, if you want to add a contribution (as @rocky point out) this file is the way to go:

(defun xdebug-parse-cmd-args (orig-args)

Take a look at similar packages like https://github.com/realgud/realgud-pry/blob/master/pry/core.el

If you want to make a pull request, I will be more than happy to merge it 👍

@epeters-jrmngndr
Copy link
Author

epeters-jrmngndr commented Mar 15, 2021

Thanks for the pointer @Sasanidas. Once I have this working well for me I might take a look and try to add the feature. In the package's current state, the way you're using it -

  • Can you use short key mode? Does that work great?
  • Can you set breakpoints by clicking the margin?
  • Does your editor follow the debugger and shows the active source code line?

Just trying to get a feel for the state of the package, as I'm working through getting it to work for me.

@rocky
Copy link

rocky commented Mar 15, 2021

I don't use realgud-xdebug or php, but understand the general operation of realgud and the things that you describe are all related.

What is probably going on is that the association between the source code and the code seen by the debugger don't align.

The way realgud works is that it looks for a location patttern in the console window. When certain things like a stopping location or a traceback are matched, a file and line number is extracted from that and the source windoiw is updated.

When you set a breakpoint things go in the other direction: a file and line number from the source and are sent in some sort of breakpoint command. If realgud gets back a message that the breakpoint has been set then the source display is updated to reflect a breakpoint set.

So the pattern match I would guess is failing on one side and vice versa when realgud issues break file/line that isn't understood by the php debugger.

So the first thing to check is whether the location given corresponds to the source as you see it.

@Sasanidas
Copy link
Collaborator

Sasanidas commented Mar 16, 2021

Thanks for taking the time @emil-r-petersen , let me try to answer some of these questions:

* Can you use short key mode? Does that work great?

The short key mode describe in the main realgud repository should work as intended, as the main features of every debugger are quite similar, if one doesn't work (or is not documented) it should be reported as a bug.

You can find all the feature here:

(setf (gethash "kill" realgud:xdebug-command-hash) "stop"

Or in the tool bar "Debugger Info" (in the comint-mode with realgud activated)

* Can you set breakpoints by clicking the margin?

Not really, the way that Xdebug works is something different on how most common debuggers works, so it is necessary to tell the debugger a break point in an "special" matter, this is more or less the workflow (a thing that should be documented):

1 - Activate the debugger with the main command, xdebug
2 - Waint until xdebug take the PHP callback, reloading the webpage, for example (this can be seen because it will give you a prompt)
3 - Now, you can set any breakpoint by going to the desired line and calling the function realgud:xdebug-break-line , which is a function created with that purpose in mind.
4 - Wait until reach the breakpoint

Now, you should be able to stop the debugger and use all the commands in a normal way, keep in mid that even the xdebug cli software is still in early development, that means that some commands doesn't work or the behaviour is rater limited.

* Does your editor follow the debugger and shows the active source code line?

Yes, the editor should follow the debugger, and move around in a correct way, with the correct major mode active (track-mode).

Just trying to get a feel for the state of the package, as I'm working through getting it to work for me.

That's great!, if you are really interested, I have no problem to have an talk with you, I can understand that realgud is a big thing to understand, and even with the invaluable help of @rocky , some things may be difficult to get.

Good luck!

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

3 participants