Author Topic: Debug issue in CB 13.12  (Read 8351 times)

Offline highlighting

  • Single posting newcomer
  • *
  • Posts: 6
Debug issue in CB 13.12
« on: February 13, 2014, 04:03:32 am »
Hi,
I'm using Code::Blocks 13.12 to debug ffmpeg 2.1 in Fedora 18. I create a console application with 'This is a custom Makefile' marked in project->Properities->Project settings. Please see the full debug log.


=============
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/mine/work/ffmpeg/ffmpeg-2.1_CB/ffmpeg-2.1_CB/
Adding source dir: /home/mine/work/ffmpeg/ffmpeg-2.1_CB/
Adding file: /home/mine/work/ffmpeg/ffmpeg-2.1_CB/tmp/ffplay_g
Changing directory to: /home/mine/work/ffmpeg/ffmpeg-2.1_CB/ffmpeg-2.1_CB/.
Set variable: LD_LIBRARY_PATH=.:

[debug]Command-line: /usr/bin/gdb -nx -fullname  -quiet  -args /home/mine/work/ffmpeg/ffmpeg-2.1_CB/tmp/ffplay_g
[debug]Working dir : /home/mine/work/ffmpeg/ffmpeg-2.1_CB/ffmpeg-2.1_CB

Starting debugger: /usr/bin/gdb -nx -fullname  -quiet  -args /home/mine/work/ffmpeg/ffmpeg-2.1_CB/tmp/ffplay_g
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from /home/mine/work/ffmpeg/ffmpeg-2.1_CB/tmp/ffplay_g...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) Fedora (7.5.1-37.fc18)
[debug]Copyright (C) 2012 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-redhat-linux-gnu".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) Fedora (7.5.1-37.fc18)

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory /home/mine/work/ffmpeg/ffmpeg-2.1_CB/ffmpeg-2.1_CB/
[debug]Source directories searched: /home/mine/work/ffmpeg/ffmpeg-2.1_CB/ffmpeg-2.1_CB:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> directory /home/mine/work/ffmpeg/ffmpeg-2.1_CB/
[debug]Source directories searched: /home/mine/work/ffmpeg/ffmpeg-2.1_CB:/home/mine/work/ffmpeg/ffmpeg-2.1_CB/ffmpeg-2.1_CB:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> set verbose on
[debug]>>>>>>cb_gdb:
[debug]> set args ./tmp/67.ts
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/pts/0
[debug]Queued:[tty /dev/pts/0]
[debug]>>>>>>cb_gdb:

> r

[debug]> r
[debug]Starting program: /home/mine/work/ffmpeg/ffmpeg-2.1_CB/tmp/ffplay_g ./tmp/67.ts
[debug]Reading symbols from /lib/ld-linux.so.2...
[debug](no debugging symbols found)...done.
[debug]Loaded symbols for /lib/ld-linux.so.2
[debug]Reading symbols from system-supplied DSO at 0xb7fff000...(no debugging symbols found)...done.
[debug][Inferior 1 (process 13056) exited with code 0177]
[debug]Missing separate debuginfos, use: debuginfo-install glibc-2.16-28.fc18.i686
[debug]>>>>>>cb_gdb:

Starting program: /home/mine/work/ffmpeg/ffmpeg-2.1_CB/tmp/ffplay_g ./tmp/67.ts
Reading symbols from /lib/ld-linux.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from system-supplied DSO at 0xb7fff000...(no debugging symbols found)...done.
[Inferior 1 (process 13056) exited with code 0177]
Missing separate debuginfos, use: debuginfo-install glibc-2.16-28.fc18.i686
(no debugging symbols found)...done.
Reading symbols from system-supplied DSO at 0xb7fff000...(no debugging symbols found)...done.
[Inferior 1 (process 13056) exited with code 0177]

[debug]> quit

Debugger finished with status 0
===================

