[Lldb-commits] [PATCH] D120101: [lldb] Fix (unintentional) recursion in CommandObjectRegexCommand
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 17 23:15:19 PST 2022
clayborg added inline comments.
================
Comment at: lldb/source/Commands/CommandObjectRegexCommand.cpp:13
+#include <cmath>
+
----------------
I cringe every time I see an old C header being imported as C++ because of the huge amounts of junk it causes the DWARF to incur with many import declarations inside the std namespace for any types that are defined... If we import <math.h> we don't end up with all that. We don't have to change it, but as you are aware dsymutil keeps every type that is defined in these header files because of this extra fluff in the DWARF.
================
Comment at: lldb/source/Commands/CommandObjectRegexCommand.cpp:40
+ // until it encounters the first character that isn't a number.
+ const size_t idx = std::atoi(str.c_str() + pos + 1);
+
----------------
We don't want negative numbers to succeed here. Might be better to use strtoul()
================
Comment at: lldb/source/Commands/CommandObjectRegexCommand.cpp:50
+ // The length of the patter is 1 (for the %) plus the length of the index.
+ const size_t pattern_size = 1 + static_cast<size_t>(log10(idx) + 1);
+
----------------
Update to use strtoul "end" parameter
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120101/new/
https://reviews.llvm.org/D120101
More information about the lldb-commits
mailing list