MCPcopy Create free account
hub / github.com/apache/impala / write_dump_threadinfo

Function write_dump_threadinfo

be/src/util/minidump.cc:69–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static void write_dump_threadinfo(int fd, ThreadDebugInfo* thread_info) {
70 constexpr char thread_msg[] = "Minidump in thread ";
71 // pid_t is signed, but valid process IDs must always be positive.
72 const int64_t thread_id = thread_info->GetSystemThreadId();
73 // 20 characters needed for UINT64_MAX.
74 char thread_id_str[20];
75 const unsigned int thread_id_len = my_uint_len(thread_id);
76 my_uitos(thread_id_str, thread_id, thread_id_len);
77 const char* thread_name = thread_info->GetThreadName();
78
79 constexpr char query_msg[] = " running query ";
80 const TUniqueId& query_id = thread_info->GetQueryId();
81 char query_id_str[TUniqueIdBufferSize];
82 PrintIdCompromised(query_id, query_id_str);
83
84 constexpr char instance_msg[] = ", fragment instance ";
85 const TUniqueId& instance_id = thread_info->GetInstanceId();
86 // Format TUniqueId according to PrintId from util/debug-util.h
87 char instance_id_str[TUniqueIdBufferSize];
88 PrintIdCompromised(instance_id, instance_id_str);
89
90 // Example:
91 // > Minidump in thread [1790536]async-exec-thread running query 1a47cc1e2df94cb4:
92 // 88dfa08200000000, fragment instance 0000000000000000:0000000000000000
93 sys_write(fd, thread_msg, sizeof(thread_msg) / sizeof(thread_msg[0]) - 1);
94 sys_write(fd, "[", 1);
95 sys_write(fd, thread_id_str, thread_id_len);
96 sys_write(fd, "]", 1);
97 sys_write(fd, thread_name, my_strlen(thread_name));
98 sys_write(fd, query_msg, sizeof(query_msg) / sizeof(query_msg[0]) - 1);
99 sys_write(fd, query_id_str, TUniqueIdBufferSize);
100 sys_write(fd, instance_msg, sizeof(instance_msg) / sizeof(instance_msg[0]) - 1);
101 sys_write(fd, instance_id_str, TUniqueIdBufferSize);
102 sys_write(fd, "\n", 1);
103}
104
105static void write_dump_path(int fd, const char* path) {
106 // We use the linux syscall support methods from chromium here as per the

Callers 1

DumpCallbackFunction · 0.85

Calls 4

PrintIdCompromisedFunction · 0.85
GetSystemThreadIdMethod · 0.80
GetThreadNameMethod · 0.80
GetQueryIdMethod · 0.45

Tested by

no test coverage detected