Switching to Emacs GDB

I am having problems migrating to GDB. I built an example program from the ffmpeg library with displaying debugging symbols and disabling. Although I set the ffmpeg library to static and explicitly disabled sharing, it looks like the program I'm debugging dynamically links because its file size is only 99K. I do not know that this is a problem, but I thought about it.

After I set and hit a breakpoint in av_seek_frame, I use the "next" command to jump. However, this is a step into the first function in av_seek_frame (), as you can see below. In addition, if you do the second β€œnext”, the reverse track loses track of where it is. Am I misconfigured? How can I step over? I should note that I double-checked that "set step-mode off" is turned off as the default value (since I believe this will break on the first piece of code without debugging information.)

Breakpoint 1, av_seek_frame (s=0x16429000, stream_index=0, timestamp=29727438, flags=0) at l
(gdb) list
1648
1649        return 0;
1650    }
1651
1652    int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags
1653    {
1654        int ret;
1655        AVStream *st;
1656
1657        ff_read_frame_flush(s);
(gdb) next
ff_read_frame_flush (s=0x16429000) at libavformat/utils.c:1248
(gdb) list
1243
1244    /**
1245     * Flush the frame reader.
1246     **/
1247    void ff_read_frame_flush(AVFormatContext *s)
1248    {
1249        AVStream *st;
1250        int i, j;
1251
1252        flush_packet_queue(s);
(gdb) next
ff_read_frame_flush (s=0x16429000) at libavformat/utils.c:1252
(gdb) where
#0  ff_read_frame_flush (s=0x16429000) at libavformat/utils.c:1252
#1  0x00000000 in ?? ()
+3
source share
1 answer

, , ldd :

% ldd ffmpeg
        not a dynamic executable

, gdb , , , PATH.

, . , -disable-stripping -disable-optimizations, gdb , step next. -disable-stripping, gdb ffmpeg_g ( ffmpeg, file ffmpeg_g).

-disable-optimizations, value optimized out , , , , emacs/gdb ... .

, , gud/gdb Emacs, : gud-break , , ffmpeg , , , utils.c, , gdb, ffmpeg utils.c ( 5 utils.c, lib *). $cdir: $cwd, - /path/to/ffmpeg: $cdir: $cwd, utils.c libavformat, , libavutil - , , , , , ( libavutil ), , utils.c.

gud/gdb . , gud-break/gud-format-command, .

+1

Source: https://habr.com/ru/post/1746052/


All Articles