<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Gcc%2Fgdb</id>
	<title>Gcc/gdb - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Gcc%2Fgdb"/>
	<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Gcc/gdb&amp;action=history"/>
	<updated>2026-05-09T00:13:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://aznot.com/index.php?title=Gcc/gdb&amp;diff=3344&amp;oldid=prev</id>
		<title>Kenneth: /* Ubuntu - Cannot find file ‘../sysdeps/unix/syscall-template.S’ */</title>
		<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Gcc/gdb&amp;diff=3344&amp;oldid=prev"/>
		<updated>2016-05-03T21:10:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Ubuntu - Cannot find file ‘../sysdeps/unix/syscall-template.S’&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== gdb ==&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
&lt;br /&gt;
Debugging with GDB - https://www.sourceware.org/gdb/onlinedocs/gdb.html&lt;br /&gt;
&lt;br /&gt;
== Pass Commandline Arguments ==&lt;br /&gt;
&lt;br /&gt;
Run command with arguments:&lt;br /&gt;
 gdb -ex=r --args myprogram arg1 arg2&lt;br /&gt;
&lt;br /&gt;
You can run gdb with --args parameter [http://stackoverflow.com/questions/6121094/how-do-i-run-a-program-with-commandline-args-using-gdb-within-a-bash-script]&lt;br /&gt;
 gdb --args executablename arg1 arg2 arg3&lt;br /&gt;
&lt;br /&gt;
If you want it to run automatically, place some commands in a file (e.g. &amp;#039;run&amp;#039;) and give it as argument: -x /tmp/cmds. Optionally you can run with -batch mode.&lt;br /&gt;
 gdb -batch -x /tmp/cmds --args executablename arg1 arg2 arg3&lt;br /&gt;
&lt;br /&gt;
Interactive:&lt;br /&gt;
 gdb ./a.out&lt;br /&gt;
 (gdb) r arg1 arg2 arg3&lt;br /&gt;
&lt;br /&gt;
 gdb&lt;br /&gt;
 (gdb) file executable&lt;br /&gt;
 (gdb) r arg1 arg2 arg3&lt;br /&gt;
&lt;br /&gt;
Pull in with scripts:&lt;br /&gt;
 gdb prog &amp;lt; file&lt;br /&gt;
&lt;br /&gt;
== Backtrace ==&lt;br /&gt;
&lt;br /&gt;
Print a backtrace of the entire stack: one line per frame for all frames in the stack. &lt;br /&gt;
 backtrace&lt;br /&gt;
 bt&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
* Backtrace - Debugging with GDB - https://sourceware.org/gdb/onlinedocs/gdb/Backtrace.html&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Print stack trace of a core file without needing to enter gdb interactively [http://www.commandlinefu.com/commands/view/6004/print-stack-trace-of-a-core-file-without-needing-to-enter-gdb-interactively]&lt;br /&gt;
 gdb --batch --quiet -ex &amp;quot;thread apply all bt full&amp;quot; -ex &amp;quot;quit&amp;quot; ${exe} ${corefile}&lt;br /&gt;
&lt;br /&gt;
This will print stack trace of a core file without needing to enter gdb interactively&lt;br /&gt;
&lt;br /&gt;
This does almost the same thing as the original, but it runs the full backtrace for _all_ the threads, which is pretty important when reporting a crash for a multithreaded software, since more often than not, the signal handler is executed in a different thread than the crash happened.&lt;br /&gt;
&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
Alternatives:&lt;br /&gt;
&lt;br /&gt;
Run a program transparently, but print a stack trace if it fails [http://www.commandlinefu.com/commands/view/6004/print-stack-trace-of-a-core-file-without-needing-to-enter-gdb-interactively]&lt;br /&gt;
 gdb -batch -ex &amp;quot;run&amp;quot; -ex &amp;quot;bt&amp;quot; ${my_program} 2&amp;gt;&amp;amp;1 | grep -v ^&amp;quot;No stack.&amp;quot;$&lt;br /&gt;
&lt;br /&gt;
For automated unit tests I wanted my program to run normally, but if it crashed, to add a stack trace to the output log. I came up with this command so I wouldn&amp;#039;t have to mess around with core files.&lt;br /&gt;
&lt;br /&gt;
The one downside is that it does smoosh your program&amp;#039;s stderr and stdout together.&lt;br /&gt;
&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
Print stack trace of a core file without needing to enter gdb interactively&lt;br /&gt;
 alias gdbbt=&amp;quot;gdb -q -n -ex bt -batch&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The pstack command prints a stack trace of running processes without needing to attach a debugger, but what about core files? The answer, of course, is to use this command. Usage: gdbbt program corefile&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu - Cannot find file ‘../sysdeps/unix/syscall-template.S’ ===&lt;br /&gt;
&lt;br /&gt;
Error:&lt;br /&gt;
 Cannot find file ‘../sysdeps/unix/syscall-template.S’&lt;br /&gt;
 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.&lt;br /&gt;
&lt;br /&gt;
Fix&lt;br /&gt;
 # dependency&lt;br /&gt;
 sudo apt-get dpkg-dev&lt;br /&gt;
&lt;br /&gt;
 # dumps eglibc in current folder&lt;br /&gt;
 sudo apt-get source libc6&lt;br /&gt;
 cd eglibc-2.19&lt;br /&gt;
 git clone ..  # into the eglibc folder&lt;br /&gt;
&lt;br /&gt;
Alt Fix:&lt;br /&gt;
 cd ..&lt;br /&gt;
 sudo apt-get source libc6&lt;br /&gt;
 ln -s eglibc-2.19/sysdeps sysdeps&lt;br /&gt;
&lt;br /&gt;
Square Goldfish » Debugging in Ubuntu 12.10 – missing file syscall-template.S - http://www.squaregoldfish.co.uk/2013/01/06/debugging-in-ubuntu-12-10-missing-file-syscall-template-s/&lt;/div&gt;</summary>
		<author><name>Kenneth</name></author>
	</entry>
</feed>