Skip to content

Commit ec9f3d3

Browse files
committed
feat: 更好的调试监视功能;
1 parent 9684132 commit ec9f3d3

28 files changed

Lines changed: 1553 additions & 987 deletions

3rdparty/WingCodeEdit

3rdparty/as-debugger/as_debugger.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,11 @@ asIDBCache::ResolveExpression(std::string_view expr,
302302
asIDBExpected<asIDBVariable::WeakPtr> variable;
303303
asIDBCallStackEntry *stack = nullptr;
304304

305-
if (stack_index.has_value())
306-
stack = &call_stack[stack_index.value()];
305+
if (stack_index.has_value()) {
306+
if (call_stack.size() > stack_index.value()) {
307+
stack = &call_stack[stack_index.value()];
308+
}
309+
}
307310

308311
// if it starts with a & it has to be a local variable index
309312
if (stack && variable_name[0] == '&') {
@@ -1144,10 +1147,6 @@ void asIDBFileWorkspace::CompileBreakpointPositions() {
11441147
int col;
11451148
int row = ctx->GetLineNumber(0, &col, &section);
11461149

1147-
if (section && debugger->onLineCallBackExec) {
1148-
debugger->onLineCallBackExec(row, col, section);
1149-
}
1150-
11511150
// we might not have an action - functions called from within
11521151
// the debugger will never have this set.
11531152
if (debugger->action != asIDBAction::None) {
@@ -1157,6 +1156,7 @@ void asIDBFileWorkspace::CompileBreakpointPositions() {
11571156
debugger->DebugBreak(ctx);
11581157
return;
11591158
}
1159+
11601160
// Step Over breaks on the next line that is <= the
11611161
// current stack level.
11621162
else if (debugger->action == asIDBAction::StepOver) {
@@ -1285,8 +1285,12 @@ void asIDBDebugger::DebugBreak(asIScriptContext *ctx) {
12851285
std::swap(cache, new_cache);
12861286
}
12871287

1288-
if (onDebugBreak) {
1289-
onDebugBreak();
1288+
const char *section = nullptr;
1289+
int col;
1290+
int row = ctx->GetLineNumber(0, &col, &section);
1291+
1292+
if (onLineCallBackExec) {
1293+
onLineCallBackExec(row, col, section);
12901294
}
12911295

12921296
// rehook

3rdparty/as-debugger/as_debugger.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ struct asIDBScope {
200200
struct asIDBCallStackEntry {
201201
int64_t id; // unique id during debugging
202202
std::string declaration;
203-
std::string_view section;
203+
std::string section;
204204
int row, column;
205205
asIDBScope scope;
206206
};
@@ -537,7 +537,6 @@ using asIDBBreakpointMap =
537537

538538
std::function<bool(asIScriptContext *)> onLineCallBack;
539539
std::function<void(int, int, const char *)> onLineCallBackExec;
540-
std::function<void()> onDebugBreak;
541540
std::function<void(int, int, const char *)> onAdjustBreakPoint;
542541

543542
asIDBDebugger(asIDBWorkspace *workspace) : workspace(workspace) {}

3rdparty/as-debugger/as_helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct asIDBExpected {
1818
std::variant<std::string_view, T> data;
1919

2020
public:
21-
constexpr asIDBExpected() : data("unknown error") {}
21+
constexpr asIDBExpected() : data("") {}
2222

2323
constexpr asIDBExpected(const std::string_view v)
2424
: data(std::in_place_index<0>, v) {}

images/watch.png

10.1 KB
Loading

lang/zh_CN/winghex_zh_CN.ts

Lines changed: 337 additions & 296 deletions
Large diffs are not rendered by default.

lang/zh_TW/winghex_zh_TW.ts

Lines changed: 337 additions & 296 deletions
Large diffs are not rendered by default.

resources.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
<file>images/unsaved.png</file>
112112
<file>images/update.png</file>
113113
<file>images/viewtxt.png</file>
114+
<file>images/watch.png</file>
114115
<file>images/wiki.png</file>
115116
<file>images/win.png</file>
116117
<file>images/workspace.png</file>

src/class/asdebugger.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,10 @@ asDebugger::asDebugger(asIDBWorkspace *workspace)
7676
this->onLineCallBackExec = [this](int row, int col,
7777
const char *section) -> void {
7878
Q_EMIT onRunCurrentLine(QString::fromUtf8(section), row);
79-
Q_EMIT onDebugActionExec();
80-
};
81-
82-
this->onDebugBreak = [this]() {
8379
Q_EMIT onPullCallStack();
8480
Q_EMIT onPullVariables();
8581
Q_EMIT onDebugActionExec();
82+
Q_EMIT onDebugActionExec();
8683
};
8784

8885
this->onAdjustBreakPoint = [this](int old, int line, const char *section) {

0 commit comments

Comments
 (0)