-
Notifications
You must be signed in to change notification settings - Fork 293
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
CLion debugger passes spurious arguments with gdb 10.2 #2958
Comments
It may have to do with startup-with-shell variable and this patch. My |
It seems that it has nothing to do with google patches, as this works with (mainline) gdb 9.2, but does not work with gdb 10.2 |
bisecting the gdb yielded this commit:
This changes the way the arguments are handled so it makes sense that it broke the redirection. Will probably go & report it to them... |
gdb compiled with this (quite dirty) patch fixes the issue: https://gist.github.com/DCNick3/d12cb304282d226b57af1fc512c0e24f |
As an alternative to building |
I just got hit by this. Is there any workaround available? I've seen a patch was submbitted to GDB, but I've seen this behaviour also on my GDB version 11.1. Couldn't this be fixed in the plugin, using another means of redirection? |
a temporary workaround I've found, is to go to the new_args+=("1>${inferior_stdout}")
new_args+=("2>${inferior_stderr}") as far as I can tell, this means now the inferior output streams go together with gdserver's ones, but that does not seem to be a big problem for me. I guess another workaround would be to add special treatment of |
Do any of you have updates on more sustainable solutions for this issue? |
Hello @DCNick3, Are you still looking support on the issue and workaround mentioned here worked for you ? |
I did devise my own workaround (recompiling the gdb reverting the breaking change). |
Please reopen if you are looking for support |
I believe that closing this issue is not the best way forward. Even though there are several workarounds (patching & building your own gdb/downgrading gdb/editing plugin's gdbserver wrapper) none of them are sustainable and all of them have their downsides. I believe a better resolution should be pursued, like:
As a proper resolution does not exist yet I believe it would be best to keep this issue open so as to signify that there is no solution yet |
Gdb's argument parsing changed in a way that prevented the redirection arguments to be handled in its internal shell. This caused them to be passed as the first 2 arguments for the debugged binary The fix introduces a wrapper script that performs the inferior output redirection internally, which is a more stable mechanism since gdb only expects the wrapper to call `exec "$@"` at the end bazelbuild#2958
Gdb's argument parsing changed in a way that prevented the redirection arguments to be handled in its internal shell. This caused them to be passed as the first 2 arguments for the debugged binary The fix introduces a wrapper script that performs the inferior output redirection internally, which is a more stable mechanism since gdb only expects the wrapper to call `exec "$@"` at the end #2958 Co-authored-by: Lucas Pingas Gomes <lucas.gomes@imc.com>
The clion debugger support seems to rely on google-specific gdbserver behaviour.
It redirects stdout and stderr using shell-like syntax (>stdout 2>stderr), but this seems not to be available in mainline gdb (as compared to NDK gdb available here https://android.googlesource.com/toolchain/gdb/)
(for both servers clients were ran with
gdb --eval-command='target remote localhost:5006' --eval-command='c'
)Due to this all bazel C++ executables being debugged using CLion extension get extra command line arguments. It would be nice to have a work around for this.
Possible solutions with varying levels of adequateness I can think of:
For reference & googleability: the arguments I get are
"1>/tmp/gdbserver_wrapper.KxJr27Av/inferior.out"
and"2>/tmp/gdbserver_wrapper.KxJr27Av/inferior.err"
The text was updated successfully, but these errors were encountered: