Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

代码如下:

#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <pthread.h>

int money = 100;
int apple = 80;
int banana = 50;


void *buy_banana(void *arg)
{
        int i = (int)arg;
        if(money > banana){
                sleep(1);
                money -= banana;
                printf("\nbuy a banana ok, rest = %d\n", money);
        }
        return NULL;
}


void *buy_apple(void *arg)
{
        int i = (int)arg;
        if(money > apple){
                sleep(1);
                money -= apple;
                printf("\nbuy a apple ok, rest = %d\n", money);
        }
        return NULL;
}

int main(int argc, char *argv[])
{
        pthread_t thread1, thread2;

        pthread_create(&thread1, NULL, buy_banana, NULL);
        pthread_create(&thread2, NULL, buy_apple, NULL);

        getchar();
        return 0;
}

代码中有2个线程,我想通过qiling的hook机制获得两个线程代码段的起始和结束地址,请问一下代码如何写?感谢

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.