GDB in Cygwin is missing sigfe.s? - gdb

After doing some programming assignments for school, I decided to start working on some side projects I had in mind. I decided to install vim on Windows and link it properly using Cygwin. I installed gcc and gdb at first, to try to see if everything worked. I made a quick C file that had a few printf's so I could step into them using gdb.
I can set a breakpoint in main, run the program, get the first printf, but the moment I try to step into the next line, an error appears.
(gdb) step
_sigfe_puts () at sigfe.s:7019
7019 sigfe.s: No such file or directory.
I thought I didn't install gdb properly, so I reinstalled to no luck. I tried using UltraGDB to see if it would help, but the same thing happened, this time giving me a much clearer error.
Can't find a source file at "C:/cygwin64/cygwin/src/cygwin/cygwin-2.8.0/cygwin-2.8.0-1.x86_64/build/x86_64-pc-cygwin/winsup/cygwin/sigfe.s"
Locate the file or edit the source lookup path to include its location.
I had a suspicion it had to do with permissions, so I tried to look up said directory and turns out it really does not exist. C:/cygwin64/ does not have a cygwin folder, much less a subfolder called src and so on. What I did find is that there is a folder called x86_64-pc-cygwin in the cygwin64/usr but it does not have a winsup folder at all.
I'm lost as to what I can do now to fix this error, it's been annoying me for the past few days and have not found any fixes regarding this. I assume GDB is looking for this file in the wrong place, but if I have gdb installed using the Cygwin setup executable then shouldn't this be working anyway? Any help would be appreciated, thank you.
Complete test run w/error:
$ gdb ./test
GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...done.
(gdb) break main
Breakpoint 1 at 0x1004010ed: file test.c, line 6.
(gdb) run
Starting program: /home/User/test
[New Thread 13236.0x4c0]
[New Thread 13236.0x824]
[New Thread 13236.0x3078]
[New Thread 13236.0x374]
Breakpoint 1, main () at test.c:6
6 printf("Hello\n");
(gdb) step
_sigfe_puts () at sigfe.s:7019
7019 sigfe.s: No such file or directory.
(gdb)
7020 in sigfe.s
(gdb)
7023 in sigfe.s
(gdb)
_sigfe () at sigfe.s:19
19 in sigfe.s
(gdb)
20 in sigfe.s
(gdb)
21 in sigfe.s
.
.
.
(stops responding after various steps)

sigfe.s is a source file dynamically created during cygwin build.
It is present in the build tree:
$ find . -iname "*sigfe*"
./x86_64-unknown-cygwin/winsup/cygwin/sigfe.o
./x86_64-unknown-cygwin/winsup/cygwin/sigfe.s
and it seems the only file with such characteristics
$ find . -iname "*.s"
./x86_64-unknown-cygwin/winsup/cygwin/sigfe.s
In theory it should be included in the cygwin-debuginfo package
$ cygcheck -l cygwin-debuginfo | grep -i "s$"
/usr/src/debug/cygwin-2.8.1-0.1/newlib/libc/machine/x86_64/memcpy.S
/usr/src/debug/cygwin-2.8.1-0.1/newlib/libc/machine/x86_64/memset.S
/usr/src/debug/cygwin-2.8.1-0.1/newlib/libc/machine/x86_64/setjmp.S
You can highlight the issue on the cygwin mailing list.
https://cygwin.com/cygwin/lists.html

Related

gdb of simple hello world program not working as expected on Mac 10.13.6

I was just intending to explore the features of gdb by following:
https://www.youtube.com/watch?v=PorfLSr3DDI&t=212s
While trying to replicate the steps as in the movie above, I got slightly different output:
When I ran
gdb a.out
, I got this:
GNU gdb (GDB) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 5 user staff 160 May 8 22:46 .
This is free software: you are free to change and redistribute it.wxr-xr-x 1 user staff 8432 May 8 22:46 a.out
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.world.c
This GDB was configured as "x86_64-apple-darwin17.7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
Users-MBP:codecompre_tooltest user$
For help, type "help".ooltest user$
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
warning: dsym file UUID doesn't match the one in /Users/user/Documents/codecompre_tooltest/a.out
(no debugging symbols found)...done.
(gdb) start
Temporary breakpoint 1 at 0x100000f04
Starting program: /Users/user/Documents/codecompre_tooltest/a.out
[New Thread 0x1703 of process 1645]
[New Thread 0x1903 of process 1645]
[New Thread 0x1a03 of process 1645]
[3]+ Stopped gdb a.out
Why is this so, and how can I solve this?
NOTE: I have followed all the steps in:
http://panks.me/posts/2013/11/install-gdb-on-os-x-mavericks-from-source/
https://gist.github.com/kpy3/27014703672ad6d54c00dfc06e45f1ae

"No such file or directory" messages when using GDB with C++ programs

