mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-17 12:34:35 +03:00
Improved natvis support
This commit is contained in:
@@ -49,6 +49,10 @@ if (NOT DEFINED ASMJIT_TEST)
|
||||
set(ASMJIT_TEST FALSE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ASMJIT_NO_NATVIS)
|
||||
set(ASMJIT_NO_NATVIS FALSE)
|
||||
endif()
|
||||
|
||||
# EMBED implies STATIC.
|
||||
if (ASMJIT_EMBED AND NOT ASMJIT_STATIC)
|
||||
set(ASMJIT_STATIC TRUE)
|
||||
@@ -257,6 +261,16 @@ foreach(build_option ASMJIT_STATIC
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# =============================================================================
|
||||
# [AsmJit - Linker Support]
|
||||
# =============================================================================
|
||||
|
||||
if (WIN32)
|
||||
if(CMAKE_LINKER MATCHES "link\\.exe" OR CMAKE_LINKER MATCHES "lld-link\\.exe")
|
||||
set(ASMJIT_LINKER_SUPPORTS_NATVIS TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# =============================================================================
|
||||
# [AsmJit - Source]
|
||||
# =============================================================================
|
||||
@@ -366,14 +380,22 @@ set(ASMJIT_SRC_LIST
|
||||
asmjit/x86/x86rapass_p.h
|
||||
)
|
||||
|
||||
#if (MSVC)
|
||||
# list(APPEND ASMJIT_SRC_LIST asmjit.natvis)
|
||||
#endif()
|
||||
if (MSVC AND NOT ASMJIT_NO_NATVIS)
|
||||
list(APPEND ASMJIT_SRC_LIST asmjit.natvis)
|
||||
endif()
|
||||
|
||||
set(ASMJIT_SRC "")
|
||||
foreach(_src_file ${ASMJIT_SRC_LIST})
|
||||
list(APPEND ASMJIT_SRC "${ASMJIT_DIR}/src/${_src_file}")
|
||||
foreach(src_file ${ASMJIT_SRC_LIST})
|
||||
set(src_file "${ASMJIT_DIR}/src/${src_file}")
|
||||
list(APPEND ASMJIT_SRC ${src_file})
|
||||
|
||||
if ("${src_file}" MATCHES "\\.natvis")
|
||||
if (ASMJIT_LINKER_SUPPORTS_NATVIS)
|
||||
list(APPEND ASMJIT_PRIVATE_LFLAGS "-natvis:${src_file}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
source_group(TREE "${ASMJIT_DIR}" FILES ${ASMJIT_SRC})
|
||||
endif()
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- asmjit visualizer for Visual Studio (natvis) -->
|
||||
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="asmjit::String">
|
||||
<Intrinsic Name="isSmall" Expression="(_type < 0x1F)"/>
|
||||
<DisplayString Condition="isSmall()">{_small.data, s8}</DisplayString>
|
||||
<DisplayString Condition="!isSmall()">{_large.data, s8}</DisplayString>
|
||||
<Expand HideRawView="true">
|
||||
<Synthetic Name="_type">
|
||||
<DisplayString Condition="(_type < 0x1F)">Small</DisplayString>
|
||||
<DisplayString Condition="(_type == 0x1F)">Large</DisplayString>
|
||||
<DisplayString Condition="(_type > 0x1F)">External</DisplayString>
|
||||
</Synthetic>
|
||||
<Item Name="_size" Condition="isSmall()" ExcludeView="simple">(int)_small.type, d</Item>
|
||||
<Item Name="_size" Condition="!isSmall()" ExcludeView="simple">_large.size, d</Item>
|
||||
<Item Name="_capacity" Condition="isSmall()" ExcludeView="simple">asmjit::String::kSSOCapacity, d</Item>
|
||||
<Item Name="_capacity" Condition="!isSmall()" ExcludeView="simple">_large.capacity, d</Item>
|
||||
<Item Name="_data" Condition="isSmall()" ExcludeView="simple">_small.data, s8</Item>
|
||||
<Item Name="_data" Condition="!isSmall()" ExcludeView="simple">_large.data, s8</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="asmjit::ZoneVector<*>">
|
||||
<DisplayString>{{ [size={_size, d} capacity={_capacity, d}] }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="_size" ExcludeView="simple">_size, d</Item>
|
||||
<Item Name="_capacity" ExcludeView="simple">_capacity, d</Item>
|
||||
<ArrayItems>
|
||||
<Size>_size</Size>
|
||||
<ValuePointer>(($T1*)_data)</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="asmjit::Operand_">
|
||||
<Intrinsic Name="opType" Expression="(unsigned int)(_any.signature & 0x7)"/>
|
||||
<DisplayString Condition="opType() == 0">[None]</DisplayString>
|
||||
<DisplayString Condition="opType() == 1">[Reg] {{ id={_reg.id, d} group={(_reg.signature >> 8) & 0xF, d} type={(_reg.signature >> 4) & 0x1F, d} size={(_reg.signature >> 24) & 0xFF, d} }}</DisplayString>
|
||||
<DisplayString Condition="opType() == 2">[Mem] {{ }}</DisplayString>
|
||||
<DisplayString Condition="opType() == 3">[Imm] {{ val={_imm.value.i64, d} hex={_imm.value.u64, X} f64={_imm.value.f64} }}</DisplayString>
|
||||
<DisplayString Condition="opType() == 4">[Label] {{ id={_label.id} }}</DisplayString>
|
||||
<DisplayString Condition="opType() > 4">[Unknown]</DisplayString>
|
||||
<Expand HideRawView="true">
|
||||
<ExpandedItem Condition="opType() == 0">_any</ExpandedItem>
|
||||
<ExpandedItem Condition="opType() == 1">_reg</ExpandedItem>
|
||||
<ExpandedItem Condition="opType() == 2">_mem</ExpandedItem>
|
||||
<ExpandedItem Condition="opType() == 3">_imm</ExpandedItem>
|
||||
<ExpandedItem Condition="opType() == 4">_label</ExpandedItem>
|
||||
<ExpandedItem Condition="opType() > 4">_any</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
||||
83
src/asmjit.natvis
Normal file
83
src/asmjit.natvis
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- asmjit visualizer for Visual Studio (natvis) -->
|
||||
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="asmjit::String">
|
||||
<Intrinsic Name="isSmall" Expression="(_type < 0x1F)"/>
|
||||
<DisplayString Condition="isSmall()">{_small.data, s8}</DisplayString>
|
||||
<DisplayString Condition="!isSmall()">{_large.data, s8}</DisplayString>
|
||||
<Expand HideRawView="true">
|
||||
<Synthetic Name="_type">
|
||||
<DisplayString Condition="(_type < 0x1F)">Small</DisplayString>
|
||||
<DisplayString Condition="(_type == 0x1F)">Large</DisplayString>
|
||||
<DisplayString Condition="(_type > 0x1F)">External</DisplayString>
|
||||
</Synthetic>
|
||||
<Item Name="_size" Condition="isSmall()" ExcludeView="simple">(int)_small.type, d</Item>
|
||||
<Item Name="_size" Condition="!isSmall()" ExcludeView="simple">_large.size, d</Item>
|
||||
<Item Name="_capacity" Condition="isSmall()" ExcludeView="simple">asmjit::String::kSSOCapacity, d</Item>
|
||||
<Item Name="_capacity" Condition="!isSmall()" ExcludeView="simple">_large.capacity, d</Item>
|
||||
<Item Name="_data" Condition="isSmall()" ExcludeView="simple">_small.data, s8</Item>
|
||||
<Item Name="_data" Condition="!isSmall()" ExcludeView="simple">_large.data, s8</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="asmjit::ZoneVector<*>">
|
||||
<DisplayString>{{ [size={_size, d} capacity={_capacity, d}] }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="_size" ExcludeView="simple">_size, d</Item>
|
||||
<Item Name="_capacity" ExcludeView="simple">_capacity, d</Item>
|
||||
<ArrayItems>
|
||||
<Size>_size</Size>
|
||||
<ValuePointer>(($T1*)_data)</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="asmjit::Operand_">
|
||||
<Intrinsic Name="opType" Expression="(unsigned int)(_signature & 0x7)"/>
|
||||
<Intrinsic Name="opSize" Expression="(_signature >> 24) & 0xFF"/>
|
||||
|
||||
<Intrinsic Name="regType" Expression="(_signature >> 3) & 0x1F"/>
|
||||
<Intrinsic Name="regGroup" Expression="(_signature >> 8) & 0xF"/>
|
||||
|
||||
<Intrinsic Name="memBaseType" Expression="(_signature >> 3) & 0x1F"/>
|
||||
<Intrinsic Name="memIndexType" Expression="(_signature >> 8) & 0x1F"/>
|
||||
<Intrinsic Name="memAddrType" Expression="(_signature >> 13) & 0x3"/>
|
||||
<Intrinsic Name="memRegHome" Expression="(_signature >> 15) & 0x1"/>
|
||||
|
||||
<Intrinsic Name="memBaseId" Expression="_baseId"/>
|
||||
<Intrinsic Name="memIndexId" Expression="_data[0]"/>
|
||||
|
||||
<Intrinsic Name="memOffset32b" Expression="(__int64)int(_data[1])"/>
|
||||
<Intrinsic Name="memOffset64b" Expression="(__int64) ((unsigned __int64)_baseId << 32) | ((unsigned __int64)_data[1])"/>
|
||||
<Intrinsic Name="memOffset" Expression="memBaseType() != 0 ? memOffset32b() : memOffset64b()"/>
|
||||
|
||||
<Intrinsic Name="immValue" Expression="((__int64)_data[1] << 32) | (__int64)_data[0]"/>
|
||||
|
||||
<DisplayString Condition="opType() == 0">[None]</DisplayString>
|
||||
<DisplayString Condition="opType() == 1">[Reg] {{ id={_baseId, d} group={regGroup(), d} type={regType(), d} size={opSize(), d} }}</DisplayString>
|
||||
<DisplayString Condition="opType() == 2">[Mem] {{ baseId={memBaseId(), d} indexId={memIndexId(), d} offset={(__int64)memOffset(), d} }}</DisplayString>
|
||||
<DisplayString Condition="opType() == 3">[Imm] {{ val={immValue(), d} hex={immValue(), X} }}</DisplayString>
|
||||
<DisplayString Condition="opType() == 4">[Label] {{ id={_baseId} }}</DisplayString>
|
||||
<DisplayString Condition="opType() > 4">[Unknown]</DisplayString>
|
||||
<Expand HideRawView="true">
|
||||
<Item Name="_signature">_signature, X</Item>
|
||||
<Item Name="_signature.any.type">(asmjit::Operand_::OpType)opType()</Item>
|
||||
<Item Name="_signature.any.size">opSize(), d</Item>
|
||||
<Item Name="_signature.reg.type" Condition="opType() == 1">(asmjit::BaseReg::RegType)regType()</Item>
|
||||
<Item Name="_signature.reg.group" Condition="opType() == 1">(asmjit::BaseReg::RegGroup)regGroup()</Item>
|
||||
<Item Name="_signature.mem.baseType" Condition="opType() == 2">(asmjit::BaseReg::RegType)memBaseType()</Item>
|
||||
<Item Name="_signature.mem.indexType" Condition="opType() == 2">(asmjit::BaseReg::RegType)memIndexType()</Item>
|
||||
<Item Name="_signature.mem.addrType" Condition="opType() == 2">(asmjit::BaseMem::AddrType)memAddrType()</Item>
|
||||
<Item Name="_signature.mem.regHome" Condition="opType() == 2">(bool)memRegHome()</Item>
|
||||
<Item Name="_baseId">_baseId</Item>
|
||||
<Item Name="_data[0]" Condition="opType() != 2 && opType() != 3">_data[0]</Item>
|
||||
<Item Name="_data[1]" Condition="opType() != 2 && opType() != 3">_data[1]</Item>
|
||||
<Item Name="_data[IndexId]" Condition="opType() == 2">_data[0]</Item>
|
||||
<Item Name="_data[OffsetLo]" Condition="opType() == 2">_data[1]</Item>
|
||||
<Item Name="_data[ImmHi]" Condition="opType() == 3">_data[0]</Item>
|
||||
<Item Name="_data[ImmLo]" Condition="opType() == 3">_data[1]</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
||||
@@ -125,8 +125,10 @@ UNIT(operand) {
|
||||
EXPECT(m.offsetHi32() == xHi);
|
||||
|
||||
INFO("Checking basic functionality of Imm");
|
||||
Imm immValue(-42);
|
||||
EXPECT(Imm(-1).i64() == int64_t(-1));
|
||||
EXPECT(imm(-1).i64() == int64_t(-1));
|
||||
EXPECT(immValue.i64() == int64_t(-42));
|
||||
EXPECT(imm(0xFFFFFFFF).i64() == int64_t(0xFFFFFFFF));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -147,27 +147,6 @@ struct Operand_ {
|
||||
kDataImmValueHi = ASMJIT_ARCH_LE ? 1 : 0
|
||||
};
|
||||
|
||||
/*
|
||||
//! Memory operand data.
|
||||
struct MemData {
|
||||
//! Index register id.
|
||||
uint32_t indexId;
|
||||
//! Low part of 64-bit offset (or 32-bit offset).
|
||||
uint32_t offsetLo32;
|
||||
};
|
||||
|
||||
//! Additional data used by some operands.
|
||||
union {
|
||||
//! 32-bit data (used either by immediate or as a 32-bit view).
|
||||
uint32_t _data32[2];
|
||||
//! 64-bit data (used either by immediate or as a 64-bit view).
|
||||
uint64_t _data64;
|
||||
|
||||
//! Memory address data.
|
||||
MemData _mem;
|
||||
};
|
||||
*/
|
||||
|
||||
//! Operand types that can be encoded in `Operand`.
|
||||
enum OpType : uint32_t {
|
||||
//! Not an operand or not initialized.
|
||||
|
||||
Reference in New Issue
Block a user