DynamoRIO / DynamoRIO/dynamorio
program abort issue
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
this is my instrumentation.c file ---
#define LINUX
#define X86_64
#include "../include/dr_api.h"
#include
#include
#include "../include/dr_ir_instr.h"
static void event_module_load(void* drcontext, const module_data_t* info, bool loaded) {
(void)drcontext; // Suppress unused parameter warning
(void)info; // Suppress unused parameter warning
(void)loaded;
fprintf(stderr,"the full path is %s",info->full_path);
 if (strstr(info->full_path, "main.go") != NULL) {
app_pc target_addr = (app_pc)dr_get_proc_address(info->handle, "main.hello");
if (target_addr != NULL) {
char* custom_message = "Custom message before calling hello()";
dr_printf("%s\n", custom_message);
instrlist_t* ilist = instrlist_create(drcontext);
instr_t* instr = INSTR_CREATE_call(drcontext, opnd_create_pc(target_addr));
instrlist_append(ilist, instr);
dr_insert_clean_call(drcontext, ilist, instr, target_addr, false, 0);
}
}
}
DR_EXPORT void dr_init(client_id_t id) {
(void)id; // Suppress unused parameter warning
dr_register_module_load_event(event_module_load);
}
this is simple main.go file---
package main
import "fmt"
func hello() {
fmt.Println("Hello from the original function!")
}
func main() {
hello()
}
Contributor guide
Assessment
This issue has not been assessed yet.