All these gdb commonds work fine in terminal. And CB 10.05 does not have this issue.
I have spent much of time to google or search in this forum, but I cann't find any useful infomation.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debug issue in CB 13.12
« Reply #1 on: February 13, 2014, 08:53:00 am »
Why are you executing the run command manually?
What is the problem really? The app doesn't start?


p.s. please use code tags (# button in the interface) when pasting long logs.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline highlighting

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug issue in CB 13.12
« Reply #2 on: February 13, 2014, 11:26:08 am »
Hi oBFusCATed,
Why are you executing the run command manually?
Same issue as executing the run command automatically.

What is the problem really? The app doesn't start?
The real problem is :
[Inferior 1 (process 13056) exited with code 0177]
Cann't debug ffmpeg_g.  I think there are something wrong when gdb load ld-linux.so.2.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debug issue in CB 13.12
« Reply #3 on: February 14, 2014, 12:26:23 am »
If there is such problem then your system won't work at all.

Does your app depend on non-system shared libraries?
If it does then I suppose this is the problem, because your LD_LIBRARY_PATH is wrong.
Do you use rpath linking?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline highlighting

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug issue in CB 13.12
« Reply #4 on: February 17, 2014, 05:51:00 am »
Hi oBFusCATed,
Thanks for your help. The issue is related with LD_LIBRARY_PATH. I'll post the details later.

Offline highlighting

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug issue in CB 13.12
« Reply #5 on: February 18, 2014, 02:09:37 am »
Hi,
I have found the root cuase by following steps:
First of all, starting codeblocks in termininal. Many logs which print by codeblocks are showing in the termininal when debugging.
Looking at the logs and finding that:
Code
Switching layout to "GDB/CDB debugger:Default"
warning: GDB: Failed to set controlling terminal: Operation not permitted
/home/mine/work/ffmpeg/ffmpeg-2.1_CB/tmp/ffplay_g: error while loading shared libraries: libavdevice.so.55: cannot open shared object file: No such file or directory
Switching layout to "Code::Blocks default"
This is the key point that some .so files cann't be found by gdb.

Then executing export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/work/ffmpeg/ffmpeg-2.1_CB/tmp and starting codeblock again. It works fine. Then I can debug ffplay_g.
When using gdb commond in terminal, the path has been exported before starting gdb commond. So gdb works fine.

There are few logs about codeblocks. If all the logs in terminal can been seen easily, I should spend little of time to solve the problem.  Where can I find the logs except in terminal?
« Last Edit: February 18, 2014, 02:12:14 am by highlighting »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debug issue in CB 13.12
« Reply #6 on: February 18, 2014, 08:22:32 am »
Strange. Everything should go to debugger's log.

About your problem:
1. Do you have the path for libavdevice.so in the linker search paths?
2. Have you checked the option Project -> Properties -> Debugger -> Do not adjust LD_LIBRARY_PATH before launching debugger?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline highlighting

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug issue in CB 13.12
« Reply #7 on: February 18, 2014, 12:34:03 pm »
Quote
1. Do you have the path for libavdevice.so in the linker search paths?
Yes, -rpath-link is used. I cpoy the libs which compiled by ffmpeg to ffmpeg-2.1_CB/tmp.
Code
gcc -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil 
-Llibpostproc -Llibswscale -Llibswresample -Wl,--as-needed -Wl,--warn-common
-Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample  
-o ffplay_g ffplay.o cmdutils.o  -lavdevice -lavfilter -lavformat -lavcodec -lpostproc -lswresample
-lswscale -lavutil -ldl -lasound -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -lpthread -lmp3lame
-lfaac -lm -pthread -lz -lrt  -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -lpthread

Quote
2. Have you checked the option Project -> Properties -> Debugger -> Do not adjust LD_LIBRARY_PATH before launching debugger?
It is not checked.
« Last Edit: February 18, 2014, 12:36:54 pm by highlighting »