# USDTs in #26593
## Setup
After I updated and cleaned out my system I started to see error:
```
$ bpftrace contrib/tracing/log_p2p_traffic.bt
: CommandLine Error: Option 'help-list' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
fish: Job 1, 'bpftrace contrib/tracing/log_p2ā¦' terminated by signal SIGABRT (Abort)
```
This was solved by building `bcc` myself from source with the [`-DENABLE_LLVM_SHARED=1` flag enabled](https://github.com/iovisor/bpftrace/issues/1855).
I also had difficulty getting the python bcc bindings into my venv, but the easiest way was to build them from the bcc source tree, activate my venv in there, and pip install to the venv, which on Ubuntu looked like this overall:
```fish
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
cmake -DENABLE_LLVM_SHARED=1 .. # fix the shared llvm issue
make
sudo make install
cmake -DPYTHON_CMD=python3 .. # build python3 binding
pushd src/python/
make
cd bcc-python3
pyenv local 3.7.16 # activate venv used for bitcoin
pip install . ## install package to venv
popd
```
However I still had issues running bpf:
```fish
will@ubuntu in ~/src/bitcoin on 2022-11-only-prepare-tracepoint-arguments-when-tracing [$] via š 3.7.16
āæ sudo bpftrace contrib/tracing/log_p2p_traffic.bt
FATAL: offset for register H$ not known
fish: Job 1, 'sudo bpftrace contrib/tracing/lā¦' terminated by signal SIGABRT (Abort)
will@ubuntu in ~/src/bitcoin on 2022-11-only-prepare-tracepoint-arguments-when-tracing [$] via š 3.7.16
ā ./contrib/tracing/log_raw_p2p_msgs.py (pidof bitcoind)
Hooking into bitcoind with pid 1994639
Traceback (most recent call last):
File "./contrib/tracing/log_raw_p2p_msgs.py", line 184, in <module>
main(pid)
File "./contrib/tracing/log_raw_p2p_msgs.py", line 141, in main
probe="inbound_message", fn_name="trace_inbound_message")
File "/home/will/.pyenv/versions/3.7.16/lib/python3.7/site-packages/bcc/usdt.py", line 167, in enable_probe
""" % probe)
bcc.usdt.USDTException: Failed to enable USDT probe 'inbound_message':
the specified pid might not contain the given language's runtime,
or the runtime was not built with the required USDT probes. Look
for a configure flag similar to --with-dtrace or --enable-dtrace.
To check which probes are present in the process, use the tplist tool.
```
My kernel tracing params all look ok:
```fish
will@ubuntu in ā¦/src/bcc/tools on master via š 3.7.16
ā sudo cat /boot/config-5.19.0-35-generic | rg bpf
CONFIG_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
# BPF subsystem
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_JIT_DEFAULT_ON=y
CONFIG_BPF_UNPRIV_DEFAULT_OFF=y
# CONFIG_BPF_PRELOAD is not set
CONFIG_BPF_LSM=y
# end of BPF subsystem
CONFIG_CGROUP_BPF=y
CONFIG_IPV6_SEG6_BPF=y
CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_BPFILTER=y
CONFIG_BPFILTER_UMH=m
CONFIG_NET_CLS_BPF=m
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_STREAM_PARSER=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_BPF_EVENTS=y
CONFIG_BPF_KPROBE_OVERRIDE=y
CONFIG_TEST_BPF=m
```
My Bitcoin Core configuration was good:
```fish
āæ rg tracing config.*
config.status
1423:D["ENABLE_TRACING"]=" 1"
config.log
2992:configure:33613: checking whether Userspace, Statically Defined Tracing tracepoints are supported
3099:| #define ENABLE_TRACING 1
3244:| #define ENABLE_TRACING 1
4216:#define ENABLE_TRACING 1
```
Trying to run `bcc`'s `tplist.py` test tool as `$user` resulted in
```fish
will@ubuntu in ā¦/src/bcc/tools on master via š 3.7.16
ā python tplist.py (pidof bitcoind)
[Errno 13] Permission denied: '/sys/kernel/debug/tracing/events'
```
and as `su` it seemed to run, but produced no output:
```fish
root@ubuntu $ /home/will/.pyenv/versions/3.7.16/bin/python tplist.py (pidof bitcoind)
root@ubuntu $
```
So let's try again with sudo and explicitly using the venv:
```fish
root@ubuntu $ /home/will/.pyenv/versions/3.7.16/bin/python contrib/tracing/log_raw_p2p_msgs.py (pidof bitcoind)
Hooking into bitcoind with pid 1994639
Logging raw P2P messages.
Messages larger that about 32kb will be cut off!
Some messages might be lost!
inbound msg 'inv' from peer 10 (inbound, 127.0.0.1:53700) with 37 bytes: 0105000000abbe88c66c2dda69b5692f85eb3539ffe04328e480c43fd6e2da81348d818582
inbound msg 'inv' from peer 12 (inbound, 127.0.0.1:50100) with 37 bytes: 0105000000abbe88c66c2dda69b5692f85eb3539ffe04328e480c43fd6e2da81348d818582
outbound msg 'getdata' from peer 10 (inbound, 127.0.0.1:53700) with 37 bytes: 0105000000abbe88c66c2dda69b5692f85eb3539ffe04328e480c43fd6e2da81348d818582
inbound msg 'inv' from peer 5 (outbound-full-relay, 159.223.42.103:38333) with 37 bytes: 0105000000abbe88c66c2dda69b5692f85eb3539ffe04328e480c43fd6e2da81348d818582
```
Success!
There did still seem to be an issue running `bpftrace` directly though:
```fish
root@ubuntu $ bpftrace contrib/tracing/log_p2p_traffic.bt
FATAL: offset for register H$ not known
fish: Job 1, 'bpftrace contrib/tracing/log_p2ā¦' terminated by signal SIGABRT (Abort)
````
...which sort of sounds like `bpftrace` might be trying to use a hardware register not supported by my kernel? My kernel version is
```fish
āæ uname -r
5.19.0-35-generic
```
## Review
Lightly tested ACK.
1. I didn't manage to get `bpftrace` itself running on my Ubuntu system [yet](https://hackmd.io/@willcl-ark/SyZgMRbg3), but I was able to get the python scripts `log_raw_p2p_msgs.py`, `log_utxocache_flush.py` and `p2p_monitor.py` (using `bcc`) to run successfully under `sudo`.
(I do wonder about the viability of the `bpftrace` scripts in this project, seeing as they seem to be so brittle/difficult to use.)
2. The usdt tests all passed successfully:
```log
interface_usdt_coinselection.py | ā Passed | 5 s
interface_usdt_net.py | ā Passed | 4 s
interface_usdt_utxocache.py | ā Passed | 11 s
interface_usdt_validation.py | ā Passed | 3 s
```
3. The new variadic macro is much simpler to reason about and I agree seems like a nice win all round.
4. I was also able to see the new semaphores being loaded from memory, compared to zero, and conditionally jumped to, as detailed in the PR description, e.g. for `CCoinsViewCache::AddCoin()`
```gdb
...
0x0000000000b60927 <+615>: movzwl 0xa64bea(%rip),%eax # 0x15c5518 <utxocache_add_semaphore>
0x0000000000b6092e <+622>: cmp $0x0,%eax
0x0000000000b60931 <+625>: jle 0xb609d6 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+790>
...
```
5. I don't think having these semaphores in the global namespace should be a big issue for debugging or namespacing. So really it comes down to organisational priorities, where I'd agree with you that having them in the same file as the tracepoint feels cleaner.
## disassembly
### with tracepoints
```gdb
(gdb) disas CCoinsViewCache::AddCoin
Dump of assembler code for function _ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb:
0x0000000000b606c0 <+0>: endbr64
0x0000000000b606c4 <+4>: push %rbp
0x0000000000b606c5 <+5>: mov %rsp,%rbp
0x0000000000b606c8 <+8>: sub $0xe0,%rsp
0x0000000000b606cf <+15>: mov %cl,%al
0x0000000000b606d1 <+17>: mov %fs:0x28,%rcx
0x0000000000b606da <+26>: mov %rcx,-0x8(%rbp)
0x0000000000b606de <+30>: mov %rdi,-0x50(%rbp)
0x0000000000b606e2 <+34>: mov %rsi,-0x58(%rbp)
0x0000000000b606e6 <+38>: mov %rdx,-0x60(%rbp)
0x0000000000b606ea <+42>: and $0x1,%al
0x0000000000b606ec <+44>: mov %al,-0x61(%rbp)
0x0000000000b606ef <+47>: mov -0x50(%rbp),%rax
0x0000000000b606f3 <+51>: mov %rax,-0xa0(%rbp)
0x0000000000b606fa <+58>: mov -0x60(%rbp),%rdi
0x0000000000b606fe <+62>: call 0x35b460 <_ZNK4Coin7IsSpentEv>
0x0000000000b60703 <+67>: xor $0xff,%al
0x0000000000b60705 <+69>: test $0x1,%al
0x0000000000b60707 <+71>: jne 0xb60712 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+82>
0x0000000000b6070d <+77>: jmp 0xb60717 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+87>
0x0000000000b60712 <+82>: jmp 0xb60736 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+118>
0x0000000000b60717 <+87>: lea 0x4dd7aa(%rip),%rdi # 0x103dec8
0x0000000000b6071e <+94>: lea 0x51237f(%rip),%rsi # 0x1072aa4
0x0000000000b60725 <+101>: mov $0x4b,%edx
0x0000000000b6072a <+106>: lea 0x51fea7(%rip),%rcx # 0x10805d8
0x0000000000b60731 <+113>: call 0x35310 <__assert_fail@plt>
0x0000000000b60736 <+118>: mov -0x60(%rbp),%rdi
0x0000000000b6073a <+122>: add $0x8,%rdi
0x0000000000b6073e <+126>: call 0x406370 <_ZNK7CScript13IsUnspendableEv>
0x0000000000b60743 <+131>: test $0x1,%al
0x0000000000b60745 <+133>: jne 0xb60750 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+144>
0x0000000000b6074b <+139>: jmp 0xb60755 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+149>
0x0000000000b60750 <+144>: jmp 0xb609d6 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+790>
0x0000000000b60755 <+149>: lea -0x20(%rbp),%rdi
0x0000000000b60759 <+153>: call 0xb62be0 <_ZNSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEC2Ev>
0x0000000000b6075e <+158>: mov -0xa0(%rbp),%rax
0x0000000000b60765 <+165>: add $0x38,%rax
0x0000000000b60769 <+169>: mov %rax,-0xa8(%rbp)
0x0000000000b60770 <+176>: mov -0x58(%rbp),%rsi
0x0000000000b60774 <+180>: lea -0x30(%rbp),%rdi
0x0000000000b60778 <+184>: call 0xb62a60 <_ZSt16forward_as_tupleIJRK9COutPointEESt5tupleIJDpOT_EES6_>
0x0000000000b6077d <+189>: mov -0xa8(%rbp),%rdi
0x0000000000b60784 <+196>: lea 0x480225(%rip),%rsi # 0xfe09b0 <_ZSt19piecewise_construct>
0x0000000000b6078b <+203>: lea -0x30(%rbp),%rdx
0x0000000000b6078f <+207>: lea -0x38(%rbp),%rcx
0x0000000000b60793 <+211>: call 0xb62c30 <_ZNSt13unordered_mapI9COutPoint16CCoinsCacheEntry20SaltedOutpointHasherSt8equal_toIS0_ESaISt4pairIKS0_S1_EEE7emplaceIJRKSt21piecewise_construct_tSt5tupleIJRS6_EESE_IJEEEEES5_INSt8__detail14_Node_iteratorIS7_Lb0ELb0EEEbEDpOT_>
0x0000000000b60798 <+216>: mov %rax,-0x18(%rbp)
0x0000000000b6079c <+220>: mov %dl,-0x10(%rbp)
0x0000000000b6079f <+223>: lea -0x48(%rbp),%rdi
0x0000000000b607a3 <+227>: lea -0x20(%rbp),%rsi
0x0000000000b607a7 <+231>: lea -0x21(%rbp),%rdx
0x0000000000b607ab <+235>: call 0xb62cb0 <_ZSt3tieIJNSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEEbEESt5tupleIJDpRT_EESB_>
0x0000000000b607b0 <+240>: lea -0x48(%rbp),%rdi
0x0000000000b607b4 <+244>: lea -0x18(%rbp),%rsi
--Type <RET> for more, q to quit, c to continue without paging--c
0x0000000000b607b8 <+248>: call 0xb62d10 <_ZNSt5tupleIJRNSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEERbEEaSIS7_bEENSt9enable_ifIXcl12__assignableIT_T0_EEERSA_E4typeEOS2_ISD_SE_E>
0x0000000000b607bd <+253>: movb $0x0,-0x62(%rbp)
0x0000000000b607c1 <+257>: testb $0x1,-0x21(%rbp)
0x0000000000b607c5 <+261>: jne 0xb607fb <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+315>
0x0000000000b607cb <+267>: lea -0x20(%rbp),%rdi
0x0000000000b607cf <+271>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b607d4 <+276>: mov %rax,%rdi
0x0000000000b607d7 <+279>: add $0x28,%rdi
0x0000000000b607db <+283>: call 0xb62b20 <_ZNK4Coin18DynamicMemoryUsageEv>
0x0000000000b607e0 <+288>: mov %rax,%rdx
0x0000000000b607e3 <+291>: mov -0xa0(%rbp),%rax
0x0000000000b607ea <+298>: mov 0x80(%rax),%rcx
0x0000000000b607f1 <+305>: sub %rdx,%rcx
0x0000000000b607f4 <+308>: mov %rcx,0x80(%rax)
0x0000000000b607fb <+315>: testb $0x1,-0x61(%rbp)
0x0000000000b607ff <+319>: jne 0xb608a2 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+482>
0x0000000000b60805 <+325>: lea -0x20(%rbp),%rdi
0x0000000000b60809 <+329>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b6080e <+334>: mov %rax,%rdi
0x0000000000b60811 <+337>: add $0x28,%rdi
0x0000000000b60815 <+341>: call 0x35b460 <_ZNK4Coin7IsSpentEv>
0x0000000000b6081a <+346>: test $0x1,%al
0x0000000000b6081c <+348>: jne 0xb60885 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+453>
0x0000000000b60822 <+354>: mov $0x10,%edi
0x0000000000b60827 <+359>: call 0x36ac0 <__cxa_allocate_exception@plt>
0x0000000000b6082c <+364>: mov %rax,%rdi
0x0000000000b6082f <+367>: mov %rdi,%rax
0x0000000000b60832 <+370>: mov %rax,-0xb0(%rbp)
0x0000000000b60839 <+377>: lea 0x51fdd8(%rip),%rsi # 0x1080618
0x0000000000b60840 <+384>: call 0x35dd0 <_ZNSt11logic_errorC1EPKc@plt>
0x0000000000b60845 <+389>: jmp 0xb6084a <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+394>
0x0000000000b6084a <+394>: mov -0xb0(%rbp),%rdi
0x0000000000b60851 <+401>: mov 0xa637a0(%rip),%rsi # 0x15c3ff8
0x0000000000b60858 <+408>: mov 0xa63771(%rip),%rdx # 0x15c3fd0
0x0000000000b6085f <+415>: call 0x35990 <__cxa_throw@plt>
0x0000000000b60864 <+420>: endbr64
0x0000000000b60868 <+424>: mov -0xb0(%rbp),%rdi
0x0000000000b6086f <+431>: mov %rax,%rcx
0x0000000000b60872 <+434>: mov %edx,%eax
0x0000000000b60874 <+436>: mov %rcx,-0x70(%rbp)
0x0000000000b60878 <+440>: mov %eax,-0x74(%rbp)
0x0000000000b6087b <+443>: call 0x37290 <__cxa_free_exception@plt>
0x0000000000b60880 <+448>: jmp 0xb609f5 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+821>
0x0000000000b60885 <+453>: lea -0x20(%rbp),%rdi
0x0000000000b60889 <+457>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b6088e <+462>: movzbl 0x58(%rax),%eax
0x0000000000b60892 <+466>: and $0x1,%eax
0x0000000000b60895 <+469>: cmp $0x0,%eax
0x0000000000b60898 <+472>: setne %al
0x0000000000b6089b <+475>: xor $0xff,%al
0x0000000000b6089d <+477>: and $0x1,%al
0x0000000000b6089f <+479>: mov %al,-0x62(%rbp)
0x0000000000b608a2 <+482>: mov -0x60(%rbp),%rax
0x0000000000b608a6 <+486>: mov %rax,-0xc0(%rbp)
0x0000000000b608ad <+493>: lea -0x20(%rbp),%rdi
0x0000000000b608b1 <+497>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b608b6 <+502>: mov -0xc0(%rbp),%rsi
0x0000000000b608bd <+509>: mov %rax,%rdi
0x0000000000b608c0 <+512>: add $0x28,%rdi
0x0000000000b608c4 <+516>: call 0x5d2ae0 <_ZN4CoinaSEOS_>
0x0000000000b608c9 <+521>: mov -0x62(%rbp),%dl
0x0000000000b608cc <+524>: xor %eax,%eax
0x0000000000b608ce <+526>: mov $0x2,%ecx
0x0000000000b608d3 <+531>: test $0x1,%dl
0x0000000000b608d6 <+534>: cmovne %ecx,%eax
0x0000000000b608d9 <+537>: or $0x1,%eax
0x0000000000b608dc <+540>: mov %eax,-0xb4(%rbp)
0x0000000000b608e2 <+546>: lea -0x20(%rbp),%rdi
0x0000000000b608e6 <+550>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b608eb <+555>: mov -0xb4(%rbp),%edx
0x0000000000b608f1 <+561>: movzbl 0x58(%rax),%ecx
0x0000000000b608f5 <+565>: or %edx,%ecx
0x0000000000b608f7 <+567>: mov %cl,0x58(%rax)
0x0000000000b608fa <+570>: lea -0x20(%rbp),%rdi
0x0000000000b608fe <+574>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b60903 <+579>: mov %rax,%rdi
0x0000000000b60906 <+582>: add $0x28,%rdi
0x0000000000b6090a <+586>: call 0xb62b20 <_ZNK4Coin18DynamicMemoryUsageEv>
0x0000000000b6090f <+591>: mov %rax,%rcx
0x0000000000b60912 <+594>: mov -0xa0(%rbp),%rax
0x0000000000b60919 <+601>: add 0x80(%rax),%rcx
0x0000000000b60920 <+608>: mov %rcx,0x80(%rax)
0x0000000000b60927 <+615>: movzwl 0xa64bea(%rip),%eax # 0x15c5518 <utxocache_add_semaphore>
0x0000000000b6092e <+622>: cmp $0x0,%eax
0x0000000000b60931 <+625>: jle 0xb609d6 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+790>
0x0000000000b60937 <+631>: jmp 0xb6093c <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+636>
0x0000000000b6093c <+636>: mov -0x58(%rbp),%rdi
0x0000000000b60940 <+640>: call 0x1f0fe0 <_ZNK9base_blobILj256EE4dataEv>
0x0000000000b60945 <+645>: mov %rax,-0xd8(%rbp)
0x0000000000b6094c <+652>: mov -0x58(%rbp),%rax
0x0000000000b60950 <+656>: mov 0x20(%rax),%eax
0x0000000000b60953 <+659>: mov %eax,-0xd0(%rbp)
0x0000000000b60959 <+665>: lea -0x20(%rbp),%rdi
0x0000000000b6095d <+669>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b60962 <+674>: mov 0x50(%rax),%eax
0x0000000000b60965 <+677>: shr $0x1,%eax
0x0000000000b60968 <+680>: mov %eax,-0xcc(%rbp)
0x0000000000b6096e <+686>: lea -0x20(%rbp),%rdi
0x0000000000b60972 <+690>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b60977 <+695>: mov 0x28(%rax),%rax
0x0000000000b6097b <+699>: mov %rax,-0xc8(%rbp)
0x0000000000b60982 <+706>: lea -0x20(%rbp),%rdi
0x0000000000b60986 <+710>: call 0x5b02e0 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b6098b <+715>: mov %rax,%rdi
0x0000000000b6098e <+718>: add $0x28,%rdi
0x0000000000b60992 <+722>: call 0x413720 <_ZNK4Coin10IsCoinBaseEv>
0x0000000000b60997 <+727>: mov -0xd8(%rbp),%rdi
0x0000000000b6099e <+734>: mov -0xd0(%rbp),%esi
0x0000000000b609a4 <+740>: mov -0xcc(%rbp),%edx
0x0000000000b609aa <+746>: mov -0xc8(%rbp),%rcx
0x0000000000b609b1 <+753>: mov %rdi,-0x80(%rbp)
0x0000000000b609b5 <+757>: mov %esi,-0x84(%rbp)
0x0000000000b609bb <+763>: mov %edx,-0x88(%rbp)
0x0000000000b609c1 <+769>: mov %rcx,-0x90(%rbp)
0x0000000000b609c8 <+776>: and $0x1,%al
0x0000000000b609ca <+778>: mov %al,-0x91(%rbp)
0x0000000000b609d0 <+784>: nop
0x0000000000b609d1 <+785>: jmp 0xb609d6 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+790>
0x0000000000b609d6 <+790>: mov %fs:0x28,%rax
0x0000000000b609df <+799>: mov -0x8(%rbp),%rcx
0x0000000000b609e3 <+803>: cmp %rcx,%rax
0x0000000000b609e6 <+806>: jne 0xb609fe <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+830>
0x0000000000b609ec <+812>: add $0xe0,%rsp
0x0000000000b609f3 <+819>: pop %rbp
0x0000000000b609f4 <+820>: ret
0x0000000000b609f5 <+821>: mov -0x70(%rbp),%rdi
0x0000000000b609f9 <+825>: call 0x35a20 <_Unwind_Resume@plt>
0x0000000000b609fe <+830>: call 0x35510 <__stack_chk_fail@plt>
End of assembler dump.
(gdb)
```
### without tracepoints
```gdb
(gdb) disas CCoinsViewCache::AddCoin
Dump of assembler code for function _ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb:
0x0000000000b5fde0 <+0>: endbr64
0x0000000000b5fde4 <+4>: push %rbp
0x0000000000b5fde5 <+5>: mov %rsp,%rbp
0x0000000000b5fde8 <+8>: sub $0xa0,%rsp
0x0000000000b5fdef <+15>: mov %cl,%al
0x0000000000b5fdf1 <+17>: mov %fs:0x28,%rcx
0x0000000000b5fdfa <+26>: mov %rcx,-0x8(%rbp)
0x0000000000b5fdfe <+30>: mov %rdi,-0x50(%rbp)
0x0000000000b5fe02 <+34>: mov %rsi,-0x58(%rbp)
0x0000000000b5fe06 <+38>: mov %rdx,-0x60(%rbp)
0x0000000000b5fe0a <+42>: and $0x1,%al
0x0000000000b5fe0c <+44>: mov %al,-0x61(%rbp)
0x0000000000b5fe0f <+47>: mov -0x50(%rbp),%rax
0x0000000000b5fe13 <+51>: mov %rax,-0x80(%rbp)
0x0000000000b5fe17 <+55>: mov -0x60(%rbp),%rdi
0x0000000000b5fe1b <+59>: call 0x35b210 <_ZNK4Coin7IsSpentEv>
0x0000000000b5fe20 <+64>: xor $0xff,%al
0x0000000000b5fe22 <+66>: test $0x1,%al
0x0000000000b5fe24 <+68>: jne 0xb5fe2f <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+79>
0x0000000000b5fe2a <+74>: jmp 0xb5fe34 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+84>
0x0000000000b5fe2f <+79>: jmp 0xb5fe53 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+115>
0x0000000000b5fe34 <+84>: lea 0x4dd08d(%rip),%rdi # 0x103cec8
0x0000000000b5fe3b <+91>: lea 0x511c62(%rip),%rsi # 0x1071aa4
0x0000000000b5fe42 <+98>: mov $0x4b,%edx
0x0000000000b5fe47 <+103>: lea 0x51f78a(%rip),%rcx # 0x107f5d8
0x0000000000b5fe4e <+110>: call 0x35310 <__assert_fail@plt>
0x0000000000b5fe53 <+115>: mov -0x60(%rbp),%rdi
--Type <RET> for more, q to quit, c to continue without paging--c
0x0000000000b5fe57 <+119>: add $0x8,%rdi
0x0000000000b5fe5b <+123>: call 0x406120 <_ZNK7CScript13IsUnspendableEv>
0x0000000000b5fe60 <+128>: test $0x1,%al
0x0000000000b5fe62 <+130>: jne 0xb5fe6d <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+141>
0x0000000000b5fe68 <+136>: jmp 0xb5fe72 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+146>
0x0000000000b5fe6d <+141>: jmp 0xb6003b <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+603>
0x0000000000b5fe72 <+146>: lea -0x20(%rbp),%rdi
0x0000000000b5fe76 <+150>: call 0xb62110 <_ZNSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEC2Ev>
0x0000000000b5fe7b <+155>: mov -0x80(%rbp),%rax
0x0000000000b5fe7f <+159>: add $0x38,%rax
0x0000000000b5fe83 <+163>: mov %rax,-0x88(%rbp)
0x0000000000b5fe8a <+170>: mov -0x58(%rbp),%rsi
0x0000000000b5fe8e <+174>: lea -0x30(%rbp),%rdi
0x0000000000b5fe92 <+178>: call 0xb61f90 <_ZSt16forward_as_tupleIJRK9COutPointEESt5tupleIJDpOT_EES6_>
0x0000000000b5fe97 <+183>: mov -0x88(%rbp),%rdi
0x0000000000b5fe9e <+190>: lea 0x47fb0b(%rip),%rsi # 0xfdf9b0 <_ZSt19piecewise_construct>
0x0000000000b5fea5 <+197>: lea -0x30(%rbp),%rdx
0x0000000000b5fea9 <+201>: lea -0x38(%rbp),%rcx
0x0000000000b5fead <+205>: call 0xb62160 <_ZNSt13unordered_mapI9COutPoint16CCoinsCacheEntry20SaltedOutpointHasherSt8equal_toIS0_ESaISt4pairIKS0_S1_EEE7emplaceIJRKSt21piecewise_construct_tSt5tupleIJRS6_EESE_IJEEEEES5_INSt8__detail14_Node_iteratorIS7_Lb0ELb0EEEbEDpOT_>
0x0000000000b5feb2 <+210>: mov %rax,-0x18(%rbp)
0x0000000000b5feb6 <+214>: mov %dl,-0x10(%rbp)
0x0000000000b5feb9 <+217>: lea -0x48(%rbp),%rdi
0x0000000000b5febd <+221>: lea -0x20(%rbp),%rsi
0x0000000000b5fec1 <+225>: lea -0x21(%rbp),%rdx
0x0000000000b5fec5 <+229>: call 0xb621e0 <_ZSt3tieIJNSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEEbEESt5tupleIJDpRT_EESB_>
0x0000000000b5feca <+234>: lea -0x48(%rbp),%rdi
0x0000000000b5fece <+238>: lea -0x18(%rbp),%rsi
0x0000000000b5fed2 <+242>: call 0xb62240 <_ZNSt5tupleIJRNSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEERbEEaSIS7_bEENSt9enable_ifIXcl12__assignableIT_T0_EEERSA_E4typeEOS2_ISD_SE_E>
0x0000000000b5fed7 <+247>: movb $0x0,-0x62(%rbp)
0x0000000000b5fedb <+251>: testb $0x1,-0x21(%rbp)
0x0000000000b5fedf <+255>: jne 0xb5ff12 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+306>
0x0000000000b5fee5 <+261>: lea -0x20(%rbp),%rdi
0x0000000000b5fee9 <+265>: call 0x5b0090 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b5feee <+270>: mov %rax,%rdi
0x0000000000b5fef1 <+273>: add $0x28,%rdi
0x0000000000b5fef5 <+277>: call 0xb62050 <_ZNK4Coin18DynamicMemoryUsageEv>
0x0000000000b5fefa <+282>: mov %rax,%rdx
0x0000000000b5fefd <+285>: mov -0x80(%rbp),%rax
0x0000000000b5ff01 <+289>: mov 0x80(%rax),%rcx
0x0000000000b5ff08 <+296>: sub %rdx,%rcx
0x0000000000b5ff0b <+299>: mov %rcx,0x80(%rax)
0x0000000000b5ff12 <+306>: testb $0x1,-0x61(%rbp)
0x0000000000b5ff16 <+310>: jne 0xb5ffb9 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+473>
0x0000000000b5ff1c <+316>: lea -0x20(%rbp),%rdi
0x0000000000b5ff20 <+320>: call 0x5b0090 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b5ff25 <+325>: mov %rax,%rdi
0x0000000000b5ff28 <+328>: add $0x28,%rdi
0x0000000000b5ff2c <+332>: call 0x35b210 <_ZNK4Coin7IsSpentEv>
0x0000000000b5ff31 <+337>: test $0x1,%al
0x0000000000b5ff33 <+339>: jne 0xb5ff9c <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+444>
0x0000000000b5ff39 <+345>: mov $0x10,%edi
0x0000000000b5ff3e <+350>: call 0x36ac0 <__cxa_allocate_exception@plt>
0x0000000000b5ff43 <+355>: mov %rax,%rdi
0x0000000000b5ff46 <+358>: mov %rdi,%rax
0x0000000000b5ff49 <+361>: mov %rax,-0x90(%rbp)
0x0000000000b5ff50 <+368>: lea 0x51f6c1(%rip),%rsi # 0x107f618
0x0000000000b5ff57 <+375>: call 0x35dd0 <_ZNSt11logic_errorC1EPKc@plt>
0x0000000000b5ff5c <+380>: jmp 0xb5ff61 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+385>
0x0000000000b5ff61 <+385>: mov -0x90(%rbp),%rdi
0x0000000000b5ff68 <+392>: mov 0xa63089(%rip),%rsi # 0x15c2ff8
0x0000000000b5ff6f <+399>: mov 0xa6305a(%rip),%rdx # 0x15c2fd0
0x0000000000b5ff76 <+406>: call 0x35990 <__cxa_throw@plt>
0x0000000000b5ff7b <+411>: endbr64
0x0000000000b5ff7f <+415>: mov -0x90(%rbp),%rdi
0x0000000000b5ff86 <+422>: mov %rax,%rcx
0x0000000000b5ff89 <+425>: mov %edx,%eax
0x0000000000b5ff8b <+427>: mov %rcx,-0x70(%rbp)
0x0000000000b5ff8f <+431>: mov %eax,-0x74(%rbp)
0x0000000000b5ff92 <+434>: call 0x37290 <__cxa_free_exception@plt>
0x0000000000b5ff97 <+439>: jmp 0xb6005a <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+634>
0x0000000000b5ff9c <+444>: lea -0x20(%rbp),%rdi
0x0000000000b5ffa0 <+448>: call 0x5b0090 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b5ffa5 <+453>: movzbl 0x58(%rax),%eax
0x0000000000b5ffa9 <+457>: and $0x1,%eax
0x0000000000b5ffac <+460>: cmp $0x0,%eax
0x0000000000b5ffaf <+463>: setne %al
0x0000000000b5ffb2 <+466>: xor $0xff,%al
0x0000000000b5ffb4 <+468>: and $0x1,%al
0x0000000000b5ffb6 <+470>: mov %al,-0x62(%rbp)
0x0000000000b5ffb9 <+473>: mov -0x60(%rbp),%rax
0x0000000000b5ffbd <+477>: mov %rax,-0xa0(%rbp)
0x0000000000b5ffc4 <+484>: lea -0x20(%rbp),%rdi
0x0000000000b5ffc8 <+488>: call 0x5b0090 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b5ffcd <+493>: mov -0xa0(%rbp),%rsi
0x0000000000b5ffd4 <+500>: mov %rax,%rdi
0x0000000000b5ffd7 <+503>: add $0x28,%rdi
0x0000000000b5ffdb <+507>: call 0x5d2890 <_ZN4CoinaSEOS_>
0x0000000000b5ffe0 <+512>: mov -0x62(%rbp),%dl
0x0000000000b5ffe3 <+515>: xor %eax,%eax
0x0000000000b5ffe5 <+517>: mov $0x2,%ecx
0x0000000000b5ffea <+522>: test $0x1,%dl
0x0000000000b5ffed <+525>: cmovne %ecx,%eax
0x0000000000b5fff0 <+528>: or $0x1,%eax
0x0000000000b5fff3 <+531>: mov %eax,-0x94(%rbp)
0x0000000000b5fff9 <+537>: lea -0x20(%rbp),%rdi
0x0000000000b5fffd <+541>: call 0x5b0090 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b60002 <+546>: mov -0x94(%rbp),%edx
0x0000000000b60008 <+552>: movzbl 0x58(%rax),%ecx
0x0000000000b6000c <+556>: or %edx,%ecx
0x0000000000b6000e <+558>: mov %cl,0x58(%rax)
0x0000000000b60011 <+561>: lea -0x20(%rbp),%rdi
0x0000000000b60015 <+565>: call 0x5b0090 <_ZNKSt8__detail14_Node_iteratorISt4pairIK9COutPoint16CCoinsCacheEntryELb0ELb0EEptEv>
0x0000000000b6001a <+570>: mov %rax,%rdi
0x0000000000b6001d <+573>: add $0x28,%rdi
0x0000000000b60021 <+577>: call 0xb62050 <_ZNK4Coin18DynamicMemoryUsageEv>
0x0000000000b60026 <+582>: mov %rax,%rcx
0x0000000000b60029 <+585>: mov -0x80(%rbp),%rax
0x0000000000b6002d <+589>: add 0x80(%rax),%rcx
0x0000000000b60034 <+596>: mov %rcx,0x80(%rax)
0x0000000000b6003b <+603>: mov %fs:0x28,%rax
0x0000000000b60044 <+612>: mov -0x8(%rbp),%rcx
0x0000000000b60048 <+616>: cmp %rcx,%rax
0x0000000000b6004b <+619>: jne 0xb60063 <_ZN15CCoinsViewCache7AddCoinERK9COutPointO4Coinb+643>
0x0000000000b60051 <+625>: add $0xa0,%rsp
0x0000000000b60058 <+632>: pop %rbp
0x0000000000b60059 <+633>: ret
0x0000000000b6005a <+634>: mov -0x70(%rbp),%rdi
0x0000000000b6005e <+638>: call 0x35a20 <_Unwind_Resume@plt>
0x0000000000b60063 <+643>: call 0x35510 <__stack_chk_fail@plt>
End of assembler dump.
(gdb)
```