On Mon, 16 Aug 2021 at 13:11, Jonathan Wakely wrote: > > > > On Mon, 16 Aug 2021, 12:55 Jonathan Wakely, wrote: >> >> I'm adding a GDB printer for std::error_code.What I have now prints >> the category name as a quoted string, followed by the error value: >> >> {"system": 0} >> {"system": 1234} >> >> If the category is std::generic_category() then it also shows the >> strerror description: > > > I should probably extend this special case for the generic category to also apply to the system category when the OS is POSIX-based. For POSIX systems, the system error numbers are generic errno values. > > >> >> {"generic": 13 "Permission denied"} >> >> But I'd also like it to show the errno macro, but I'm not sure what's >> the best way to show it. >> >> Does this seem OK? >> >> {"generic": 13 EACCES "Permission denied"} >> >> I think that's a bit too verbose. >> >> Would {"generic": EACCES} be better? You can always use ec.value() to >> get the numeric value, and strerror to get the description if you want >> those. Here's what I plan to commit. It just uses {"generic": EACCES} for known categories that use errno values, and {"foo": 99} for other error categories. It also supports std::error_condition (using the same printer and the same output formats).