gdb breakpoint on pthread_create

后端 未结 3 777
失恋的感觉
失恋的感觉 2020-12-28 17:55

I am trying to set a breakpoint in linux in gdb for a program creating threads. I would like to set a breakpoint on thread creation, but unfortunately pthread_create<

3条回答
  •  孤城傲影
    2020-12-28 18:52

    OK, so in case I didn't really understand you, or my first answer wasn't helpful, do this:

    (gdb) info func pthread_create
    All functions matching regular expression "pthread_create":
    
    Non-debugging symbols:
    0x080485e0  pthread_create
    0x080485e0  pthread_create@plt
    0x00786590  __pthread_create_2_1
    0x00786590  pthread_create@@GLIBC_2.1
    0x00786ee0  __pthread_create_2_0
    0x00786ee0  pthread_create@GLIBC_2.0
    

    Now pick the symbol that you think is the right one, and set a breakpoint there. Don't pick the ones that have "@" in them, but one of the ones that has digits and underscores, such as 1__pthread_create_2_1.

提交回复
热议问题