Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to attach to a process using pid #30

Merged
merged 4 commits into from
Sep 16, 2024

Conversation

Vipul-Cariappa
Copy link
Contributor

Fixes #28

Test with

// pid_example.c

#include <unistd.h>
#include <stdio.h>


void func_to_debug(int argc, char *argv[]) {
    if (argc > 1) {
        for (int i = 1; i < argc; i++) {
            printf("%s\n", argv[i]);
        }
    } else {
        printf("No Arguments\n");
    }
}

int main(int argc, char *argv[]) {
    printf("pid: %d\n", getpid());
    getchar();
    func_to_debug(argc, argv);
    return 0;
}

Set a breakpoint at func_to_debug after launching idd. Then continue execution. getchar is used to suspend execution, to attach gdb.


The initial two commits in this PR are related to the old PR (parallel execution using multiprocessing).
They were small changes, so I thought of combining them.

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@vgvassilev vgvassilev merged commit 184b1ad into compiler-research:main Sep 16, 2024
@Vipul-Cariappa Vipul-Cariappa deleted the attach branch September 28, 2024 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Attach to a process with PID
2 participants