asmrepl 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 868cc79827c27b7e43792489b2aee04b8fdaf4222548ebbd5031df922ac396fd
4
- data.tar.gz: c189044380f910556dd7145b64f8282d2761c17c2e50b5e8307e2a13be4caf33
3
+ metadata.gz: 1fea751dab8edd03b3cecfb3ea60417c34a9464f19c6e2bc2c2b67b4dcc209cd
4
+ data.tar.gz: db10a7a8e9a385bcafa3d517dc851774f52a657184334c493627e7cd09d7f870
5
5
  SHA512:
6
- metadata.gz: 93cbff64ab41daff394f3ef626b6f0d8fbeb375bc011f1a4b3c7cb06f6915999afa2483cc669837239e2b0ee6afb277aae3c670a6e7450f162a786e61b78c955
7
- data.tar.gz: ec88dfc248ce72f21d0653b83faab3b9d2ee6c8f8a255c309cf5c40393a53149cb4c7fc3b8b06d7068bb69b84a4c9a67928604051798ad5ee05198f015447fa4
6
+ metadata.gz: cf9202d1ec0d1700f404f6b8e3c353b56b1985b9a36b4e7520857ac228815439d424c63936b840b56c4a0d073a5814ac699e4afa146ffa73e360b39ec526f05f
7
+ data.tar.gz: 7c999f1a3b51ea5156e4224296b2df27ca509ae5a4becec8f9d2c57ef1a6af4338993137efe98e98f75ffed1fff791a25c530e5bdd75d36b18f025a8e8aa4a50
data/lib/asmrepl/repl.rb CHANGED
@@ -55,36 +55,40 @@ module ASMREPL
55
55
  pos = (state.rip - @buffer.memory.to_i)
56
56
  @buffer.seek pos
57
57
  use_history = true
58
- loop do
59
- cmd = nil
60
- text = Reline.readmultiline(">> ", use_history) do |multiline_input|
61
- if multiline_input =~ /\A\s*(\w+)\s*\Z/
62
- register = $1
63
- cmd = [:read, register]
64
- else
65
- cmd = :run
58
+ begin
59
+ loop do
60
+ cmd = nil
61
+ text = Reline.readmultiline(">> ", use_history) do |multiline_input|
62
+ if multiline_input =~ /\A\s*(\w+)\s*\Z/
63
+ register = $1
64
+ cmd = [:read, register]
65
+ else
66
+ cmd = :run
67
+ end
68
+ true
66
69
  end
67
- true
68
- end
69
70
 
70
- case cmd
71
- in :run
72
- break if text.chomp.empty?
73
- binary = @assembler.assemble @parser.parse text.chomp
74
- binary.bytes.each { |byte| @buffer.putc byte }
75
- break
76
- in [:read, "cpu"]
77
- display_state state
78
- in [:read, reg]
79
- val = state[reg]
80
- if val
81
- puts sprintf("%#018x", state[reg])
71
+ case cmd
72
+ in :run
73
+ break if text.chomp.empty?
74
+ binary = @assembler.assemble @parser.parse text.chomp
75
+ binary.bytes.each { |byte| @buffer.putc byte }
76
+ break
77
+ in [:read, "cpu"]
78
+ display_state state
79
+ in [:read, reg]
80
+ val = state[reg]
81
+ if val
82
+ puts sprintf("%#018x", state[reg])
83
+ else
84
+ puts "Unknown command: "
85
+ puts " " + text
86
+ end
82
87
  else
83
- puts "Unknown command: "
84
- puts " " + text
85
88
  end
86
- else
87
89
  end
90
+ rescue Interrupt
91
+ exit 0
88
92
  end
89
93
  tracer.continue
90
94
  end
@@ -1,3 +1,3 @@
1
1
  module ASMREPL
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asmrepl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-29 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest