Scheduled Maintenance: Over the course of a few days we will be addressing issues with the search backend. General search, newposts, yourposts, and other search driven queries may fail during the update. Details and discussion here: viewtopic.php?t=159736

 

 

 

GDB doesn't work

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

GDB doesn't work

#1 Post by Hadi_Lovelorn »

Hi

I want to use GDB for easier debugging , 2 years ago I had same problem on Terminal but when I installed CodeLite it worked ... But now When I use CodeLite by Start Debugging I take same error on Terminal :

GDB: Failed to set controlling terminal: Operation not permitted

And in Geany I take various errors like :

Can't find a source file " ./libio/./libio/ioputs.c "

Can't find a source file " ./stdio-common/./stdio-common/isoc99_scanf.c "

And I prefer to use GDB in Geany than on CodeLite ...... I will be grateful if You help me ..... Thanks

User avatar
levlaz
Posts: 181
Joined: 2012-09-27 12:06
Location: San Francisco, CA
Has thanked: 1 time
Contact:

Re: GDB doesn't work

#2 Post by levlaz »

Can you paste the full command that you are using to call gdb?
Best,

Lev
Blog

User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

Re: GDB doesn't work

#3 Post by Hadi_Lovelorn »

levlaz

I'm using them from IDEs ..... -g for Geany and on CodeLite predefined GDB debugger and not LLDB .....

User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

Re: GDB doesn't work

#4 Post by Hadi_Lovelorn »

Can anyone help ?

I searched in web , But most of the solutions are for 5 or 10 years ago and don't work any more ......

arzgi
Posts: 1241
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 43 times

Re: GDB doesn't work

#5 Post by arzgi »

Oops, wrongly rode CodeLite as CodeLight :roll:

Still, I would use just one IDE, to keep things simpler. I have not used codellite or geany, but geany seems to be a decent IDE.

Code: Select all

arto@dell:~$ aptitude search geany 
p   geany                              - fast and lightweight IDE                    
v   geany-abi-18432                    -                                             
v   geany-api-240                      -                                             
p   geany-common                       - fast and lightweight IDE -- common files    
p   geany-plugin-addons                - miscellaneous plugins for Geany             
p   geany-plugin-autoclose             - auto-closing plugin for Geany               
p   geany-plugin-automark              - auto-mark plugin for Geany                  
p   geany-plugin-codenav               - code navigation plugin for Geany            
p   geany-plugin-commander             - command panel plugin for Geany              
p   geany-plugin-ctags                 - ctags plugin for Geany                      
p   geany-plugin-debugger              - debugger plugin for Geany                   
p   geany-plugin-defineformat          - on-the-fly #define prettyprinter plugin for 
p   geany-plugin-doc                   - documentation plugin for Geany              
p   geany-plugin-extrasel              - extra selection plugin for Geany            
p   geany-plugin-gendoc                - documentation generation plugin for Geany   
p   geany-plugin-geniuspaste           - GeniusPaste plugin for Geany                
p   geany-plugin-git-changebar         - git change bar plugin for Geany             
p   geany-plugin-gproject              - transitional dummy package for geany-plugin-
p   geany-plugin-insertnum             - number inserting plugin for Geany           
p   geany-plugin-keyrecord             - git change bar plugin for Geany             
p   geany-plugin-latex                 - improved LaTeX support plugin for Geany     
p   geany-plugin-lineoperations        - Line Operations plugin for Geany            
p   geany-plugin-lipsum                - Lorem Ipsum generator plugin for Geany      
p   geany-plugin-lua                   - Lua scripting plugin for Geany              
p   geany-plugin-macro                 - macro plugin for Geany                      
p   geany-plugin-markdown              - markdown plugin for Geany                   
p   geany-plugin-miniscript            - Geany Mini-Script filter plugin             
p   geany-plugin-numberedbookmarks     - numbered bookmarks plugin for Geany         
p   geany-plugin-overview              - overview plugin for Geany                   
p   geany-plugin-pairtaghighlighter    - tag pair highlighter plugin for Geany       
p   geany-plugin-pg                    - pg plugin for Geany                         
p   geany-plugin-pohelper              - Geany plugin for improved support for GetTex
p   geany-plugin-prettyprinter         - XML pretty printer for Geany                
p   geany-plugin-prj                   - alternative project manager for Geany       
p   geany-plugin-projectorganizer      - projectorganizer plugin for Geany           
p   geany-plugin-scope                 - graphical GDB front-end for Geany           
p   geany-plugin-sendmail              - mailer plugin for Geany                     
p   geany-plugin-shiftcolumn           - text column shifting plugin for Geany       
p   geany-plugin-spellcheck            - spellcheck plugin for Geany                 
p   geany-plugin-tableconvert          - table convert plugin for Geany              
p   geany-plugin-treebrowser           - tree browser plugin for Geany               
p   geany-plugin-updatechecker         - update checker plugin for Geany             
p   geany-plugin-vc                    - VCS plugin for Geany                        
p   geany-plugin-vimode                - Vim-mode plugin for Geany                   
p   geany-plugin-workbench             - workbench plugin for Geany                  
p   geany-plugin-xmlsnippets           - XMLSnippets plugin for Geany                
p   geany-plugins                      - Kokoelma liitännäisiä Geanylle              
p   geany-plugins-common               - set of plugins for Geany (translations)     
arto@dell:~$ 


User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

Re: GDB doesn't work

#6 Post by Hadi_Lovelorn »

arzgi

I installed all packages , Here's report of mine :

Code: Select all

aptitude search geany
i   geany                           - fast and lightweight IDE                  
v   geany-abi-18432                 -                                           
v   geany-api-240                   -                                           
i A geany-common                    - fast and lightweight IDE -- common files  
i   geany-plugin-addons             - miscellaneous plugins for Geany           
i   geany-plugin-autoclose          - auto-closing plugin for Geany             
i   geany-plugin-automark           - auto-mark plugin for Geany                
p   geany-plugin-codenav            - code navigation plugin for Geany          
p   geany-plugin-commander          - command panel plugin for Geany            
p   geany-plugin-ctags              - ctags plugin for Geany                    
i   geany-plugin-debugger           - debugger plugin for Geany                 
p   geany-plugin-defineformat       - on-the-fly #define prettyprinter plugin fo
p   geany-plugin-doc                - documentation plugin for Geany            
p   geany-plugin-extrasel           - extra selection plugin for Geany          
p   geany-plugin-gendoc             - documentation generation plugin for Geany 
p   geany-plugin-geniuspaste        - GeniusPaste plugin for Geany              
p   geany-plugin-git-changebar      - git change bar plugin for Geany           
p   geany-plugin-gproject           - transitional dummy package for geany-plugi
p   geany-plugin-insertnum          - number inserting plugin for Geany         
p   geany-plugin-keyrecord          - git change bar plugin for Geany           
p   geany-plugin-latex              - improved LaTeX support plugin for Geany   
p   geany-plugin-lineoperations     - Line Operations plugin for Geany          
p   geany-plugin-lipsum             - Lorem Ipsum generator plugin for Geany    
p   geany-plugin-lua                - Lua scripting plugin for Geany            
p   geany-plugin-macro              - macro plugin for Geany                    
p   geany-plugin-markdown           - markdown plugin for Geany                 
p   geany-plugin-miniscript         - Geany Mini-Script filter plugin           
p   geany-plugin-numberedbookmarks  - numbered bookmarks plugin for Geany       
p   geany-plugin-overview           - overview plugin for Geany                 
p   geany-plugin-pairtaghighlighter - tag pair highlighter plugin for Geany     
p   geany-plugin-pg                 - pg plugin for Geany                       
p   geany-plugin-pohelper           - Geany plugin for improved support for GetT
p   geany-plugin-prettyprinter      - XML pretty printer for Geany              
p   geany-plugin-prj                - alternative project manager for Geany     
p   geany-plugin-projectorganizer   - projectorganizer plugin for Geany         
p   geany-plugin-scope              - graphical GDB front-end for Geany         
p   geany-plugin-sendmail           - mailer plugin for Geany                   
p   geany-plugin-shiftcolumn        - text column shifting plugin for Geany     
p   geany-plugin-spellcheck         - spellcheck plugin for Geany               
p   geany-plugin-tableconvert       - table convert plugin for Geany            
p   geany-plugin-treebrowser        - tree browser plugin for Geany             
p   geany-plugin-updatechecker      - update checker plugin for Geany           
p   geany-plugin-vc                 - VCS plugin for Geany                      
p   geany-plugin-vimode             - Vim-mode plugin for Geany                 
p   geany-plugin-workbench          - workbench plugin for Geany                
p   geany-plugin-xmlsnippets        - XMLSnippets plugin for Geany              
p   geany-plugins                   - set of plugins for Geany                  
i A geany-plugins-common            - set of plugins for Geany (translations)

User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

Re: GDB doesn't work

#7 Post by Hadi_Lovelorn »

Can any one guide me on this situation ?

arzgi
Posts: 1241
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 43 times

Re: GDB doesn't work

#8 Post by arzgi »

You still have not reported to @leviaz's suggestion.

How do you call GDB? Post the command and output, remember codetags.

User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

Re: GDB doesn't work

#9 Post by Hadi_Lovelorn »

Geany's Compiler's Command :

Code: Select all

gcc -g -Wall -c "%f"
Geany's Build Command :

Code: Select all

gcc -g -Wall -o "%e" "%f"
on this code ( for example ) , Geany shows error :

scanf("%c",&c);

Code: Select all

Can't find a source file "./stdio-common/./stdio-common/isoc99_scanf.c
And CodeLite has its own predefined Compile , Build and Debug commands and all are set as true way I guess ( I don't know where to find GDB commands in it , It has GDB settings but doesn't wrote the command )

blackbird
Posts: 3
Joined: 2023-08-17 04:42

Re: GDB doesn't work

#10 Post by blackbird »

Hadi_Lovelorn wrote: 2024-07-16 21:04 scanf("%c",&c);

Code: Select all

Can't find a source file "./stdio-common/./stdio-common/isoc99_scanf.c
If you want to step into the scanf call, you have to install the sources of glibc and set the source path in gdb to find them. Normally you don't want to debug the glibc code so you could step over the scanf call or ignore the warning.

User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

Re: GDB doesn't work

#11 Post by Hadi_Lovelorn »

blackbird

For debugging , A terminal must open and take the value and then evaluate step by step and show me in the debugger window in Geany ..... But it doesn't and give error and stops working ......

blackbird
Posts: 3
Joined: 2023-08-17 04:42

Re: GDB doesn't work

#12 Post by blackbird »

While debugging, Geany shows your programs input and output in a "debug terminal" in the debug pane, not in a new terminal window.

arzgi
Posts: 1241
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 43 times

Re: GDB doesn't work

#13 Post by arzgi »

Code: Select all

arto@dell:~$ apt-file search isoc99_scanf.c
arto@dell:~$   
Are you sure you use only packages from Debian repo?

blackbird
Posts: 3
Joined: 2023-08-17 04:42

Re: GDB doesn't work

#14 Post by blackbird »


User avatar
Hadi_Lovelorn
Posts: 93
Joined: 2022-05-02 23:12
Been thanked: 1 time

Re: GDB doesn't work

#15 Post by Hadi_Lovelorn »

blackbird

It shows nothing and take nothing

arzgi

I entered Your command and as Yours showed nothing ...

blackbird

I didn't included <glibc.h> in my program

Post Reply