Pinpoint plugin CU identifier labels
This commit is contained in:
parent
d3094ce698
commit
91a329122b
@ -4,6 +4,7 @@
|
||||
#include <stage1.h>
|
||||
|
||||
#include <safe-input.h>
|
||||
#include <safe-output.h>
|
||||
#include <safe-md5.h>
|
||||
#include <pinpoint_config.h>
|
||||
#include <pinpoint_error.h>
|
||||
@ -31,11 +32,22 @@ static const char* calculate_cu_uid_hex() {
|
||||
return cu_uid_hex;
|
||||
}
|
||||
|
||||
static bool emit_cu_uid_label(const char* uid) {
|
||||
char label[128];
|
||||
snprintf(label, sizeof(label), SPSLR_PINPOINT_CU_UID_LABEL "%s", uid);
|
||||
|
||||
fprintf(asm_out_file, "%s:\n", label);
|
||||
return true;
|
||||
}
|
||||
|
||||
void on_finish_unit(void* plugin_data, void* user_data) {
|
||||
const char* cu_uid = calculate_cu_uid_hex();
|
||||
if (!cu_uid)
|
||||
pinpoint_fatal("on_finish_unit failed to calculate compilation unit UID");
|
||||
|
||||
if (!emit_cu_uid_label(cu_uid))
|
||||
pinpoint_fatal("on_finish_unit failed to emit CU UID label");
|
||||
|
||||
std::cout << "Finishing unit \"" << lbasename(main_input_filename) << "\" ..." << std::endl;
|
||||
std::cout << " Unit UID is 0x" << cu_uid << std::endl;
|
||||
|
||||
|
||||
@ -3,3 +3,4 @@
|
||||
#define SPSLR_ATTRIBUTE "spslr"
|
||||
#define SPSLR_PINPOINT_STAGE0_SEPARATOR "__spslr_offsetof"
|
||||
#define SPSLR_PINPOINT_STAGE1_PIN "__spslr_ipin_" /* suffixed with "<uid>" */
|
||||
#define SPSLR_PINPOINT_CU_UID_LABEL "__spslr_cu_" /* suffixed with "<uid>" */
|
||||
|
||||
8
pinpoint/safegcc/safe-output.h
Normal file
8
pinpoint/safegcc/safe-output.h
Normal file
@ -0,0 +1,8 @@
|
||||
#include <safe-gcc-plugin.h>
|
||||
|
||||
#ifndef SAFEGCC_OUTPUT_H
|
||||
#define SAFEGCC_OUTPUT_H
|
||||
|
||||
#include <output.h>
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user