| 915 | } |
| 916 | |
| 917 | DebugRegister DbgEngAdapter::ReadRegister(const std::string& reg) |
| 918 | { |
| 919 | if (!m_debugRegisters) |
| 920 | return DebugRegister {}; |
| 921 | |
| 922 | unsigned long reg_index {}; |
| 923 | DEBUG_VALUE debug_value {}; |
| 924 | DEBUG_REGISTER_DESCRIPTION register_descriptor {}; |
| 925 | |
| 926 | if (this->m_debugRegisters->GetIndexByName(reg.c_str(), ®_index) != S_OK) |
| 927 | return {}; |
| 928 | |
| 929 | if (this->m_debugRegisters->GetValue(reg_index, &debug_value) != S_OK) |
| 930 | return {}; |
| 931 | |
| 932 | char buf[256]; |
| 933 | unsigned long reg_length {}; |
| 934 | if (this->m_debugRegisters->GetDescription(reg_index, buf, 256, ®_length, ®ister_descriptor) != S_OK) |
| 935 | return {}; |
| 936 | |
| 937 | std::size_t width {}; |
| 938 | switch (register_descriptor.Type) |
| 939 | { |
| 940 | case DEBUG_VALUE_INT8: |
| 941 | width = 8; |
| 942 | break; |
| 943 | case DEBUG_VALUE_INT16: |
| 944 | width = 16; |
| 945 | break; |
| 946 | case DEBUG_VALUE_INT32: |
| 947 | width = 32; |
| 948 | break; |
| 949 | case DEBUG_VALUE_INT64: |
| 950 | width = 64; |
| 951 | break; |
| 952 | case DEBUG_VALUE_FLOAT32: |
| 953 | width = 32; |
| 954 | break; |
| 955 | case DEBUG_VALUE_FLOAT64: |
| 956 | width = 64; |
| 957 | break; |
| 958 | case DEBUG_VALUE_FLOAT80: |
| 959 | width = 80; |
| 960 | break; |
| 961 | case DEBUG_VALUE_FLOAT128: |
| 962 | width = 128; |
| 963 | break; |
| 964 | case DEBUG_VALUE_VECTOR64: |
| 965 | width = 64; |
| 966 | break; |
| 967 | case DEBUG_VALUE_VECTOR128: |
| 968 | width = 128; |
| 969 | break; |
| 970 | default: |
| 971 | break; |
| 972 | } |
| 973 | |
| 974 | return DebugRegister {reg, debug_value.I64, width, reg_index}; |
no outgoing calls
no test coverage detected