-
Notifications
You must be signed in to change notification settings - Fork 38.7k
add gdb attach process to test README #10681
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
Conversation
jnewbery
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
One suggested change for finding the wanted bitcoind pid more easily.
test/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be more easily achieved by cating the .pid file in the data directory. Find the data directory:
2017-06-27 14:13:56.686000 TestFramework (INFO): Initializing test directory /tmp/user/1000/testo9vsdjo3Then cat the .pid file:
cat /tmp/user/1000/testo9vsdjo3/node0/regtest/bitcoind.pid
gdb /home/example/bitcoind !$(or if you really have to show off):
gdb /home/example/bitcoind $(cat /tmp/user/1000/testo9vsdjo3/node0/regtest/bitcoind.pid)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps also mention that this may require superuser privileges, so may need sudo gdb ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume most will get "permission denied" and sudo but maybe it's best to say
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - if gdb can't attach to a specific PID, the error message is actually buried in the middle of the gdb text so it's not immediately obvious what the problem is. I think including the warning is helpful here.
Also, my above invocation was wrong:
cat /tmp/user/1000/testo9vsdjo3/node0/regtest/bitcoind.pid
gdb /home/example/bitcoind !$it should be:
cat /tmp/user/1000/testo9vsdjo3/node0/regtest/bitcoind.pid
gdb /home/example/bitcoind <pid>
(sorry - trying to be too clever!)
903e423 to
d6c5d3b
Compare
|
updated with simpler steps |
test/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually prefer
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
(on development machines)
to running gdb itself as root.
|
reACK |
|
squashed last commit, same text |
|
ACK. I personally use a different approach (I guess it's more complicated, though will not need to attach and works with IDE's)
|
|
utACK 7ec3343 |
|
Can merge please? Simple docs change with 3 ACKs. |
|
utACK 7ec3343 |
Saved me many hours. h/t to @jnewbery for the new guide efforts