Skip to content
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

hangs upon execution #20

Open
nolash opened this issue Aug 3, 2017 · 4 comments
Open

hangs upon execution #20

nolash opened this issue Aug 3, 2017 · 4 comments

Comments

@nolash
Copy link

nolash commented Aug 3, 2017

compiling the following with solc --optimize --bin-runtime

pragma solidity ^0.4.11;

contract Simple {
	bytes32 public v;
	function set(bytes32 _v) {
		v = _v;
	}
}

bytecode:

606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416637c2efcba81146046578063db80813f146068575b600080fd5b3415605057600080fd5b6056607d565b60405190815260200160405180910390f35b3415607257600080fd5b607b6004356083565b005b60005481565b60008190555b505600a165627a7a72305820645352c019aae26da402b9c2edac41e0989caf52f865879af82a9646ae1f3f9c0029

I then try:

evmdis -log <binfile>
evmdis -log <bytecode>

The command hangs till I manually SIGINT.


I try:

cat <binfile> | evmdis -log

I get:

2017/08/03 09:24:35 Entering block at 0 with stack height 0
# Stack: []
0x0	STOP()

I also tried solc --optimize --bin and evmdis -ctor -log, same results.


My setup:

  • evmdis: 1abeda0
  • solc: 0.4.14-develop.2017.7.27+commit.16ca1eea.Linux.g++
  • gcc/g++: 7.1.1
  • linux: 4.11.3-1-ARCH
@Macil
Copy link

Macil commented Sep 12, 2017

Yeah I'm having the same behavior too. http://blog.curvegrid.com/daysofblock/2017/05/11/daysofblock-01-evmdis.html makes it look like you are in fact supposed to pass the input through stdin, but my results match up with you rather than that blog post.

@shoenseiwaso
Copy link
Contributor

@nolash, you need to pipe the hex into evmdis, it won't take a file as a parameter. So your cat <binfile> | evmdis -log is the right idea. I suspect what's happening with the short output is your <binfile> has a newline on the end, which causes that output.

Compare the following. evmdis-issue-6-orig-crlf.hex has a newline on the end and evmdis-issue-6-orig.hex doesn't, otherwise they are identical. I copied the compiled Solidity hex code you pasted verbatim:

$ cat evmdis-issue-6-orig-crlf.hex | evmdis -log
2017/09/12 21:08:10 Entering block at 0 with stack height 0
# Stack: []
0x0	STOP()

$ cat evmdis-issue-6-orig.hex | evmdis -log
2017/09/12 21:06:51 Entering block at 0 with stack height 0
2017/09/12 21:06:51 Entering block at 55 with stack height 1
2017/09/12 21:06:51 Entering block at 66 with stack height 1
2017/09/12 21:06:51 Entering block at 105 with stack height 1
2017/09/12 21:06:51 Entering block at 110 with stack height 1
2017/09/12 21:06:51 Entering block at 115 with stack height 1
2017/09/12 21:06:51 Entering block at 132 with stack height 3
2017/09/12 21:06:51 Entering block at 138 with stack height 3
2017/09/12 21:06:51 Entering block at 124 with stack height 1
2017/09/12 21:06:51 Entering block at 71 with stack height 1
2017/09/12 21:06:51 Entering block at 76 with stack height 1
2017/09/12 21:06:51 Entering block at 81 with stack height 1
2017/09/12 21:06:51 Entering block at 126 with stack height 2
2017/09/12 21:06:51 Entering block at 87 with stack height 3
# Stack: []
0x4	MSTORE(0x40, 0x60)
0x2C	PUSH(CALLDATALOAD(0x0) / 0x100000000000000000000000000000000000000000000000000000000 & 0xFFFFFFFF)
0x32	DUP1
0x36	JUMPI(:label0, POP() == 0x7C2EFCBA)

# Stack: [@0x2C]
0x37	DUP1
0x40	JUMPI(:label3, 0xDB80813F == POP())

# Stack: [@0x2C]
0x42	PUSH(0x0)
<snip>

Hope that helps!

And obviously a future enhancement opportunity to improve the help text (evmdis -h), README and overall handling of newlines.

@shoenseiwaso
Copy link
Contributor

@agentme could you check my previous comment and see if that helps?

@Macil
Copy link

Macil commented Sep 12, 2017

Yep, it was the newline at the end! Works great when I cut that out, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants