ホーム › System.Diagnostics.Debug › EXCEPTION_DEBUG_INFO
EXCEPTION_DEBUG_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ExceptionRecord | EXCEPTION_RECORD | 152/80 | +0 | +0 | 例外に固有の情報を格納した EXCEPTION_RECORD 構造体です。これには、例外コード、フラグ、アドレス、関連する例外へのポインター、追加のパラメーターなどが含まれます。 |
| dwFirstChance | DWORD | 4 | +152 | +80 | ExceptionRecord メンバーで指定された例外に、デバッガーが以前に遭遇したことがあるかどうかを示す値です。dwFirstChance メンバーが 0 以外の場合、デバッガーがこの例外に遭遇したのは初めてです。デバッガーは通常、ブレークポイント例外やシングルステップ例外を最初に遭遇した時点で処理します。このメンバーが 0 の場合、デバッガーは以前にもこの例外に遭遇しています。これは、構造化例外ハンドラーの検索中にハンドラーが見つからなかった場合、または例外が継続された場合にのみ発生します。 |
公式ドキュメント
デバッガーが使用できる例外情報を格納します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// EXCEPTION_RECORD (x64 152 / x86 80 バイト)
typedef struct EXCEPTION_RECORD {
NTSTATUS ExceptionCode;
DWORD ExceptionFlags;
EXCEPTION_RECORD* ExceptionRecord;
void* ExceptionAddress;
DWORD NumberParameters;
UINT_PTR ExceptionInformation[15];
} EXCEPTION_RECORD;
// EXCEPTION_DEBUG_INFO (x64 160 / x86 84 バイト)
typedef struct EXCEPTION_DEBUG_INFO {
EXCEPTION_RECORD ExceptionRecord;
DWORD dwFirstChance;
} EXCEPTION_DEBUG_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXCEPTION_RECORD
{
public int ExceptionCode;
public uint ExceptionFlags;
public IntPtr ExceptionRecord;
public IntPtr ExceptionAddress;
public uint NumberParameters;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public UIntPtr[] ExceptionInformation;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXCEPTION_DEBUG_INFO
{
public EXCEPTION_RECORD ExceptionRecord;
public uint dwFirstChance;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXCEPTION_RECORD
Public ExceptionCode As Integer
Public ExceptionFlags As UInteger
Public ExceptionRecord As IntPtr
Public ExceptionAddress As IntPtr
Public NumberParameters As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=15)> Public ExceptionInformation() As UIntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXCEPTION_DEBUG_INFO
Public ExceptionRecord As EXCEPTION_RECORD
Public dwFirstChance As UInteger
End Structureimport ctypes
from ctypes import wintypes
class EXCEPTION_RECORD(ctypes.Structure):
_fields_ = [
("ExceptionCode", ctypes.c_int),
("ExceptionFlags", wintypes.DWORD),
("ExceptionRecord", ctypes.c_void_p),
("ExceptionAddress", ctypes.c_void_p),
("NumberParameters", wintypes.DWORD),
("ExceptionInformation", ctypes.c_size_t * 15),
]
class EXCEPTION_DEBUG_INFO(ctypes.Structure):
_fields_ = [
("ExceptionRecord", EXCEPTION_RECORD),
("dwFirstChance", wintypes.DWORD),
]#[repr(C)]
pub struct EXCEPTION_RECORD {
pub ExceptionCode: i32,
pub ExceptionFlags: u32,
pub ExceptionRecord: *mut core::ffi::c_void,
pub ExceptionAddress: *mut core::ffi::c_void,
pub NumberParameters: u32,
pub ExceptionInformation: [usize; 15],
}
#[repr(C)]
pub struct EXCEPTION_DEBUG_INFO {
pub ExceptionRecord: EXCEPTION_RECORD,
pub dwFirstChance: u32,
}import "golang.org/x/sys/windows"
type EXCEPTION_RECORD struct {
ExceptionCode int32
ExceptionFlags uint32
ExceptionRecord uintptr
ExceptionAddress uintptr
NumberParameters uint32
ExceptionInformation [15]uintptr
}
type EXCEPTION_DEBUG_INFO struct {
ExceptionRecord EXCEPTION_RECORD
dwFirstChance uint32
}type
EXCEPTION_RECORD = record
ExceptionCode: Integer;
ExceptionFlags: DWORD;
ExceptionRecord: Pointer;
ExceptionAddress: Pointer;
NumberParameters: DWORD;
ExceptionInformation: array[0..14] of NativeUInt;
end;
EXCEPTION_DEBUG_INFO = record
ExceptionRecord: EXCEPTION_RECORD;
dwFirstChance: DWORD;
end;const EXCEPTION_RECORD = extern struct {
ExceptionCode: i32,
ExceptionFlags: u32,
ExceptionRecord: ?*anyopaque,
ExceptionAddress: ?*anyopaque,
NumberParameters: u32,
ExceptionInformation: [15]usize,
};
const EXCEPTION_DEBUG_INFO = extern struct {
ExceptionRecord: EXCEPTION_RECORD,
dwFirstChance: u32,
};type
EXCEPTION_RECORD {.bycopy.} = object
ExceptionCode: int32
ExceptionFlags: uint32
ExceptionRecord: pointer
ExceptionAddress: pointer
NumberParameters: uint32
ExceptionInformation: array[15, uint]
EXCEPTION_DEBUG_INFO {.bycopy.} = object
ExceptionRecord: EXCEPTION_RECORD
dwFirstChance: uint32struct EXCEPTION_RECORD
{
int ExceptionCode;
uint ExceptionFlags;
void* ExceptionRecord;
void* ExceptionAddress;
uint NumberParameters;
size_t[15] ExceptionInformation;
}
struct EXCEPTION_DEBUG_INFO
{
EXCEPTION_RECORD ExceptionRecord;
uint dwFirstChance;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; EXCEPTION_DEBUG_INFO サイズ: 84 バイト(x86)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; ExceptionRecord : EXCEPTION_RECORD (+0, 80byte) varptr(st)+0 を基点に操作(80byte:入れ子/配列)
; dwFirstChance : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EXCEPTION_DEBUG_INFO サイズ: 160 バイト(x64)
dim st, 40 ; 4byte整数×40(構造体サイズ 160 / 4 切り上げ)
; ExceptionRecord : EXCEPTION_RECORD (+0, 152byte) varptr(st)+0 を基点に操作(152byte:入れ子/配列)
; dwFirstChance : DWORD (+152, 4byte) st.38 = 値 / 値 = st.38 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global EXCEPTION_RECORD
#field int ExceptionCode
#field int ExceptionFlags
#field intptr ExceptionRecord
#field intptr ExceptionAddress
#field int NumberParameters
#field intptr ExceptionInformation 15
#endstruct
#defstruct global EXCEPTION_DEBUG_INFO
#field EXCEPTION_RECORD ExceptionRecord
#field int dwFirstChance
#endstruct
stdim st, EXCEPTION_DEBUG_INFO ; NSTRUCT 変数を確保
st->dwFirstChance = 100
mes "dwFirstChance=" + st->dwFirstChance