1

I am trying to obtain GDB traces as described in this other question. For completeness, on one terminal I am running:

$ gdbserver :1234 ./a.out 
Process ./a.out created; pid = 13610
Listening on port 1234

And on another one (client):

$ gdb ./a.out
...
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Reading symbols from ./a.out...
(gdb) target remote :1234
Remote debugging using :1234
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading symbols from target:/lib64/ld-linux-x86-64.so.2...
Reading symbols from /usr/lib/debug/.build-id/45/87364908de169dec62ffa538170118c1c3a078.debug...
0x00007ffff7fd0100 in _start () from target:/lib64/ld-linux-x86-64.so.2
(gdb) trace 3
Tracepoint 1 at 0x555555555157: file ../test/main.cpp, line 3.
(gdb)  b 9
Breakpoint 2 at 0x55555555519a: file ../test/main.cpp, line 9.
(gdb) actions 1
Enter actions for tracepoint 1, one per line.
End with a line saying just "end".
>collect $regs,$args
>end
(gdb) tstart
(gdb) c

And here is where it differs from the other question, I get the error when I want to continue to the breakpoint at 9:

Continuing.
Reading /lib/x86_64-linux-gnu/libc.so.6 from remote target...
Target returns error code '01'.

I tried the whole experiment without the tracepoint, and the continue command works correctly.

Of course I tried googling the error code 01, but seems pretty generic so I could not draw any conclusions. Any idea what could be going wrong?

1 Answer 1

1

It appears to be a known issue, apparently tracepoints have been broken since binutils 2.33 and a patch was added to fix them in 2.41.

Your GDB/binutils version must be some inbetween. Here are the two commits:

Try again with version 2.41 or later.

Sign up to request clarification or add additional context in comments.

2 Comments

This is the answer, I had to build the latest GDB myself, the one that came with the system was: GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2 The one I built: GNU gdb (GDB) 14.0.50.20230730-git Now it works. thanks!
Just beware of the comment in the issue description: > "Things remain quite broken in that area though." Meaning tracepoints support in GDB seems to be unmaintained and probably not fully functional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.