Skip to content

Commit 6b16dea

Browse files
authored
Merge pull request #6434 from Michael137/bugfix/lldb-asan-varnames-to-20221013
[lldb][InstrumentationRuntime] Make 'data' struct anonymous in order to avoid collisions with types in the debuggee
2 parents 890fc03 + 3c84fc0 commit 6b16dea

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ extern "C"
8888
int (*ptr__tsan_get_report_loc_object_type)(void *report, unsigned long idx, const char **object_type);
8989
int (*ptr__tsan_get_report_tag)(void *report, unsigned long *tag);
9090
}
91+
)";
92+
93+
const char *thread_sanitizer_retrieve_report_data_command = R"(
9194
9295
const int REPORT_TRACE_SIZE = 128;
9396
const int REPORT_ARRAY_SIZE = 4;
@@ -156,11 +159,7 @@ struct data {
156159
int idx;
157160
int tid;
158161
} unique_tids[REPORT_ARRAY_SIZE];
159-
};
160-
)";
161-
162-
const char *thread_sanitizer_retrieve_report_data_command = R"(
163-
data t = {0};
162+
} t = {0};
164163
165164
ptr__tsan_get_report_loc_object_type = (typeof(ptr__tsan_get_report_loc_object_type))(void *)dlsym((void*)-2 /*RTLD_DEFAULT*/, "__tsan_get_report_loc_object_type");
166165
ptr__tsan_get_report_tag = (typeof(ptr__tsan_get_report_tag))(void *)dlsym((void*)-2 /*RTLD_DEFAULT*/, "__tsan_get_report_tag");

lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,18 @@ __ubsan_get_current_report_data(const char **OutIssueKind,
6767
const char **OutMessage, const char **OutFilename, unsigned *OutLine,
6868
unsigned *OutCol, char **OutMemoryAddr);
6969
}
70+
)";
7071

71-
struct data {
72+
static const char *ub_sanitizer_retrieve_report_data_command = R"(
73+
struct {
7274
const char *issue_kind;
7375
const char *message;
7476
const char *filename;
7577
unsigned line;
7678
unsigned col;
7779
char *memory_addr;
78-
};
79-
)";
80+
} t;
8081
81-
static const char *ub_sanitizer_retrieve_report_data_command = R"(
82-
data t;
8382
__ubsan_get_current_report_data(&t.issue_kind, &t.message, &t.filename, &t.line,
8483
&t.col, &t.memory_addr);
8584
t;

lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,19 @@ const char *memory_history_asan_command_prefix = R"(
6767
size_t __asan_get_alloc_stack(void *addr, void **trace, size_t size, int *thread_id);
6868
size_t __asan_get_free_stack(void *addr, void **trace, size_t size, int *thread_id);
6969
}
70+
)";
7071

71-
struct data {
72+
const char *memory_history_asan_command_format =
73+
R"(
74+
struct {
7275
void *alloc_trace[256];
7376
size_t alloc_count;
7477
int alloc_tid;
7578
7679
void *free_trace[256];
7780
size_t free_count;
7881
int free_tid;
79-
};
80-
)";
81-
82-
const char *memory_history_asan_command_format =
83-
R"(
84-
data t;
82+
} t;
8583
8684
t.alloc_count = __asan_get_alloc_stack((void *)0x%)" PRIx64
8785
R"(, t.alloc_trace, 256, &t.alloc_tid);

0 commit comments

Comments
 (0)