ホーム › System.Diagnostics.Debug.Extensions › STACK_SYM_FRAME_INFO
STACK_SYM_FRAME_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| StackFrameEx | DEBUG_STACK_FRAME_EX | 136 | +0 | +0 | 拡張スタックフレーム情報(DEBUG_STACK_FRAME_EX)。 |
| SrcInfo | STACK_SRC_INFO | 40/24 | +136 | +136 | 対応するソース位置情報(STACK_SRC_INFO)。 |
各言語での定義
#include <windows.h>
// DEBUG_STACK_FRAME_EX (x64 136 / x86 136 バイト)
typedef struct DEBUG_STACK_FRAME_EX {
ULONGLONG InstructionOffset;
ULONGLONG ReturnOffset;
ULONGLONG FrameOffset;
ULONGLONG StackOffset;
ULONGLONG FuncTableEntry;
ULONGLONG Params[4];
ULONGLONG Reserved[6];
BOOL Virtual;
DWORD FrameNumber;
DWORD InlineFrameContext;
DWORD Reserved1;
} DEBUG_STACK_FRAME_EX;
// STACK_SRC_INFO (x64 40 / x86 24 バイト)
typedef struct STACK_SRC_INFO {
LPWSTR ImagePath;
LPWSTR ModuleName;
LPWSTR Function;
DWORD Displacement;
DWORD Row;
DWORD Column;
} STACK_SRC_INFO;
// STACK_SYM_FRAME_INFO (x64 176 / x86 160 バイト)
typedef struct STACK_SYM_FRAME_INFO {
DEBUG_STACK_FRAME_EX StackFrameEx;
STACK_SRC_INFO SrcInfo;
} STACK_SYM_FRAME_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEBUG_STACK_FRAME_EX
{
public ulong InstructionOffset;
public ulong ReturnOffset;
public ulong FrameOffset;
public ulong StackOffset;
public ulong FuncTableEntry;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public ulong[] Params;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public ulong[] Reserved;
[MarshalAs(UnmanagedType.Bool)] public bool Virtual;
public uint FrameNumber;
public uint InlineFrameContext;
public uint Reserved1;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STACK_SRC_INFO
{
public IntPtr ImagePath;
public IntPtr ModuleName;
public IntPtr Function;
public uint Displacement;
public uint Row;
public uint Column;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STACK_SYM_FRAME_INFO
{
public DEBUG_STACK_FRAME_EX StackFrameEx;
public STACK_SRC_INFO SrcInfo;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEBUG_STACK_FRAME_EX
Public InstructionOffset As ULong
Public ReturnOffset As ULong
Public FrameOffset As ULong
Public StackOffset As ULong
Public FuncTableEntry As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Params() As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public Reserved() As ULong
<MarshalAs(UnmanagedType.Bool)> Public Virtual As Boolean
Public FrameNumber As UInteger
Public InlineFrameContext As UInteger
Public Reserved1 As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STACK_SRC_INFO
Public ImagePath As IntPtr
Public ModuleName As IntPtr
Public Function As IntPtr
Public Displacement As UInteger
Public Row As UInteger
Public Column As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STACK_SYM_FRAME_INFO
Public StackFrameEx As DEBUG_STACK_FRAME_EX
Public SrcInfo As STACK_SRC_INFO
End Structureimport ctypes
from ctypes import wintypes
class DEBUG_STACK_FRAME_EX(ctypes.Structure):
_fields_ = [
("InstructionOffset", ctypes.c_ulonglong),
("ReturnOffset", ctypes.c_ulonglong),
("FrameOffset", ctypes.c_ulonglong),
("StackOffset", ctypes.c_ulonglong),
("FuncTableEntry", ctypes.c_ulonglong),
("Params", ctypes.c_ulonglong * 4),
("Reserved", ctypes.c_ulonglong * 6),
("Virtual", wintypes.BOOL),
("FrameNumber", wintypes.DWORD),
("InlineFrameContext", wintypes.DWORD),
("Reserved1", wintypes.DWORD),
]
class STACK_SRC_INFO(ctypes.Structure):
_fields_ = [
("ImagePath", ctypes.c_void_p),
("ModuleName", ctypes.c_void_p),
("Function", ctypes.c_void_p),
("Displacement", wintypes.DWORD),
("Row", wintypes.DWORD),
("Column", wintypes.DWORD),
]
class STACK_SYM_FRAME_INFO(ctypes.Structure):
_fields_ = [
("StackFrameEx", DEBUG_STACK_FRAME_EX),
("SrcInfo", STACK_SRC_INFO),
]#[repr(C)]
pub struct DEBUG_STACK_FRAME_EX {
pub InstructionOffset: u64,
pub ReturnOffset: u64,
pub FrameOffset: u64,
pub StackOffset: u64,
pub FuncTableEntry: u64,
pub Params: [u64; 4],
pub Reserved: [u64; 6],
pub Virtual: i32,
pub FrameNumber: u32,
pub InlineFrameContext: u32,
pub Reserved1: u32,
}
#[repr(C)]
pub struct STACK_SRC_INFO {
pub ImagePath: *mut core::ffi::c_void,
pub ModuleName: *mut core::ffi::c_void,
pub Function: *mut core::ffi::c_void,
pub Displacement: u32,
pub Row: u32,
pub Column: u32,
}
#[repr(C)]
pub struct STACK_SYM_FRAME_INFO {
pub StackFrameEx: DEBUG_STACK_FRAME_EX,
pub SrcInfo: STACK_SRC_INFO,
}import "golang.org/x/sys/windows"
type DEBUG_STACK_FRAME_EX struct {
InstructionOffset uint64
ReturnOffset uint64
FrameOffset uint64
StackOffset uint64
FuncTableEntry uint64
Params [4]uint64
Reserved [6]uint64
Virtual int32
FrameNumber uint32
InlineFrameContext uint32
Reserved1 uint32
}
type STACK_SRC_INFO struct {
ImagePath uintptr
ModuleName uintptr
Function uintptr
Displacement uint32
Row uint32
Column uint32
}
type STACK_SYM_FRAME_INFO struct {
StackFrameEx DEBUG_STACK_FRAME_EX
SrcInfo STACK_SRC_INFO
}type
DEBUG_STACK_FRAME_EX = record
InstructionOffset: UInt64;
ReturnOffset: UInt64;
FrameOffset: UInt64;
StackOffset: UInt64;
FuncTableEntry: UInt64;
Params: array[0..3] of UInt64;
Reserved: array[0..5] of UInt64;
Virtual: BOOL;
FrameNumber: DWORD;
InlineFrameContext: DWORD;
Reserved1: DWORD;
end;
STACK_SRC_INFO = record
ImagePath: Pointer;
ModuleName: Pointer;
Function: Pointer;
Displacement: DWORD;
Row: DWORD;
Column: DWORD;
end;
STACK_SYM_FRAME_INFO = record
StackFrameEx: DEBUG_STACK_FRAME_EX;
SrcInfo: STACK_SRC_INFO;
end;const DEBUG_STACK_FRAME_EX = extern struct {
InstructionOffset: u64,
ReturnOffset: u64,
FrameOffset: u64,
StackOffset: u64,
FuncTableEntry: u64,
Params: [4]u64,
Reserved: [6]u64,
Virtual: i32,
FrameNumber: u32,
InlineFrameContext: u32,
Reserved1: u32,
};
const STACK_SRC_INFO = extern struct {
ImagePath: ?*anyopaque,
ModuleName: ?*anyopaque,
Function: ?*anyopaque,
Displacement: u32,
Row: u32,
Column: u32,
};
const STACK_SYM_FRAME_INFO = extern struct {
StackFrameEx: DEBUG_STACK_FRAME_EX,
SrcInfo: STACK_SRC_INFO,
};type
DEBUG_STACK_FRAME_EX {.bycopy.} = object
InstructionOffset: uint64
ReturnOffset: uint64
FrameOffset: uint64
StackOffset: uint64
FuncTableEntry: uint64
Params: array[4, uint64]
Reserved: array[6, uint64]
Virtual: int32
FrameNumber: uint32
InlineFrameContext: uint32
Reserved1: uint32
STACK_SRC_INFO {.bycopy.} = object
ImagePath: pointer
ModuleName: pointer
Function: pointer
Displacement: uint32
Row: uint32
Column: uint32
STACK_SYM_FRAME_INFO {.bycopy.} = object
StackFrameEx: DEBUG_STACK_FRAME_EX
SrcInfo: STACK_SRC_INFOstruct DEBUG_STACK_FRAME_EX
{
ulong InstructionOffset;
ulong ReturnOffset;
ulong FrameOffset;
ulong StackOffset;
ulong FuncTableEntry;
ulong[4] Params;
ulong[6] Reserved;
int Virtual;
uint FrameNumber;
uint InlineFrameContext;
uint Reserved1;
}
struct STACK_SRC_INFO
{
void* ImagePath;
void* ModuleName;
void* Function;
uint Displacement;
uint Row;
uint Column;
}
struct STACK_SYM_FRAME_INFO
{
DEBUG_STACK_FRAME_EX StackFrameEx;
STACK_SRC_INFO SrcInfo;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STACK_SYM_FRAME_INFO サイズ: 160 バイト(x86)
dim st, 40 ; 4byte整数×40(構造体サイズ 160 / 4 切り上げ)
; StackFrameEx : DEBUG_STACK_FRAME_EX (+0, 136byte) varptr(st)+0 を基点に操作(136byte:入れ子/配列)
; SrcInfo : STACK_SRC_INFO (+136, 24byte) varptr(st)+136 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STACK_SYM_FRAME_INFO サイズ: 176 バイト(x64)
dim st, 44 ; 4byte整数×44(構造体サイズ 176 / 4 切り上げ)
; StackFrameEx : DEBUG_STACK_FRAME_EX (+0, 136byte) varptr(st)+0 を基点に操作(136byte:入れ子/配列)
; SrcInfo : STACK_SRC_INFO (+136, 40byte) varptr(st)+136 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DEBUG_STACK_FRAME_EX
#field int64 InstructionOffset
#field int64 ReturnOffset
#field int64 FrameOffset
#field int64 StackOffset
#field int64 FuncTableEntry
#field int64 Params 4
#field int64 Reserved 6
#field bool Virtual
#field int FrameNumber
#field int InlineFrameContext
#field int Reserved1
#endstruct
#defstruct global STACK_SRC_INFO
#field intptr ImagePath
#field intptr ModuleName
#field intptr Function
#field int Displacement
#field int Row
#field int Column
#endstruct
#defstruct global STACK_SYM_FRAME_INFO
#field DEBUG_STACK_FRAME_EX StackFrameEx
#field STACK_SRC_INFO SrcInfo
#endstruct
stdim st, STACK_SYM_FRAME_INFO ; NSTRUCT 変数を確保