結論:使いづらい。。。。。。 現状はbrowser-solidityの方がいいかも。
step実行の時のstepの単位がよくわからない(opcode単位でも行数単位でもないっぽい?)し、途中でlineナンバーが拾えないようでエラー吐くし。。
一応、truffle debuggerを簡単に試すやり方をまとめます。
以前の記事のプロジェクトをそのまま使います。
y-nakajo.hatenablog.com
上記の記事の通りテストまで一通り作って、truffle developを起動してmigrate ~ testまで実行します。
truffle(develop)> migrate Using network 'develop'. Running migration: 1_initial_migration.js Replacing Migrations... ... 0xbe13d431f1f9427a6d2638c8c48e2328bbc545e3fc415c7c39d5a5e873340ea0 Migrations: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0 Saving successful migration to network... ... 0xd7bc86d31bee32fa3988f1c1eabce403a1b5d570340a3a9cdba53a472ee8c956 Saving artifacts... Running migration: 1510906576_deploy_simple_storage.js Replacing SimpleStorage... ... 0xec9b406bac932fad450d0527d63cda45ac55e1292fc7397a4ff1e3beecd382d4 SimpleStorage: 0x345ca3e014aaf5dca488057592ee47305d9b3e10 Saving successful migration to network... ... 0xf2442cc9c61b78c7774df383a6295688921acd416b56f83d0064f7756bccfd6a Saving artifacts... truffle(develop)> test Using network 'develop'. Contract: SimpleStorageTest ✓ should assert true ✓ SimpleStorage should be return last message. (150ms) 2 passing (171ms) truffle(develop)>
次に、最後に発行したtransaction hashを取得します。
truffle(develop)> web3.eth.getBlock('latest').transactions [ '0xd55f189b16dee778d8774ef40fa42d8cff19d250f6248ae402ed48f5f85138b5' ]
そしたら、このtransaction hashをコピペしてdebuggerを起動します。注意点としては文字列にして渡したらダメです。""で囲んだりせずそのまま渡します。もちろん変数に格納して渡すのもダメです。変数展開してくれません。
truffle(develop)> debug 0xd55f189b16dee778d8774ef40fa42d8cff19d250f6248ae402ed48f5f85138b5 Note: This feature's in beta. Please discuss any issues you find in our Gitter channel! https://gitter.im/ConsenSys/truffle Gathering transaction data... Addresses affected: 0x2c2b9c9a4a25e24b174f26114e8926a9f2128fe4 - SimpleStorage Commands: (enter) last command entered (step next) (o) step over, (i) step into, (u) step out, (n) step next (;) step instruction, (p) print instruction, (h) print this help, (q) quit SimpleStorage.sol | 0x2c2b9c9a4a25e24b174f26114e8926a9f2128fe4: 1: pragma solidity ^0.4.4; 2: 3: contract SimpleStorage { ^^^^^^^^^^^^^^^^^^^^^^^ debug(develop:0xd55f189b...)> |<<