()
| 1069 | |
| 1070 | @staticmethod |
| 1071 | def get_thread_state(): |
| 1072 | exprs = [ |
| 1073 | '_Py_tss_gilstate', # 3.15+ |
| 1074 | '_Py_tss_tstate', # 3.12+ (and not when GIL is released) |
| 1075 | 'pthread_getspecific(_PyRuntime.autoTSSkey._key)', # only live programs |
| 1076 | '((struct pthread*)$fs_base)->specific_1stblock[_PyRuntime.autoTSSkey._key].data' # x86-64 |
| 1077 | ] |
| 1078 | for expr in exprs: |
| 1079 | try: |
| 1080 | val = gdb.parse_and_eval(f'(PyThreadState*)({expr})') |
| 1081 | except gdb.error: |
| 1082 | continue |
| 1083 | if int(val) != 0: |
| 1084 | return val |
| 1085 | return None |
| 1086 | |
| 1087 | @staticmethod |
| 1088 | def get_thread_local_frame(): |
no outgoing calls
no test coverage detected