Skip to content

Conversation

@instagibbs
Copy link
Member

Saved me many hours. h/t to @jnewbery for the new guide efforts

Copy link
Contributor

@jnewbery jnewbery left a 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
Copy link
Contributor

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/testo9vsdjo3

Then 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)

Copy link
Contributor

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 ...

Copy link
Member Author

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

Copy link
Contributor

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!)

@instagibbs instagibbs force-pushed the gdbattach branch 3 times, most recently from 903e423 to d6c5d3b Compare June 27, 2017 14:49
@instagibbs
Copy link
Member Author

updated with simpler steps

test/README.md Outdated
Copy link
Member

@laanwj laanwj Jun 27, 2017

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.

@jnewbery
Copy link
Contributor

reACK

@instagibbs
Copy link
Member Author

squashed last commit, same text

@laanwj laanwj added the Docs label Jun 28, 2017
@jonasschnelli
Copy link
Contributor

ACK.

I personally use a different approach (I guess it's more complicated, though will not need to attach and works with IDE's)

  • replace a self.node object in the test with a custom added AuthProxy (to localhost and a fix port with a given rpcusername/pw)
  • Start (via IDE, gdb) a such localhost regtest peer (make sure it has an empty datadir)
  • run test

@fanquake
Copy link
Member

fanquake commented Jul 6, 2017

utACK 7ec3343

@jnewbery
Copy link
Contributor

Can merge please? Simple docs change with 3 ACKs.

@maflcko
Copy link
Member

maflcko commented Jul 19, 2017

utACK 7ec3343

@maflcko maflcko merged commit 7ec3343 into bitcoin:master Jul 19, 2017
maflcko pushed a commit that referenced this pull request Jul 19, 2017
7ec3343 add gdb attach process to test README (Gregory Sanders)

Pull request description:

  Saved me many hours. h/t to @jnewbery for the new guide efforts

Tree-SHA512: 4d8ba1717eb842201079488f1cfe369d5d5114df5278643a3f996c986a51e3e039ea994a6f2f06bf6607b697388ad6561198da4693e3cb1ca4a8424e6d423d85
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 24, 2019
7ec3343 add gdb attach process to test README (Gregory Sanders)

Pull request description:

  Saved me many hours. h/t to @jnewbery for the new guide efforts

Tree-SHA512: 4d8ba1717eb842201079488f1cfe369d5d5114df5278643a3f996c986a51e3e039ea994a6f2f06bf6607b697388ad6561198da4693e3cb1ca4a8424e6d423d85
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants