OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #region | |
6 | |
7 using Google.MsAd7.BaseImpl.Interfaces; | |
8 using NaClVsx; | |
9 using NaClVsx.DebugHelpers; | |
10 | |
11 #endregion | |
12 | |
13 namespace Google.NaClVsx.DebugSupport.DWARF { | |
14 class VirtualMachineInputs : IDwarfVM { | |
15 public VirtualMachineInputs(ISimpleDebugger dbg, ulong frameBase) { | |
16 dbg_ = dbg; | |
17 frameBase_ = frameBase; | |
18 } | |
19 | |
20 public ulong FrameBase { | |
21 get { return frameBase_; } | |
22 set { frameBase_ = value; } | |
23 } | |
24 | |
25 #region Implementation of IDwarfVM | |
26 | |
27 public uint BitWidth() { | |
28 return bitWidth_; | |
29 } | |
30 | |
31 public bool IsLSB() { | |
32 return isLsb_; | |
33 } | |
34 | |
35 public void ErrorString(string str) { | |
36 msg_ = str; | |
37 } | |
38 | |
39 public ulong ReadRegister(int regNumber) { | |
40 if (registers_ == null) { | |
41 if (dbg_ != null) { | |
42 //TODO(noelallen) : this should have a copy of the regs? | |
43 registers_ = (RegsX86_64) dbg_.GetRegisters(0); | |
44 } else { | |
45 registers_ = new RegsX86_64(); | |
46 } | |
47 } | |
48 return registers_[regNumber]; | |
49 } | |
50 | |
51 public ulong ReadMemory(ulong address, int count) { | |
52 ulong result = 0; | |
53 if (dbg_ != null) { | |
54 // line below from Ian's RSP branch | |
55 result = dbg_.GetU64(address + dbg_.BaseAddress); | |
56 | |
57 // this is what the code originally was. | |
58 //result = dbg_.GetU64(address); | |
59 // FIXME -- clean this up...but I am not hitting this | |
60 // code yet (when I set a breakpoint) so I don't want | |
61 // to remove the comments and FIXME until I evaluate it | |
62 // more | |
63 } | |
64 return result; | |
65 } | |
66 | |
67 public ulong ReadFrameBase() { | |
68 return frameBase_; | |
69 } | |
70 | |
71 #endregion | |
72 | |
73 #region Private Implementation | |
74 | |
75 private readonly ISimpleDebugger dbg_; | |
76 | |
77 private uint bitWidth_ = 64; | |
78 ulong frameBase_; | |
79 private bool isLsb_ = true; | |
80 private string msg_ = "OK"; | |
81 private RegsX86_64 registers_; | |
82 | |
83 #endregion | |
84 } | |
85 } | |
OLD | NEW |