File indexing completed on 2025-09-17 08:40:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef BOOST_OUTCOME_INLINE_GDB_PRETTY_PRINTER_H
0027 #define BOOST_OUTCOME_INLINE_GDB_PRETTY_PRINTER_H
0028
0029 #ifndef BOOST_OUTCOME_DISABLE_INLINE_GDB_PRETTY_PRINTERS
0030 #if defined(__ELF__)
0031 #ifdef __clang__
0032 #pragma clang diagnostic push
0033 #pragma clang diagnostic ignored "-Woverlength-strings"
0034 #endif
0035 __asm__(".pushsection \".debug_gdb_scripts\", \"MS\",%progbits,1\n"
0036 ".ascii \"\\4gdb.inlined-script.BOOST_OUTCOME_INLINE_GDB_PRETTY_PRINTER_H\\n\"\n"
0037 ".ascii \"import gdb.printing\\n\"\n"
0038 ".ascii \"import os\\n\"\n"
0039
0040 ".ascii \"def synthesise_gdb_value_from_string(s):\\n\"\n"
0041 ".ascii \" '''For when you want to return a synthetic string from children()'''\\n\"\n"
0042 ".ascii \" return gdb.Value(s + '\\\\0').cast(gdb.lookup_type('char').pointer())\\n\"\n"
0043
0044 ".ascii \"class OutcomeBasicOutcomePrinter(object):\\n\"\n"
0045 ".ascii \" '''Print an outcome::basic_outcome<T> and outcome::basic_result<T>'''\\n\"\n"
0046
0047 ".ascii \" def __init__(self, val):\\n\"\n"
0048 ".ascii \" self.val = val\\n\"\n"
0049
0050 ".ascii \" def children(self):\\n\"\n"
0051 ".ascii \" if self.val['_state']['_status']['status_value'] & 1 == 1:\\n\"\n"
0052 ".ascii \" yield ('value', self.val['_state']['_value'])\\n\"\n"
0053 ".ascii \" if self.val['_state']['_status']['status_value'] & 2 == 2:\\n\"\n"
0054 ".ascii \" yield ('error', self.val['_state']['_error'])\\n\"\n"
0055 ".ascii \" if self.val['_state']['_status']['status_value'] & 4 == 4:\\n\"\n"
0056 ".ascii \" yield ('exception', self.val['_ptr'])\\n\"\n"
0057
0058 ".ascii \" def display_hint(self):\\n\"\n"
0059 ".ascii \" return None\\n\"\n"
0060
0061 ".ascii \" def to_string(self):\\n\"\n"
0062 ".ascii \" if self.val['_state']['_status']['status_value'] & 54 == 54:\\n\"\n"
0063 ".ascii \" return 'errored (errno, moved from) + exceptioned'\\n\"\n"
0064 ".ascii \" if self.val['_state']['_status']['status_value'] & 50 == 50:\\n\"\n"
0065 ".ascii \" return 'errored (errno, moved from)'\\n\"\n"
0066 ".ascii \" if self.val['_state']['_status']['status_value'] & 38 == 38:\\n\"\n"
0067 ".ascii \" return 'errored + exceptioned (moved from)'\\n\"\n"
0068 ".ascii \" if self.val['_state']['_status']['status_value'] & 36 == 36:\\n\"\n"
0069 ".ascii \" return 'exceptioned (moved from)'\\n\"\n"
0070 ".ascii \" if self.val['_state']['_status']['status_value'] & 35 == 35:\\n\"\n"
0071 ".ascii \" return 'errored (moved from)'\\n\"\n"
0072 ".ascii \" if self.val['_state']['_status']['status_value'] & 33 == 33:\\n\"\n"
0073 ".ascii \" return 'valued (moved from)'\\n\"\n"
0074 ".ascii \" if self.val['_state']['_status']['status_value'] & 22 == 22:\\n\"\n"
0075 ".ascii \" return 'errored (errno) + exceptioned'\\n\"\n"
0076 ".ascii \" if self.val['_state']['_status']['status_value'] & 18 == 18:\\n\"\n"
0077 ".ascii \" return 'errored (errno)'\\n\"\n"
0078 ".ascii \" if self.val['_state']['_status']['status_value'] & 6 == 6:\\n\"\n"
0079 ".ascii \" return 'errored + exceptioned'\\n\"\n"
0080 ".ascii \" if self.val['_state']['_status']['status_value'] & 4 == 4:\\n\"\n"
0081 ".ascii \" return 'exceptioned'\\n\"\n"
0082 ".ascii \" if self.val['_state']['_status']['status_value'] & 2 == 2:\\n\"\n"
0083 ".ascii \" return 'errored'\\n\"\n"
0084 ".ascii \" if self.val['_state']['_status']['status_value'] & 1 == 1:\\n\"\n"
0085 ".ascii \" return 'valued'\\n\"\n"
0086 ".ascii \" if self.val['_state']['_status']['status_value'] & 0xff == 0:\\n\"\n"
0087 ".ascii \" return 'empty'\\n\"\n"
0088
0089 ".ascii \"class OutcomeCResultStatusPrinter(object):\\n\"\n"
0090 ".ascii \" '''Print a C result'''\\n\"\n"
0091
0092 ".ascii \" def __init__(self, val):\\n\"\n"
0093 ".ascii \" self.val = val\\n\"\n"
0094
0095 ".ascii \" def children(self):\\n\"\n"
0096 ".ascii \" if self.val['flags'] & 1 == 1:\\n\"\n"
0097 ".ascii \" yield ('value', self.val['value'])\\n\"\n"
0098 ".ascii \" if self.val['flags'] & 2 == 2:\\n\"\n"
0099 ".ascii \" yield ('error', self.val['error'])\\n\"\n"
0100
0101 ".ascii \" def display_hint(self):\\n\"\n"
0102 ".ascii \" return None\\n\"\n"
0103
0104 ".ascii \" def to_string(self):\\n\"\n"
0105 ".ascii \" if self.val['flags'] & 50 == 50:\\n\"\n"
0106 ".ascii \" return 'errored (errno, moved from)'\\n\"\n"
0107 ".ascii \" if self.val['flags'] & 35 == 35:\\n\"\n"
0108 ".ascii \" return 'errored (moved from)'\\n\"\n"
0109 ".ascii \" if self.val['flags'] & 33 == 33:\\n\"\n"
0110 ".ascii \" return 'valued (moved from)'\\n\"\n"
0111 ".ascii \" if self.val['flags'] & 18 == 18:\\n\"\n"
0112 ".ascii \" return 'errored (errno)'\\n\"\n"
0113 ".ascii \" if self.val['flags'] & 2 == 2:\\n\"\n"
0114 ".ascii \" return 'errored'\\n\"\n"
0115 ".ascii \" if self.val['flags'] & 1 == 1:\\n\"\n"
0116 ".ascii \" return 'valued'\\n\"\n"
0117 ".ascii \" if self.val['flags'] & 0xff == 0:\\n\"\n"
0118 ".ascii \" return 'empty'\\n\"\n"
0119
0120
0121 ".ascii \"class OutcomeCStatusCodePrinter(object):\\n\"\n"
0122 ".ascii \" '''Print a C status code'''\\n\"\n"
0123
0124 ".ascii \" def __init__(self, val):\\n\"\n"
0125 ".ascii \" self.val = val\\n\"\n"
0126
0127 ".ascii \" def children(self):\\n\"\n"
0128 ".ascii \" yield ('domain', self.val['domain'])\\n\"\n"
0129 ".ascii \" yield ('value', self.val['value'])\\n\"\n"
0130
0131 ".ascii \" def display_hint(self):\\n\"\n"
0132 ".ascii \" return None\\n\"\n"
0133
0134 ".ascii \" def to_string(self):\\n\"\n"
0135 ".ascii \" s = str(self.val['domain'])\\n\"\n"
0136 ".ascii \" if 'posix_code_domain' in s or 'generic_code_domain' in s:\\n\"\n"
0137 ".ascii \" return str(self.val['value']) + ' (' + os.strerror(int(self.val['value'])) + ')'\\n\"\n"
0138 ".ascii \" else:\\n\"\n"
0139 ".ascii \" return self.val['value']\\n\"\n"
0140
0141 ".ascii \"def build_pretty_printer():\\n\"\n"
0142 ".ascii \" pp = gdb.printing.RegexpCollectionPrettyPrinter('outcome_v2')\\n\"\n"
0143 ".ascii \" pp.add_printer('outcome_v2::basic_result', '^(boost::)?outcome_v2[_0-9a-f]*::basic_result<.*>$', OutcomeBasicOutcomePrinter)\\n\"\n"
0144 ".ascii \" pp.add_printer('outcome_v2::basic_outcome', '^(boost::)?outcome_v2[_0-9a-f]*::basic_outcome<.*>$', OutcomeBasicOutcomePrinter)\\n\"\n"
0145 ".ascii \" pp.add_printer('cxx_result_status_code_*', '^cxx_result_status_code_.*$', OutcomeCResultStatusPrinter)\\n\"\n"
0146 ".ascii \" pp.add_printer('cxx_status_code_*', '^cxx_status_code_.*$', OutcomeCStatusCodePrinter)\\n\"\n"
0147 ".ascii \" return pp\\n\"\n"
0148
0149 ".ascii \"def register_printers(obj = None):\\n\"\n"
0150 ".ascii \" gdb.printing.register_pretty_printer(obj, build_pretty_printer(), replace = True)\\n\"\n"
0151
0152 ".ascii \"register_printers(gdb.current_objfile())\\n\"\n"
0153
0154 ".byte 0\n"
0155 ".popsection\n");
0156 #ifdef __clang__
0157 #pragma clang diagnostic pop
0158 #endif
0159 #endif
0160 #endif
0161
0162 #endif