File: DebuggerExecutionContextHook.h

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (96 lines) | stat: -rw-r--r-- 3,817 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//===- DebuggerExecutionContextHook.h - Debugger Support --------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains a set of C API functions that are used by the debugger to
// interact with the ExecutionContext.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_SUPPORT_DEBUGGEREXECUTIONCONTEXTHOOK_H
#define MLIR_SUPPORT_DEBUGGEREXECUTIONCONTEXTHOOK_H

#include "mlir-c/IR.h"
#include "mlir/Debug/ExecutionContext.h"
#include "llvm/Support/Compiler.h"

extern "C" {
struct MLIRBreakpoint;
struct MLIRIRunit;
typedef struct MLIRBreakpoint *BreakpointHandle;
typedef struct MLIRIRunit *irunitHandle;

/// This is used by the debugger to control what to do after a breakpoint is
/// hit. See tracing::ExecutionContext::Control for more information.
void mlirDebuggerSetControl(int controlOption);

/// Print the available context for the current Action.
void mlirDebuggerPrintContext();

/// Print the current action backtrace.
void mlirDebuggerPrintActionBacktrace(bool withContext);

//===----------------------------------------------------------------------===//
// Cursor Management: The cursor is used to select an IRUnit from the context
// and to navigate through the IRUnit hierarchy.
//===----------------------------------------------------------------------===//

/// Print the current IR unit cursor.
void mlirDebuggerCursorPrint(bool withRegion);

/// Select the IR unit from the current context by ID.
void mlirDebuggerCursorSelectIRUnitFromContext(int index);

/// Select the parent IR unit of the provided IR unit, or print an error if the
/// IR unit has no parent.
void mlirDebuggerCursorSelectParentIRUnit();

/// Select the child IR unit at the provided index, print an error if the index
/// is out of bound. For example if the irunit is an operation, the children IR
/// units will be the operation's regions.
void mlirDebuggerCursorSelectChildIRUnit(int index);

/// Return the next IR unit logically in the IR. For example if the irunit is a
/// Region the next IR unit will be the next region in the parent operation or
/// nullptr if there is no next region.
void mlirDebuggerCursorSelectPreviousIRUnit();

/// Return the previous IR unit logically in the IR. For example if the irunit
/// is a Region, the previous IR unit will be the previous region in the parent
/// operation or nullptr if there is no previous region.
void mlirDebuggerCursorSelectNextIRUnit();

//===----------------------------------------------------------------------===//
// Breakpoint Management
//===----------------------------------------------------------------------===//

/// Enable the provided breakpoint.
void mlirDebuggerEnableBreakpoint(BreakpointHandle breakpoint);

/// Disable the provided breakpoint.
void mlirDebuggerDisableBreakpoint(BreakpointHandle breakpoint);

/// Add a breakpoint matching exactly the provided tag.
BreakpointHandle mlirDebuggerAddTagBreakpoint(const char *tag);

/// Add a breakpoint matching a pattern by name.
void mlirDebuggerAddRewritePatternBreakpoint(const char *patternNameInfo);

/// Add a breakpoint matching a file, line and column.
void mlirDebuggerAddFileLineColLocBreakpoint(const char *file, int line,
                                             int col);

} // extern "C"

namespace mlir {
// Setup the debugger hooks as a callback on the provided ExecutionContext.
void setupDebuggerExecutionContextHook(
    tracing::ExecutionContext &executionContext);

} // namespace mlir

#endif // MLIR_SUPPORT_DEBUGGEREXECUTIONCONTEXTHOOK_H