Enable not just changing the handler function at run-time, but also
enable changing how it's invoked at compile time.
Document that, and update some other Debug Mode documentation as well.
Differential D89353
Enable overriding `__libcpp_debug_function` invocation ldionne on Oct 13 2020, 5:02 PM. Authored by
Details
Diff Detail
Unit Tests Event TimelineComment Actions This is following up on the discussion at https://reviews.llvm.org/D70343. Does this overall direction make sense to you? I have hacked it into Chromium and it seems to work. Comment Actions Assuming this still merges, I don't have any issue with it. There has been some work done by others on the debug mode. We don't need to wait for their approval, but please be receptive if they have comments.
Comment Actions For some reason this went entirely under my radar. I think we should have a broader discussion about what to do with the debug mode (top of thread: https://lists.llvm.org/pipermail/libcxx-dev/2021-June/001168.html) before we make this change. If I understand correctly, the main problem being solved by this patch is that Chromium does not want to have those __FILE__ string constants stored in the compiled binaries (because it doesn't use that information anyway)? Comment Actions
It's not just the string constants, it's that we want everything about the code to be as small as possible: "But, we are very sensitive to object code size, and the standard implementation has those print statements (which can get big). This macro allows us to use the smallest possible crash code (e.g. a ud2 on Intel, or the like), and thus have the least impact on our overall object code size." Comment Actions As I understand it, the plan is to actually ship with these checks enabled. This expands the scope of these debug mode checks from a testing tool to a security hardening tool. That's why the binary size matters: it will ship to users. It starts from the simple idea that std::vector<>::operator[] could have bounds checks, and one way to get there is to enable debug checks and add this override mechanism. Comment Actions FWIW I support something along the lines of what Palmer is trying to do: many users of the STL would like to be able to handle particular types of library UB instead of performing potentially unbounded effects. Which ones is a bit of an art that we need to figure out, for example I wouldn't want to unduly affect performance (by e.g. changing algorithmic complexity) or code size (here, with diagnostic bloat). In a way we're experimenting on the edges of what contract checking would be for the STL, and I would approach it with this optic: could we have a mode of the STL which enforces contracts, and a mode where you get whatever. If so, what should be checked and what should remain unchecked, and what are the principles to distinguish these. I think in this discussion it's important to separate the invariants that are details of libc++'s implementation, from what are actual contracts at the STL API level. Comment Actions [Github PR Transition cleanup] The Debug mode doesn't exist anymore, but this was done in D141326. I will close this to clean up the queue (which requires commandeering and abandoning, sorry if that seems rude but it's how Phabricator works). Comment Actions +1, this use case has long been addressed by the assertion mode, and then the new safe and hardened modes. |
In what sense does std::locale support iterators?