I'm pretty new to using GDB, so sorry if this is a noob question.
When using GDB on any C++ program, I get a large number of "No such file or directory" messages. This does not happen with C programs.
Here's what I'm doing:
$ g++ -g hello-world.cpp -o hello-world.o
$ gdb hello-world.o
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin15.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello-world.o...Reading symbols from /Users/noah/c++/hello-world.o.dSYM/Contents/Resources/DWARF/hello-world.o...done.
done.
(gdb) r
Starting program: /Users/noah/c++/hello-world.o
warning: `/private/tmp/gcc6-20160515-25034-1nu0tpk/gcc-6.1.0/build/x86_64-apple-darwin15.2.0/libstdc++-v3/src/.libs/compatibility-atomic-c++0x.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc6-20160515-25034-1nu0tpk/gcc-6.1.0/build/x86_64-apple-darwin15.2.0/libstdc++-v3/src/.libs/compatibility-c++0x.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc6-20160515-25034-1nu0tpk/gcc-6.1.0/build/x86_64-apple-darwin15.2.0/libstdc++-v3/src/.libs/compatibility-chrono.o': can't open to read symbols: No such file or directory.
(many more messages omitted)
warning: `/private/tmp/gcc6-20160515-25034-1nu0tpk/gcc-6.1.0/build/x86_64-apple-darwin15.2.0/libgcc/unordtf2_s.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc6-20160515-25034-1nu0tpk/gcc-6.1.0/build/x86_64-apple-darwin15.2.0/libgcc/unwind-c_s.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc6-20160515-25034-1nu0tpk/gcc-6.1.0/build/x86_64-apple-darwin15.2.0/libgcc/unwind-dw2_s.o': can't open to read symbols: No such file or directory.
Hello World
[Inferior 1 (process 2319) exited normally]
(gdb)
I'm using OS X El Capitan, with G++ 6.1.0 and GDB 7.11.1, both installed through Homebrew. GDB is codesigned using these instructions.

gdb in emacs hangs when issuing the 'q(uit)' command

I'm using emacs 24.5.1 under Mac Yosemite, in graphical mode and I'm trying to get gdb 7.11 working.
After starting gdb with 'gdb', I use 'r' to run a mini C++ code, consisting only of an empty main(), which exits normally. After it exits I can type 'r' again and the program will run and exit fine again. However, when I type 'q' to quit gdb, I get a newline without the (gdb) prompt, but gdb does not seem to have quit; It no longer responds to input, but when I try invoking gdb again, emacs tells me that 'this program is already being debugged'.
Current directory is ~/cpp/ppcpp/
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin15.4.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...Reading symbols from /Users/mwisse/cpp/ppcpp/a.out.dSYM/Contents/Resources/DWARF/a.out...done.
done.
(gdb) r
Starting program: /Users/mwisse/cpp/ppcpp/a.out
[Inferior 1 (process 98675) exited normally]
(gdb) r
Starting program: /Users/mwisse/cpp/ppcpp/a.out
[Inferior 1 (process 98677) exited normally]
(gdb) q
...This is me typing something to show I can type anything here...
but no response.
Has anyone seen this before?
I didn't find out what caused the issue, but it went away after replacing my .emacs.d directory with the one mentioned here: http://tuhdo.github.io/emacs-for-proglang.html.

Debug Q With GDB Debugger

This is really a general question.
And I've tried looking around for help but it's about the gdp debugger.
I compile a program, it takes two strings as arguments.
I run it with r and the two parameters following it, but when I insert a break like ' break 33 ' and break at line 33 and then run it again, I cannot step into it and it doesn't stop at my break.
I can't step break continue etc.
gcc -g -o debugme debugme.c
Directory: /home/
Tue Oct 6 20:03:14 EDT 2015
[]$ debugme "hi there" "bye bye"
String '0' - 'debugme'
String '1' - 'hi there'
String '2' - 'bye bye'
Total number of command-line arguments: 2
(gdb)
Tue Oct 6 20:06:56 EDT 2015
[]$ cd cosc220
[]$ gdb debugme
GNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
..
Reading symbols from /home/...done.
(gdb) break 33
Breakpoint 1 at 0x4005c7: file debugme.c, line 33.
(gdb) delete 1
(gdb)
(gdb) break 33
Breakpoint 2 at 0x4005c7: file debugme.c, line 33.
(gdb)
What do I need to type for this to work?
It tells me my program isn't running, I try viewing my call stack and it's empty
I type r for run later (I just didn't include it here)
You need to hit r at the gdb so that your program again start running.
What do I need to type for this to work?
You should probably read an introduction, such as this one.
The command you are looking for is run, but once you run your program to the breakpoint, it's likely that you'll have more questions, so starting at introduction may still be a good idea.
It turns out that we didn't have it installed on the server at my school...
Face-palm, it's working now.

how to run a cgi program

I am new to cgi and with an example I wrote a small program in c++ which I have compiled to a .cgi file.
My question is: do I need an separate web server? I have lighttpd as my default web server ... If i can run thought lighttpd please explain how can I do it...
Make sure your .cgi file is executable, and put it under your web root.
Turn on cgi http://redmine.lighttpd.net/wiki/1/Docs:ModCGI
go to the page. :)
Strictly speaking you don't need a server. If you just want to see your CGI running, you can use my tiny runCGI project.
All you need is to set a yaml file which looks something like this
_exec: /var/cgi-bin/myfile.cgi
method: GET
query_string:
q: s
and then run
./runCGI myyamlfile.yaml
You will see the output on the console's standard output.
You can even debug it with gdb, debug runCGI gdb runCGI, run with the correct parameters (run someyaml.yaml), issue tcatch exec (tcatch catches it only once) and then set breakpoints to your CGI file:
$ g++ a.cc -o a.out
$ cat a.yaml
method: GET
_exec: a.out
$ gdb runCGI
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) tcatch exec
Catchpoint 1 (exec)
(gdb) run a.yaml
Starting program: /home/elazar/runCGI/runCGI a.yaml
Executing new program: /home/elazar/runCGI/a.out
0x00007fc3a24a6a60 in ?? () from /lib64/ld-linux-x86-64.so.2
(gdb) tbreak main
Breakpoint 2 at 0x400577: file a.cc, line 2.
(gdb) c
Continuing.
main (argc=1, argv=0x7fff14891408) at a.cc:2
2 int a =0;
(gdb)