diff --git a/uppsrc/ide/Debuggers/Debuggers.h b/uppsrc/ide/Debuggers/Debuggers.h index 33f605876..0dcf4e6d7 100644 --- a/uppsrc/ide/Debuggers/Debuggers.h +++ b/uppsrc/ide/Debuggers/Debuggers.h @@ -227,6 +227,9 @@ public: private: bool CreateDbg(One& host, const String& exeFile, bool console); + +private: + const int max_stack_trace_size; }; #include "Gdb_MI2.h" diff --git a/uppsrc/ide/Debuggers/Gdb.cpp b/uppsrc/ide/Debuggers/Gdb.cpp index d032f5e13..f8d00c6fe 100644 --- a/uppsrc/ide/Debuggers/Gdb.cpp +++ b/uppsrc/ide/Debuggers/Gdb.cpp @@ -387,8 +387,6 @@ void Gdb::DisasFocus() void Gdb::DropFrames() { - const int max_stack_trace_size = 200; - int i = 0; int q = ~frame; frame.Clear(); @@ -419,7 +417,11 @@ String Gdb::ObtainFrame(int frame_idx) void Gdb::SwitchFrame() { - int i = (int)~frame; + auto i = static_cast(~frame); + if (i == max_stack_trace_size) { + i = 0; + } + Cmdp(Sprintf("frame %d", i), i); } @@ -510,6 +512,7 @@ void Gdb::Periodic() } Gdb::Gdb() + : max_stack_trace_size(200) { locals.NoHeader(); locals.AddColumn("", 1);