DynamoRIO / DynamoRIO/dynamorio

program abort issue

Open
#6,181 1 comment 0 reactions 0 assignees View on GitHub
Status-NeedInfo
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);
![1688033608459](https://github.com/DynamoRIO/dynamorio/assets/71578263/d652ca46-af43-4f21-8e18-664eb128571f) 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.