<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-1618</id>
	<title>Nabble - Gnu - gdb</title>
	<updated>2009-11-27T07:55:18Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/Gnu---gdb-f1618.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Gnu---gdb-f1618.html" />
	<subtitle type="html">GDB, the GNU Project debugger, allows you to see what is going on 'inside' another program while it executes -- or what another program was doing at the moment it crashed. Gnu - gdb home is &lt;a href=&quot;http://www.gnu.org/software/gdb/gdb.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26546848</id>
	<title>&quot;display&quot; bug</title>
	<published>2009-11-27T07:55:18Z</published>
	<updated>2009-11-27T07:55:18Z</updated>
	<author>
		<name>Yanmeng Ba</name>
	</author>
	<content type="html">Hello everyone,
&lt;br&gt;&lt;br&gt;I use the GDB 7.0 with python extension to periodically attach GDB to
&lt;br&gt;a running process and output some variable values. The process I am
&lt;br&gt;investigating is quite simple: it prints out the value of a variable
&lt;br&gt;which decrease by 1 every 3 seconds. My method is quite simple and
&lt;br&gt;straightforward:
&lt;br&gt;&lt;br&gt;import sys
&lt;br&gt;import gdb
&lt;br&gt;import time
&lt;br&gt;while True:
&lt;br&gt;&amp;nbsp; &amp;nbsp; print &amp;quot;attach&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; gdb.execute(&amp;quot;attach 31127&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; gdb.execute(&amp;quot;break 14&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; gdb.execute(&amp;quot;continue&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; gdb.execute(&amp;quot;display i&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; gdb.execute(&amp;quot;detach&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; time.sleep(6)
&lt;br&gt;end
&lt;br&gt;&lt;br&gt;However, each time I &amp;quot;display&amp;quot; the value of variable i, the number of
&lt;br&gt;value printed is proportional to the number of the run.
&lt;br&gt;&lt;br&gt;Partial of the results displayed in my terminal is as follows:
&lt;br&gt;&lt;br&gt;attach
&lt;br&gt;0xb808b430 in __kernel_vsyscall ()
&lt;br&gt;Breakpoint 4 at 0x804840c: file beer-process.c, line 14.
&lt;br&gt;&lt;br&gt;Breakpoint 1, main () at beer-process.c:14
&lt;br&gt;14			PrintMessage( i );
&lt;br&gt;3: i = 99961
&lt;br&gt;2: i = 99961
&lt;br&gt;1: i = 99961
&lt;br&gt;attach
&lt;br&gt;0xb808b430 in __kernel_vsyscall ()
&lt;br&gt;Breakpoint 5 at 0x804840c: file beer-process.c, line 14.
&lt;br&gt;&lt;br&gt;Breakpoint 1, main () at beer-process.c:14
&lt;br&gt;14			PrintMessage( i );
&lt;br&gt;4: i = 99958
&lt;br&gt;3: i = 99958
&lt;br&gt;2: i = 99958
&lt;br&gt;1: i = 99958
&lt;br&gt;attach
&lt;br&gt;0xb808b430 in __kernel_vsyscall ()
&lt;br&gt;Breakpoint 6 at 0x804840c: file beer-process.c, line 14.
&lt;br&gt;&lt;br&gt;Breakpoint 1, main () at beer-process.c:14
&lt;br&gt;14			PrintMessage( i );
&lt;br&gt;5: i = 99955
&lt;br&gt;4: i = 99955
&lt;br&gt;3: i = 99955
&lt;br&gt;2: i = 99955
&lt;br&gt;1: i = 99955
&lt;br&gt;attach
&lt;br&gt;0xb808b430 in __kernel_vsyscall ()
&lt;br&gt;Breakpoint 7 at 0x804840c: file beer-process.c, line 14.
&lt;br&gt;&lt;br&gt;Breakpoint 1, main () at beer-process.c:14
&lt;br&gt;14			PrintMessage( i );
&lt;br&gt;6: i = 99952
&lt;br&gt;5: i = 99952
&lt;br&gt;4: i = 99952
&lt;br&gt;3: i = 99952
&lt;br&gt;2: i = 99952
&lt;br&gt;1: i = 99952
&lt;br&gt;attach
&lt;br&gt;0xb808b430 in __kernel_vsyscall ()
&lt;br&gt;Breakpoint 8 at 0x804840c: file beer-process.c, line 14.
&lt;br&gt;&lt;br&gt;Breakpoint 1, main () at beer-process.c:14
&lt;br&gt;14			PrintMessage( i );
&lt;br&gt;7: i = 99949
&lt;br&gt;6: i = 99949
&lt;br&gt;5: i = 99949
&lt;br&gt;4: i = 99949
&lt;br&gt;3: i = 99949
&lt;br&gt;2: i = 99949
&lt;br&gt;1: i = 99949
&lt;br&gt;&lt;br&gt;It is really weird that it prints more and more values as the the run
&lt;br&gt;goes on. I am not sure whether this is a bug in GDB. If it is not a
&lt;br&gt;bug, could anyone give me some insights on how to fix my problem
&lt;br&gt;here ? Thanks a lot in advance.
&lt;br&gt;&lt;br&gt;best,
&lt;br&gt;Yanmeng Ba
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26546848&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22display%22-bug-tp26546848p26546848.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26487888</id>
	<title>Re: m4 changequote bug</title>
	<published>2009-11-23T05:06:45Z</published>
	<updated>2009-11-23T05:06:45Z</updated>
	<author>
		<name>Eric Blake</name>
	</author>
	<content type="html">-----BEGIN PGP SIGNED MESSAGE-----
&lt;br&gt;Hash: SHA1
&lt;br&gt;&lt;br&gt;[please keep replies on the list, and adding bug-gdb]
&lt;br&gt;&lt;br&gt;According to Josef Vukovic on 11/23/2009 5:37 AM:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 2009/11/19 Eric Blake &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26487888&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ebb9@...&lt;/a&gt; &amp;lt;mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26487888&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ebb9@...&lt;/a&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; I'm not sure when that was fixed, but I confirmed that even as far
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; back as
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; 1.4.4 does not have that behavior. &amp;nbsp;Are you sure that was a real bug at
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; some point? &amp;nbsp;And, if I may ask, why do you care? &amp;nbsp;Anything older than
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; 1.4.6 is not really usable with autoconf.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The reason why I care is simple. I treid doning the example in &amp;quot;Debugging
&lt;br&gt;&amp;gt; with GDB&amp;quot; and in the chapter &amp;quot;A simple GDB session&amp;quot; there is used a old m4
&lt;br&gt;&amp;gt; Version with the Bug.
&lt;br&gt;&amp;gt; So I thought if I can find such an old version I can copy the bugy code and
&lt;br&gt;&amp;gt; enable users of m4 to switch on a bugy m4 version for the GDB tutorial.
&lt;br&gt;&amp;gt; (like $:gdb -m4 --bugy)
&lt;/div&gt;&lt;br&gt;Yuck. &amp;nbsp;I do NOT want to _intentionally_ expose a memory corruption, even
&lt;br&gt;if it is by an undocumented option such as m4 ---buggy (the three dashes
&lt;br&gt;is not a typo; I prefer that all undocumented options have three dashes,
&lt;br&gt;so as not to interfere with long option abbreviations). &amp;nbsp;That is just
&lt;br&gt;asking for exploitation problems. &amp;nbsp;It would be MUCH better for gdb to
&lt;br&gt;update their manual with either a toy program, or something more modern
&lt;br&gt;(as that particular m4 bug was fixed prior to m4 1.4, which was released
&lt;br&gt;more than 15 years ago).
&lt;br&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; See this link:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://sourceware.org/gdb/current/onlinedocs/gdb/Sample-Session.html#Sample-Session&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://sourceware.org/gdb/current/onlinedocs/gdb/Sample-Session.html#Sample-Session&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;- --
&lt;br&gt;Don't work too hard, make some time for fun as well!
&lt;br&gt;&lt;br&gt;Eric Blake &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26487888&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ebb9@...&lt;/a&gt;
&lt;br&gt;-----BEGIN PGP SIGNATURE-----
&lt;br&gt;Version: GnuPG v1.4.9 (Cygwin)
&lt;br&gt;Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
&lt;br&gt;Comment: Using GnuPG with Mozilla - &lt;a href=&quot;http://enigmail.mozdev.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://enigmail.mozdev.org/&lt;/a&gt;&lt;br&gt;&lt;br&gt;iEYEARECAAYFAksKiOUACgkQ84KuGfSFAYC4fACffTdYpILB0HjNmDglOlSb8XWA
&lt;br&gt;8mQAnjLRvA68jqVip8g2BTeoaiQXgfs9
&lt;br&gt;=4Jfn
&lt;br&gt;-----END PGP SIGNATURE-----
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26487888&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A-m4-changequote-bug-tp26487888p26487888.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26367877</id>
	<title>Re: Problem of GDB interaction with interrupted system calls</title>
	<published>2009-11-15T23:39:04Z</published>
	<updated>2009-11-15T23:39:04Z</updated>
	<author>
		<name>teawater</name>
	</author>
	<content type="html">Sorry. &amp;nbsp;I cannot agree with it.
&lt;br&gt;&lt;br&gt;It make GDB not flexible.
&lt;br&gt;&lt;br&gt;Hui
&lt;br&gt;&lt;br&gt;On Fri, Nov 13, 2009 at 22:42, Alexandre Rusev &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26367877&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;arusev@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; teawater wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think this is a hehavior of kernel. &amp;nbsp;I think change pc always a
&lt;br&gt;&amp;gt; danger thing. &amp;nbsp;:)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Yes, extremely dangeorous! ;)
&lt;br&gt;&amp;gt; But GDB supports feature such as &amp;quot;call &amp;lt;func_name&amp;gt;&amp;quot;, when using it the Joe
&lt;br&gt;&amp;gt; user does not even cares the PC,
&lt;br&gt;&amp;gt; he just thinks that he makes call to some function...
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Moreover the intent of changing stack by kernel is to make system call to
&lt;br&gt;&amp;gt; restart.
&lt;br&gt;&amp;gt; The kernel (in theory) could choose to not return to userland at this point
&lt;br&gt;&amp;gt; (because of no signal handlers are set by the process)
&lt;br&gt;&amp;gt; and restart syscall internally.
&lt;br&gt;&amp;gt; If it where so, all the process could have been transparent for GDB.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; And this usecase is enounted quite often by users....:(
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Because the nature of the problem is quite clear, it could be (once &amp;quot;in
&lt;br&gt;&amp;gt; theory&amp;quot;) worked around both in kernel and in GDB.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Because the GDB does a lot of tricks and serves to thecnical puroses may be
&lt;br&gt;&amp;gt; it it the best place to implement workaround there?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Yet from point of view of kernel that's the place where either nobody (even
&lt;br&gt;&amp;gt; GDB) is supposed to intervien  the kernel internal
&lt;br&gt;&amp;gt; housekeeping, at least till the next machine instruction is executed.
&lt;br&gt;&amp;gt; So the kernel could either:
&lt;br&gt;&amp;gt; [1] not enable the GDB/ptrace to stop process and change user registers at
&lt;br&gt;&amp;gt; that point
&lt;br&gt;&amp;gt; [2] remember the state of essential registers (PC, may be others likes FP)
&lt;br&gt;&amp;gt; and revert all changes before executing the next instruction
&lt;br&gt;&amp;gt; [3] remember the state of essential registers (PC, may be others likes FP)
&lt;br&gt;&amp;gt; and if the process was stopped
&lt;br&gt;&amp;gt;      and somebody (GDB/ptrace) changed PC before execution of the next
&lt;br&gt;&amp;gt; instruction then kernel can avoid it's own changes of PC
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Anyway the problem exists and I'm trying at least to find out where needs to
&lt;br&gt;&amp;gt; be fixed
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; infrun: clear_proceed_status_thread (process 4542)
&lt;br&gt;&amp;gt; infrun: proceed (addr=0xffffffff, signal=144, step=0)
&lt;br&gt;&amp;gt; infrun: resume (step=0, signal=0), trap_expected=0
&lt;br&gt;&amp;gt; infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
&lt;br&gt;&amp;gt; infrun: target_wait (-1, status) =
&lt;br&gt;&amp;gt; infrun: &amp;nbsp; 4542 [process 4542],
&lt;br&gt;&amp;gt; infrun: &amp;nbsp; status-&amp;gt;kind = stopped, signal = SIGINT
&lt;br&gt;&amp;gt; infrun: infwait_normal_state
&lt;br&gt;&amp;gt; infrun: TARGET_WAITKIND_STOPPED
&lt;br&gt;&amp;gt; infrun: stop_pc = 0xb7fe3410
&lt;br&gt;&amp;gt; infrun: random signal 2
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Program received signal SIGINT, Interrupt.
&lt;br&gt;&amp;gt; infrun: stop_stepping
&lt;br&gt;&amp;gt; 0xb7fe3410 in __kernel_vsyscall ()
&lt;br&gt;&amp;gt; (gdb) disas
&lt;br&gt;&amp;gt; Dump of assembler code for function __kernel_vsyscall:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3400 &amp;lt;+0&amp;gt;:	push &amp;nbsp; %ecx
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3401 &amp;lt;+1&amp;gt;:	push &amp;nbsp; %edx
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3402 &amp;lt;+2&amp;gt;:	push &amp;nbsp; %ebp
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3403 &amp;lt;+3&amp;gt;:	mov &amp;nbsp; &amp;nbsp;%esp,%ebp
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3405 &amp;lt;+5&amp;gt;:	sysenter
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3407 &amp;lt;+7&amp;gt;:	nop
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3408 &amp;lt;+8&amp;gt;:	nop
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3409 &amp;lt;+9&amp;gt;:	nop
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe340a &amp;lt;+10&amp;gt;:	nop
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe340b &amp;lt;+11&amp;gt;:	nop
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe340c &amp;lt;+12&amp;gt;:	nop
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe340d &amp;lt;+13&amp;gt;:	nop
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe340e &amp;lt;+14&amp;gt;:	jmp &amp;nbsp; &amp;nbsp;0xb7fe3403 &amp;lt;__kernel_vsyscall+3&amp;gt;
&lt;br&gt;&amp;gt; =&amp;gt; 0xb7fe3410 &amp;lt;+16&amp;gt;:	pop &amp;nbsp; &amp;nbsp;%ebp
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3411 &amp;lt;+17&amp;gt;:	pop &amp;nbsp; &amp;nbsp;%edx
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3412 &amp;lt;+18&amp;gt;:	pop &amp;nbsp; &amp;nbsp;%ecx
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;0xb7fe3413 &amp;lt;+19&amp;gt;:	ret
&lt;br&gt;&amp;gt; End of assembler dump.
&lt;br&gt;&amp;gt; (gdb) p $pc
&lt;br&gt;&amp;gt; $1 = (void (*)()) 0xb7fe3410 &amp;lt;__kernel_vsyscall+16&amp;gt;
&lt;br&gt;&amp;gt; (gdb) p $pc=0xb7fe3413
&lt;br&gt;&amp;gt; $2 = (void (*)()) 0xb7fe3413 &amp;lt;__kernel_vsyscall+19&amp;gt;
&lt;br&gt;&amp;gt; (gdb) si
&lt;br&gt;&amp;gt; infrun: clear_proceed_status_thread (process 4542)
&lt;br&gt;&amp;gt; infrun: proceed (addr=0xffffffff, signal=144, step=1)
&lt;br&gt;&amp;gt; infrun: resume (step=1, signal=0), trap_expected=0
&lt;br&gt;&amp;gt; infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
&lt;br&gt;&amp;gt; infrun: target_wait (-1, status) =
&lt;br&gt;&amp;gt; infrun: &amp;nbsp; 4542 [process 4542],
&lt;br&gt;&amp;gt; infrun: &amp;nbsp; status-&amp;gt;kind = stopped, signal = SIGTRAP
&lt;br&gt;&amp;gt; infrun: infwait_normal_state
&lt;br&gt;&amp;gt; infrun: TARGET_WAITKIND_STOPPED
&lt;br&gt;&amp;gt; infrun: stop_pc = 0xb7fe3412
&lt;br&gt;&amp;gt; infrun: stepi/nexti
&lt;br&gt;&amp;gt; infrun: stop_stepping
&lt;br&gt;&amp;gt; 0xb7fe3412 in __kernel_vsyscall ()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Hui
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Nov 2, 7:27 pm, Alexandre Rusev &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26367877&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; teawater wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This signal ctrl-c will not really send to inferior.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; But the result is interrupted system call which is restarted then by kernel.
&lt;br&gt;&amp;gt; And is user changes program counter in GDB at this point,
&lt;br&gt;&amp;gt; then it takes place before the modification of PC is done by kernel.
&lt;br&gt;&amp;gt; The result is that execution jumps neither to the point the user said in
&lt;br&gt;&amp;gt; GDB nor
&lt;br&gt;&amp;gt; to the point the kernel wishes it be due to restart the syscall.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Is it incorrect behavior of GDB or incorrect behavior of kernel or
&lt;br&gt;&amp;gt; something else???
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; (gdb) help info handle
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Oct 31, 12:10 am, Alexandre Rusev &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26367877&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; When the program at ht end of message debugged under GDB is stopped with
&lt;br&gt;&amp;gt; Ctrl+C
&lt;br&gt;&amp;gt; it's usually found in interrupted system call. (The same result is
&lt;br&gt;&amp;gt; observed for x86 and PPC with kernels 2.6.18 and 2.6.28)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; (gdb) where
&lt;br&gt;&amp;gt; #0  0xb7fe2424 in __kernel_vsyscall ()
&lt;br&gt;&amp;gt; #1  0xb7f36ad0 in nanosleep () from /lib/libc.so.6
&lt;br&gt;&amp;gt; #2  0xb7f3690e in sleep () from /lib/libc.so.6
&lt;br&gt;&amp;gt; #3  0x08048600 in qqq () at testBT2.c:45
&lt;br&gt;&amp;gt; #4  0x080487a5 in eee () at testBT2.c:73
&lt;br&gt;&amp;gt; #5  0x0804846a in main () at testBT2.c:17
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The PC is pointing at the next instruction, accordingly to GDB.
&lt;br&gt;&amp;gt; But the kernel tries to restart syscall by means of changing PC to PC-4
&lt;br&gt;&amp;gt; (in case of PowerPC and to some other value for x86)
&lt;br&gt;&amp;gt; and it does it's change to PC after the user continues execution of
&lt;br&gt;&amp;gt; program in GDB with &amp;quot;cont&amp;quot; or &amp;quot;si&amp;quot; command.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The issue is that if user changed PC at this point or uses &amp;quot;call
&lt;br&gt;&amp;gt; &amp;lt;func_name&amp;gt;&amp;quot; GDB command, the both changes to PC
&lt;br&gt;&amp;gt; are added (as kernel uses PC relative change i.e. PC - 4), and the
&lt;br&gt;&amp;gt; program continues execution at absolutely wrong place.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The issue may be gracefully observed if breakpoint is set just before
&lt;br&gt;&amp;gt; &amp;lt;func_name&amp;gt; and then PC is changed to the &amp;lt;func_name&amp;gt; address.
&lt;br&gt;&amp;gt; In such case the breakpoint is hit while it must not be.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; #include &amp;lt;stdio.h&amp;gt;
&lt;br&gt;&amp;gt; #include &amp;lt;stdlib.h&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void qqq();
&lt;br&gt;&amp;gt; void www();
&lt;br&gt;&amp;gt; void eee();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void * xrealloc(void*, int);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; int main(void)
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt;         eee();
&lt;br&gt;&amp;gt;     return EXIT_SUCCESS;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void qqq() {
&lt;br&gt;&amp;gt;     void *a[256];
&lt;br&gt;&amp;gt;     size_t i, n;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i] = malloc(n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i - 1] = xrealloc(a[i - 1], n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;gt;         free(a[i]);
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;gt;         free(a[i - 1]);
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void www() {
&lt;br&gt;&amp;gt;     void *a[256];
&lt;br&gt;&amp;gt;     size_t i, n;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i] = malloc(n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i - 1] = realloc(a[i - 1], n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;gt;         free(a[i]);
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;gt;         free(a[i - 1]);
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void eee() {
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;         while (1) {
&lt;br&gt;&amp;gt;                 qqq();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;                 www();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;         }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void * xrealloc(void* addr, int n) {
&lt;br&gt;&amp;gt;         return realloc(addr, n);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; bug-gdb mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26367877&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-...@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26367877&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-of-GDB-interaction-with-interrupted-system-calls-tp26133291p26367877.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26337638</id>
	<title>Re: Problem of GDB interaction with interrupted system calls</title>
	<published>2009-11-13T06:42:48Z</published>
	<updated>2009-11-13T06:42:48Z</updated>
	<author>
		<name>Alexandre Rusev</name>
	</author>
	<content type="html">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta content=&quot;text/html;charset=ISO-8859-1&quot; http-equiv=&quot;Content-Type&quot;&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot;&gt;
teawater wrote:
&lt;blockquote cite=&quot;mid796f72e5-4d84-4282-9dfb-46af789014c9@a31g2000yqn.googlegroups.com&quot; type=&quot;cite&quot;&gt;
  &lt;pre wrap=&quot;&quot;&gt;I think this is a hehavior of kernel.  I think change pc always a
danger thing.  :)
  &lt;/pre&gt;
&lt;/blockquote&gt;
Yes, extremely dangeorous! ;)&lt;br&gt;
But GDB supports feature such as &quot;call &amp;lt;func_name&amp;gt;&quot;, when using
it the Joe user does not even cares the PC,&lt;br&gt;
he just thinks that he makes call to some function...&lt;br&gt;
&lt;br&gt;
Moreover the intent of changing stack by kernel is to make system call
to restart.&lt;br&gt;
The kernel (in theory) could choose to not return to userland at this
point (because of no signal handlers are set by the process)&lt;br&gt;
and restart syscall internally.&lt;br&gt;
If it where so, all the process could have been transparent for GDB.&lt;br&gt;
&lt;br&gt;
And this usecase is enounted quite often by users....:(&lt;br&gt;
&lt;br&gt;
Because the nature of the problem is quite clear, it could be (once &quot;in
theory&quot;) worked around both in kernel and in GDB.&lt;br&gt;
&lt;br&gt;
Because the GDB does a lot of tricks and serves to thecnical puroses
may be it it the best place to implement workaround there?&lt;br&gt;
&lt;br&gt;
Yet from point of view of kernel that's the place where either nobody
(even GDB) is supposed to intervien&amp;nbsp; the kernel internal&lt;br&gt;
housekeeping, at least till the next machine instruction is executed.&lt;br&gt;
So the kernel could either:&lt;br&gt;
[1] not enable the GDB/ptrace to stop process and change user registers
at that point&lt;br&gt;
[2] remember the state of essential registers (PC, may be others likes
FP) and revert all changes before executing the next instruction&lt;br&gt;
[3] remember the state of essential registers (PC, may be others likes
FP)&amp;nbsp; and if the process was stopped&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and somebody (GDB/ptrace) changed PC before execution of the next
instruction then kernel can avoid it's own changes of PC&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Anyway the problem exists and I'm trying at least to find out where
needs to be fixed&lt;br&gt;
&lt;blockquote cite=&quot;mid796f72e5-4d84-4282-9dfb-46af789014c9@a31g2000yqn.googlegroups.com&quot; type=&quot;cite&quot;&gt;
  &lt;pre wrap=&quot;&quot;&gt;

infrun: clear_proceed_status_thread (process 4542)
infrun: proceed (addr=0xffffffff, signal=144, step=0)
infrun: resume (step=0, signal=0), trap_expected=0
infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
infrun: target_wait (-1, status) =
infrun:   4542 [process 4542],
infrun:   status-&amp;gt;kind = stopped, signal = SIGINT
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0xb7fe3410
infrun: random signal 2

Program received signal SIGINT, Interrupt.
infrun: stop_stepping
0xb7fe3410 in __kernel_vsyscall ()
(gdb) disas
Dump of assembler code for function __kernel_vsyscall:
   0xb7fe3400 &amp;lt;+0&amp;gt;:	push   %ecx
   0xb7fe3401 &amp;lt;+1&amp;gt;:	push   %edx
   0xb7fe3402 &amp;lt;+2&amp;gt;:	push   %ebp
   0xb7fe3403 &amp;lt;+3&amp;gt;:	mov    %esp,%ebp
   0xb7fe3405 &amp;lt;+5&amp;gt;:	sysenter
   0xb7fe3407 &amp;lt;+7&amp;gt;:	nop
   0xb7fe3408 &amp;lt;+8&amp;gt;:	nop
   0xb7fe3409 &amp;lt;+9&amp;gt;:	nop
   0xb7fe340a &amp;lt;+10&amp;gt;:	nop
   0xb7fe340b &amp;lt;+11&amp;gt;:	nop
   0xb7fe340c &amp;lt;+12&amp;gt;:	nop
   0xb7fe340d &amp;lt;+13&amp;gt;:	nop
   0xb7fe340e &amp;lt;+14&amp;gt;:	jmp    0xb7fe3403 &amp;lt;__kernel_vsyscall+3&amp;gt;
=&amp;gt; 0xb7fe3410 &amp;lt;+16&amp;gt;:	pop    %ebp
   0xb7fe3411 &amp;lt;+17&amp;gt;:	pop    %edx
   0xb7fe3412 &amp;lt;+18&amp;gt;:	pop    %ecx
   0xb7fe3413 &amp;lt;+19&amp;gt;:	ret
End of assembler dump.
(gdb) p $pc
$1 = (void (*)()) 0xb7fe3410 &amp;lt;__kernel_vsyscall+16&amp;gt;
(gdb) p $pc=0xb7fe3413
$2 = (void (*)()) 0xb7fe3413 &amp;lt;__kernel_vsyscall+19&amp;gt;
(gdb) si
infrun: clear_proceed_status_thread (process 4542)
infrun: proceed (addr=0xffffffff, signal=144, step=1)
infrun: resume (step=1, signal=0), trap_expected=0
infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
infrun: target_wait (-1, status) =
infrun:   4542 [process 4542],
infrun:   status-&amp;gt;kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0xb7fe3412
infrun: stepi/nexti
infrun: stop_stepping
0xb7fe3412 in __kernel_vsyscall ()

Thanks,
Hui



On Nov 2, 7:27&amp;nbsp;pm, Alexandre Rusev &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26337638&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt; wrote:
  &lt;/pre&gt;
  &lt;blockquote type=&quot;cite&quot;&gt;
    &lt;pre wrap=&quot;&quot;&gt;teawater wrote:
    &lt;/pre&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;pre wrap=&quot;&quot;&gt;This signal ctrl-c will not really send to inferior.
      &lt;/pre&gt;
    &lt;/blockquote&gt;
    &lt;pre wrap=&quot;&quot;&gt;But the result is interrupted system call which is restarted then by kernel.
And is user changes program counter in GDB at this point,
then it takes place before the modification of PC is done by kernel.
The result is that execution jumps neither to the point the user said in
GDB nor
to the point the kernel wishes it be due to restart the syscall.

Is it incorrect behavior of GDB or incorrect behavior of kernel or
something else???

    &lt;/pre&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;pre wrap=&quot;&quot;&gt;(gdb) help info handle
      &lt;/pre&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;pre wrap=&quot;&quot;&gt;On Oct 31, 12:10 am, Alexandre Rusev &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26337638&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt; wrote:
      &lt;/pre&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;Hi.
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;When the program at ht end of message debugged under GDB is stopped with
Ctrl+C
it's usually found in interrupted system call. (The same result is
observed for x86 and PPC with kernels 2.6.18 and 2.6.28)
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;(gdb) where
#0 &amp;nbsp;0xb7fe2424 in __kernel_vsyscall ()
#1 &amp;nbsp;0xb7f36ad0 in nanosleep () from /lib/libc.so.6
#2 &amp;nbsp;0xb7f3690e in sleep () from /lib/libc.so.6
#3 &amp;nbsp;0x08048600 in qqq () at testBT2.c:45
#4 &amp;nbsp;0x080487a5 in eee () at testBT2.c:73
#5 &amp;nbsp;0x0804846a in main () at testBT2.c:17
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;The PC is pointing at the next instruction, accordingly to GDB.
But the kernel tries to restart syscall by means of changing PC to PC-4
(in case of PowerPC and to some other value for x86)
and it does it's change to PC after the user continues execution of
program in GDB with &quot;cont&quot; or &quot;si&quot; command.
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;The issue is that if user changed PC at this point or uses &quot;call
&amp;lt;func_name&amp;gt;&quot; GDB command, the both changes to PC
are added (as kernel uses PC relative change i.e. PC - 4), and the
program continues execution at absolutely wrong place.
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;The issue may be gracefully observed if breakpoint is set just before
&amp;lt;func_name&amp;gt; and then PC is changed to the &amp;lt;func_name&amp;gt; address.
In such case the breakpoint is hit while it must not be.
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;void qqq();
void www();
void eee();
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;void * xrealloc(void*, int);
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;int main(void)
{
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; eee();
&amp;nbsp; &amp;nbsp; return EXIT_SUCCESS;
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;}
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;void qqq() {
&amp;nbsp; &amp;nbsp; void *a[256];
&amp;nbsp; &amp;nbsp; size_t i, n;
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i++)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i] = malloc(n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i--)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i - 1] = xrealloc(a[i - 1], n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; sleep(1);
&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i += 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i]);
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i -= 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i - 1]);
&amp;nbsp; &amp;nbsp; sleep(1);
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;}
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;void www() {
&amp;nbsp; &amp;nbsp; void *a[256];
&amp;nbsp; &amp;nbsp; size_t i, n;
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i++)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i] = malloc(n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i--)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i - 1] = realloc(a[i - 1], n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; sleep(1);
&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i += 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i]);
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i -= 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i - 1]);
&amp;nbsp; &amp;nbsp; sleep(1);
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;}
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;void eee() {
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (1) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; qqq();
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www();
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;}
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;void * xrealloc(void* addr, int n) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return realloc(addr, n);
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;blockquote type=&quot;cite&quot;&gt;
        &lt;pre wrap=&quot;&quot;&gt;}
        &lt;/pre&gt;
      &lt;/blockquote&gt;
    &lt;/blockquote&gt;
    &lt;blockquote type=&quot;cite&quot;&gt;
      &lt;pre wrap=&quot;&quot;&gt;_______________________________________________
bug-gdb mailing list
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26337638&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-...@...&lt;/a&gt;
&lt;a class=&quot;moz-txt-link-freetext&quot; href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;
      &lt;/pre&gt;
    &lt;/blockquote&gt;
  &lt;/blockquote&gt;
  &lt;pre wrap=&quot;&quot;&gt;&lt;!----&gt;
  &lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26337638&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-of-GDB-interaction-with-interrupted-system-calls-tp26133291p26337638.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26332102</id>
	<title>Re: Problem of GDB interaction with interrupted system calls</title>
	<published>2009-11-12T21:48:09Z</published>
	<updated>2009-11-12T21:48:09Z</updated>
	<author>
		<name>teawater</name>
	</author>
	<content type="html">I think this is a hehavior of kernel. &amp;nbsp;I think change pc always a
&lt;br&gt;danger thing. &amp;nbsp;:)
&lt;br&gt;&lt;br&gt;&lt;br&gt;infrun: clear_proceed_status_thread (process 4542)
&lt;br&gt;infrun: proceed (addr=0xffffffff, signal=144, step=0)
&lt;br&gt;infrun: resume (step=0, signal=0), trap_expected=0
&lt;br&gt;infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
&lt;br&gt;infrun: target_wait (-1, status) =
&lt;br&gt;infrun: &amp;nbsp; 4542 [process 4542],
&lt;br&gt;infrun: &amp;nbsp; status-&amp;gt;kind = stopped, signal = SIGINT
&lt;br&gt;infrun: infwait_normal_state
&lt;br&gt;infrun: TARGET_WAITKIND_STOPPED
&lt;br&gt;infrun: stop_pc = 0xb7fe3410
&lt;br&gt;infrun: random signal 2
&lt;br&gt;&lt;br&gt;Program received signal SIGINT, Interrupt.
&lt;br&gt;infrun: stop_stepping
&lt;br&gt;0xb7fe3410 in __kernel_vsyscall ()
&lt;br&gt;(gdb) disas
&lt;br&gt;Dump of assembler code for function __kernel_vsyscall:
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3400 &amp;lt;+0&amp;gt;:	push &amp;nbsp; %ecx
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3401 &amp;lt;+1&amp;gt;:	push &amp;nbsp; %edx
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3402 &amp;lt;+2&amp;gt;:	push &amp;nbsp; %ebp
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3403 &amp;lt;+3&amp;gt;:	mov &amp;nbsp; &amp;nbsp;%esp,%ebp
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3405 &amp;lt;+5&amp;gt;:	sysenter
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3407 &amp;lt;+7&amp;gt;:	nop
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3408 &amp;lt;+8&amp;gt;:	nop
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3409 &amp;lt;+9&amp;gt;:	nop
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe340a &amp;lt;+10&amp;gt;:	nop
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe340b &amp;lt;+11&amp;gt;:	nop
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe340c &amp;lt;+12&amp;gt;:	nop
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe340d &amp;lt;+13&amp;gt;:	nop
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe340e &amp;lt;+14&amp;gt;:	jmp &amp;nbsp; &amp;nbsp;0xb7fe3403 &amp;lt;__kernel_vsyscall+3&amp;gt;
&lt;br&gt;=&amp;gt; 0xb7fe3410 &amp;lt;+16&amp;gt;:	pop &amp;nbsp; &amp;nbsp;%ebp
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3411 &amp;lt;+17&amp;gt;:	pop &amp;nbsp; &amp;nbsp;%edx
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3412 &amp;lt;+18&amp;gt;:	pop &amp;nbsp; &amp;nbsp;%ecx
&lt;br&gt;&amp;nbsp; &amp;nbsp;0xb7fe3413 &amp;lt;+19&amp;gt;:	ret
&lt;br&gt;End of assembler dump.
&lt;br&gt;(gdb) p $pc
&lt;br&gt;$1 = (void (*)()) 0xb7fe3410 &amp;lt;__kernel_vsyscall+16&amp;gt;
&lt;br&gt;(gdb) p $pc=0xb7fe3413
&lt;br&gt;$2 = (void (*)()) 0xb7fe3413 &amp;lt;__kernel_vsyscall+19&amp;gt;
&lt;br&gt;(gdb) si
&lt;br&gt;infrun: clear_proceed_status_thread (process 4542)
&lt;br&gt;infrun: proceed (addr=0xffffffff, signal=144, step=1)
&lt;br&gt;infrun: resume (step=1, signal=0), trap_expected=0
&lt;br&gt;infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
&lt;br&gt;infrun: target_wait (-1, status) =
&lt;br&gt;infrun: &amp;nbsp; 4542 [process 4542],
&lt;br&gt;infrun: &amp;nbsp; status-&amp;gt;kind = stopped, signal = SIGTRAP
&lt;br&gt;infrun: infwait_normal_state
&lt;br&gt;infrun: TARGET_WAITKIND_STOPPED
&lt;br&gt;infrun: stop_pc = 0xb7fe3412
&lt;br&gt;infrun: stepi/nexti
&lt;br&gt;infrun: stop_stepping
&lt;br&gt;0xb7fe3412 in __kernel_vsyscall ()
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Hui
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Nov 2, 7:27 pm, Alexandre Rusev &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26332102&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; teawater wrote:
&lt;br&gt;&amp;gt; &amp;gt; This signal ctrl-c will not really send to inferior.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; But the result is interrupted system call which is restarted then by kernel.
&lt;br&gt;&amp;gt; And is user changes program counter in GDB at this point,
&lt;br&gt;&amp;gt; then it takes place before the modification of PC is done by kernel.
&lt;br&gt;&amp;gt; The result is that execution jumps neither to the point the user said in
&lt;br&gt;&amp;gt; GDB nor
&lt;br&gt;&amp;gt; to the point the kernel wishes it be due to restart the syscall.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Is it incorrect behavior of GDB or incorrect behavior of kernel or
&lt;br&gt;&amp;gt; something else???
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; (gdb) help info handle
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; On Oct 31, 12:10 am, Alexandre Rusev &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26332102&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; When the program at ht end of message debugged under GDB is stopped with
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Ctrl+C
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; it's usually found in interrupted system call. (The same result is
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; observed for x86 and PPC with kernels 2.6.18 and 2.6.28)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; (gdb) where
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #0  0xb7fe2424 in __kernel_vsyscall ()
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #1  0xb7f36ad0 in nanosleep () from /lib/libc.so.6
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #2  0xb7f3690e in sleep () from /lib/libc.so.6
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #3  0x08048600 in qqq () at testBT2.c:45
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #4  0x080487a5 in eee () at testBT2.c:73
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #5  0x0804846a in main () at testBT2.c:17
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; The PC is pointing at the next instruction, accordingly to GDB.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; But the kernel tries to restart syscall by means of changing PC to PC-4
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; (in case of PowerPC and to some other value for x86)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; and it does it's change to PC after the user continues execution of
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; program in GDB with &amp;quot;cont&amp;quot; or &amp;quot;si&amp;quot; command.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; The issue is that if user changed PC at this point or uses &amp;quot;call
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;lt;func_name&amp;gt;&amp;quot; GDB command, the both changes to PC
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; are added (as kernel uses PC relative change i.e. PC - 4), and the
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; program continues execution at absolutely wrong place.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; The issue may be gracefully observed if breakpoint is set just before
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;lt;func_name&amp;gt; and then PC is changed to the &amp;lt;func_name&amp;gt; address.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; In such case the breakpoint is hit while it must not be.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #include &amp;lt;stdio.h&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; #include &amp;lt;stdlib.h&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void qqq();
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void www();
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void eee();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void * xrealloc(void*, int);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; int main(void)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         eee();
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     return EXIT_SUCCESS;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void qqq() {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     void *a[256];
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     size_t i, n;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         a[i] = malloc(n);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         a[i - 1] = xrealloc(a[i - 1], n);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         free(a[i]);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         free(a[i - 1]);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void www() {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     void *a[256];
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     size_t i, n;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         a[i] = malloc(n);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         a[i - 1] = realloc(a[i - 1], n);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         free(a[i]);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         free(a[i - 1]);
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void eee() {
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         while (1) {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;                 qqq();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;                 www();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; void * xrealloc(void* addr, int n) {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;         return realloc(addr, n);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; &amp;gt; bug-gdb mailing list
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26332102&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-...@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26332102&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-of-GDB-interaction-with-interrupted-system-calls-tp26133291p26332102.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26343124</id>
	<title>GDB debugging for a big c language project.</title>
	<published>2009-11-11T05:05:36Z</published>
	<updated>2009-11-11T05:05:36Z</updated>
	<author>
		<name>eesyli</name>
	</author>
	<content type="html">Now I have a project which include three directories **/bin**, **/
&lt;br&gt;inc** and **/src**.
&lt;br&gt;All of header files (*.h) are included in **/inc** and all of source
&lt;br&gt;(*.c) files are stored in **/src**, i.e. a.c, b.c, c.c..., the final
&lt;br&gt;generated executable file will locate in /bin.
&lt;br&gt;&lt;br&gt;after compling with makefile, all of obj files will be generated in **/
&lt;br&gt;src/obj** like a.o, b.o, c.o, d....! Moreover an final.exe executable
&lt;br&gt;file will be generated in the **/bin** directory.
&lt;br&gt;&lt;br&gt;Now if I want to debug it with GDB, how can I do it???
&lt;br&gt;&lt;br&gt;To debug those obj files in /src/obj? or somewhat else?
&lt;br&gt;&lt;br&gt;Many thanks for the kind help!
&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26343124&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/GDB-debugging-for-a-big-c-language-project.-tp26343124p26343124.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26162373</id>
	<title>Re: Problem of GDB interaction with interrupted system calls</title>
	<published>2009-11-02T03:27:59Z</published>
	<updated>2009-11-02T03:27:59Z</updated>
	<author>
		<name>Alexandre Rusev</name>
	</author>
	<content type="html">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta content=&quot;text/html;charset=ISO-8859-1&quot; http-equiv=&quot;Content-Type&quot;&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot;&gt;
teawater wrote:
&lt;blockquote cite=&quot;mid19ff1afc-b27e-4715-a113-dde9929294bf@x25g2000prf.googlegroups.com&quot; type=&quot;cite&quot;&gt;
  &lt;pre wrap=&quot;&quot;&gt;This signal ctrl-c will not really send to inferior.
  &lt;/pre&gt;
&lt;/blockquote&gt;
But the result is interrupted system call which is restarted then by
kernel.&lt;br&gt;
And is user changes program counter in GDB at this point,&lt;br&gt;
then it takes place before the modification of PC is done by kernel.&lt;br&gt;
The result is that execution jumps neither to the point the user said
in GDB nor&lt;br&gt;
to the point the kernel wishes it be due to restart the syscall.&lt;br&gt;
&lt;br&gt;
Is it incorrect behavior of GDB or incorrect behavior of kernel or
something else???&lt;br&gt;
&lt;br&gt;
&lt;blockquote cite=&quot;mid19ff1afc-b27e-4715-a113-dde9929294bf@x25g2000prf.googlegroups.com&quot; type=&quot;cite&quot;&gt;
  &lt;pre wrap=&quot;&quot;&gt;
(gdb) help info handle

On Oct 31, 12:10&amp;nbsp;am, Alexandre Rusev &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26162373&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt; wrote:
  &lt;/pre&gt;
  &lt;blockquote type=&quot;cite&quot;&gt;
    &lt;pre wrap=&quot;&quot;&gt;Hi.

When the program at ht end of message debugged under GDB is stopped with
Ctrl+C
it's usually found in interrupted system call. (The same result is
observed for x86 and PPC with kernels 2.6.18 and 2.6.28)

(gdb) where
#0 &amp;nbsp;0xb7fe2424 in __kernel_vsyscall ()
#1 &amp;nbsp;0xb7f36ad0 in nanosleep () from /lib/libc.so.6
#2 &amp;nbsp;0xb7f3690e in sleep () from /lib/libc.so.6
#3 &amp;nbsp;0x08048600 in qqq () at testBT2.c:45
#4 &amp;nbsp;0x080487a5 in eee () at testBT2.c:73
#5 &amp;nbsp;0x0804846a in main () at testBT2.c:17

The PC is pointing at the next instruction, accordingly to GDB.
But the kernel tries to restart syscall by means of changing PC to PC-4
(in case of PowerPC and to some other value for x86)
and it does it's change to PC after the user continues execution of
program in GDB with &quot;cont&quot; or &quot;si&quot; command.

The issue is that if user changed PC at this point or uses &quot;call
&amp;lt;func_name&amp;gt;&quot; GDB command, the both changes to PC
are added (as kernel uses PC relative change i.e. PC - 4), and the
program continues execution at absolutely wrong place.

The issue may be gracefully observed if breakpoint is set just before
&amp;lt;func_name&amp;gt; and then PC is changed to the &amp;lt;func_name&amp;gt; address.
In such case the breakpoint is hit while it must not be.

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

void qqq();
void www();
void eee();

void * xrealloc(void*, int);

int main(void)
{
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; eee();
&amp;nbsp; &amp;nbsp; return EXIT_SUCCESS;

}

void qqq() {
&amp;nbsp; &amp;nbsp; void *a[256];
&amp;nbsp; &amp;nbsp; size_t i, n;

&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i++)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i] = malloc(n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i--)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i - 1] = xrealloc(a[i - 1], n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; sleep(1);
&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i += 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i]);
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i -= 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i - 1]);
&amp;nbsp; &amp;nbsp; sleep(1);

}

void www() {
&amp;nbsp; &amp;nbsp; void *a[256];
&amp;nbsp; &amp;nbsp; size_t i, n;

&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i++)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i] = malloc(n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i--)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i - 1] = realloc(a[i - 1], n);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; sleep(1);
&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i += 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i]);
&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i -= 2)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i - 1]);
&amp;nbsp; &amp;nbsp; sleep(1);

}

void eee() {

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (1) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; qqq();

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www();

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }

}

void * xrealloc(void* addr, int n) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return realloc(addr, n);

}
    &lt;/pre&gt;
  &lt;/blockquote&gt;
  &lt;pre wrap=&quot;&quot;&gt;&lt;!----&gt;
_______________________________________________
bug-gdb mailing list
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26162373&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;a class=&quot;moz-txt-link-freetext&quot; href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;
  &lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26162373&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-of-GDB-interaction-with-interrupted-system-calls-tp26133291p26162373.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26158753</id>
	<title>Re: Problem of GDB interaction with interrupted system calls</title>
	<published>2009-11-01T01:51:10Z</published>
	<updated>2009-11-01T01:51:10Z</updated>
	<author>
		<name>teawater</name>
	</author>
	<content type="html">This signal ctrl-c will not really send to inferior.
&lt;br&gt;&lt;br&gt;(gdb) help info handle
&lt;br&gt;&lt;br&gt;On Oct 31, 12:10 am, Alexandre Rusev &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158753&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aru...@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; When the program at ht end of message debugged under GDB is stopped with
&lt;br&gt;&amp;gt; Ctrl+C
&lt;br&gt;&amp;gt; it's usually found in interrupted system call. (The same result is
&lt;br&gt;&amp;gt; observed for x86 and PPC with kernels 2.6.18 and 2.6.28)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; (gdb) where
&lt;br&gt;&amp;gt; #0  0xb7fe2424 in __kernel_vsyscall ()
&lt;br&gt;&amp;gt; #1  0xb7f36ad0 in nanosleep () from /lib/libc.so.6
&lt;br&gt;&amp;gt; #2  0xb7f3690e in sleep () from /lib/libc.so.6
&lt;br&gt;&amp;gt; #3  0x08048600 in qqq () at testBT2.c:45
&lt;br&gt;&amp;gt; #4  0x080487a5 in eee () at testBT2.c:73
&lt;br&gt;&amp;gt; #5  0x0804846a in main () at testBT2.c:17
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The PC is pointing at the next instruction, accordingly to GDB.
&lt;br&gt;&amp;gt; But the kernel tries to restart syscall by means of changing PC to PC-4
&lt;br&gt;&amp;gt; (in case of PowerPC and to some other value for x86)
&lt;br&gt;&amp;gt; and it does it's change to PC after the user continues execution of
&lt;br&gt;&amp;gt; program in GDB with &amp;quot;cont&amp;quot; or &amp;quot;si&amp;quot; command.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The issue is that if user changed PC at this point or uses &amp;quot;call
&lt;br&gt;&amp;gt; &amp;lt;func_name&amp;gt;&amp;quot; GDB command, the both changes to PC
&lt;br&gt;&amp;gt; are added (as kernel uses PC relative change i.e. PC - 4), and the
&lt;br&gt;&amp;gt; program continues execution at absolutely wrong place.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The issue may be gracefully observed if breakpoint is set just before
&lt;br&gt;&amp;gt; &amp;lt;func_name&amp;gt; and then PC is changed to the &amp;lt;func_name&amp;gt; address.
&lt;br&gt;&amp;gt; In such case the breakpoint is hit while it must not be.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; #include &amp;lt;stdio.h&amp;gt;
&lt;br&gt;&amp;gt; #include &amp;lt;stdlib.h&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void qqq();
&lt;br&gt;&amp;gt; void www();
&lt;br&gt;&amp;gt; void eee();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void * xrealloc(void*, int);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; int main(void)
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt;         eee();
&lt;br&gt;&amp;gt;     return EXIT_SUCCESS;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void qqq() {
&lt;br&gt;&amp;gt;     void *a[256];
&lt;br&gt;&amp;gt;     size_t i, n;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i] = malloc(n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i - 1] = xrealloc(a[i - 1], n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;gt;         free(a[i]);
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;gt;         free(a[i - 1]);
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void www() {
&lt;br&gt;&amp;gt;     void *a[256];
&lt;br&gt;&amp;gt;     size_t i, n;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i] = malloc(n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;gt;     {
&lt;br&gt;&amp;gt;         n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;gt;         a[i - 1] = realloc(a[i - 1], n);
&lt;br&gt;&amp;gt;     }
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;     for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;gt;         free(a[i]);
&lt;br&gt;&amp;gt;     for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;gt;         free(a[i - 1]);
&lt;br&gt;&amp;gt;     sleep(1);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void eee() {
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;         while (1) {
&lt;br&gt;&amp;gt;                 qqq();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;                 www();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;         }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; void * xrealloc(void* addr, int n) {
&lt;br&gt;&amp;gt;         return realloc(addr, n);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; }
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158753&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-of-GDB-interaction-with-interrupted-system-calls-tp26133291p26158753.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26158750</id>
	<title>Re: GDB 7's process record/replay &amp; BDW-GC</title>
	<published>2009-10-31T00:47:16Z</published>
	<updated>2009-10-31T00:47:16Z</updated>
	<author>
		<name>teawater</name>
	</author>
	<content type="html">&lt;a href=&quot;http://sourceware.org/gdb/wiki/ProcessRecord&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://sourceware.org/gdb/wiki/ProcessRecord&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Oct 30, 5:47 am, &amp;quot;Boehm, Hans&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hans.bo...@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; There may be an easy GC-specific workaound, int that you can probably build it with -DNO_GETCONTEXT.  Or you might be able to link statically against libc?  But this doesn't sound like this will be the last such problem.  It sounds to me like these things really need to get fixed in gdb.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hans
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; -----Original Message-----
&lt;br&gt;&amp;gt; &amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc-boun...@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc-boun...@...&lt;/a&gt;] On Behalf Of Ludovic Courtès
&lt;br&gt;&amp;gt; &amp;gt; Sent: Wednesday, October 28, 2009 3:54 PM
&lt;br&gt;&amp;gt; &amp;gt; To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;g...@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt; Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-...@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt; Subject: [Gc] Re: GDB 7's process record/replay &amp; BDW-GC
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;l...@...&lt;/a&gt; (Ludovic Courtès) writes:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Process record doesn't support instruction 0xf6e at address
&lt;br&gt;&amp;gt; &amp;gt; 0x7ffff789f2f2.
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Process record: failed to record execution log.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; Program received signal SIGTRAP, Trace/breakpoint trap.
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; 0x00007ffff789f2f0 in memset () from
&lt;br&gt;&amp;gt; &amp;gt; &amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; I should have started with that: a web search shows that it's
&lt;br&gt;&amp;gt; &amp;gt; a known issue, not specific to libgc:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;  &lt;a href=&quot;http://sources.redhat.com/bugzilla/show_bug.cgi?id=10743&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://sources.redhat.com/bugzilla/show_bug.cgi?id=10743&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;gt;  &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550710&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550710&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; The suggested workaround allows it to go a bit further:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; --8&amp;lt;---------------cut here---------------start-------------&amp;gt;8---
&lt;br&gt;&amp;gt; &amp;gt; Breakpoint 1, main (argc=1, argv=0x7fffffffc8e8) at ,,t.c:6
&lt;br&gt;&amp;gt; &amp;gt; 6         GC_INIT ();
&lt;br&gt;&amp;gt; &amp;gt; (gdb) set __x86_64_preferred_memory_instruction=0
&lt;br&gt;&amp;gt; &amp;gt; (gdb) record
&lt;br&gt;&amp;gt; &amp;gt; (gdb) n
&lt;br&gt;&amp;gt; &amp;gt; warning: Process record ignores the memory change of
&lt;br&gt;&amp;gt; &amp;gt; instruction at address 0x7ffff7612e5a because it can't get
&lt;br&gt;&amp;gt; &amp;gt; the value of the segment register.
&lt;br&gt;&amp;gt; &amp;gt; warning: Process record ignores the memory change of
&lt;br&gt;&amp;gt; &amp;gt; instruction at address 0x7ffff784e8c3 because it can't get
&lt;br&gt;&amp;gt; &amp;gt; the value of the segment register.
&lt;br&gt;&amp;gt; &amp;gt; Process record doesn't support instruction 0xfae at address
&lt;br&gt;&amp;gt; &amp;gt; 0x7ffff7862c00.
&lt;br&gt;&amp;gt; &amp;gt; Process record: failed to record execution log.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Program received signal SIGTRAP, Trace/breakpoint trap.
&lt;br&gt;&amp;gt; &amp;gt; 0x00007ffff7862c00 in getcontext () from
&lt;br&gt;&amp;gt; &amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; &amp;gt; (gdb) bt
&lt;br&gt;&amp;gt; &amp;gt; #0  0x00007ffff7862c00 in getcontext () from
&lt;br&gt;&amp;gt; &amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; &amp;gt; #1  0x00007ffff7b96cfa in GC_with_callee_saves_pushed
&lt;br&gt;&amp;gt; &amp;gt; (fn=&amp;lt;value optimized out&amp;gt;, arg=0x7fffffffc73c &amp;quot;&amp;quot;) at ../mach_dep.c:194
&lt;br&gt;&amp;gt; &amp;gt; #2  0x00007ffff7b8e795 in GC_push_roots (all=&amp;lt;value optimized
&lt;br&gt;&amp;gt; &amp;gt; out&amp;gt;, cold_gc_frame=0x7fffffffc73c &amp;quot;&amp;quot;) at ../mark_rts.c:790
&lt;br&gt;&amp;gt; &amp;gt; #3  0x00007ffff7b8df0c in GC_mark_some
&lt;br&gt;&amp;gt; &amp;gt; (cold_gc_frame=0x7fffffffc73c &amp;quot;&amp;quot;) at ../mark.c:359
&lt;br&gt;&amp;gt; &amp;gt; #4  0x00007ffff7b853f8 in GC_stopped_mark
&lt;br&gt;&amp;gt; &amp;gt; (stop_func=0x7ffff7b846d0 &amp;lt;GC_never_stop_func&amp;gt;) at ../alloc.c:602
&lt;br&gt;&amp;gt; &amp;gt; #5  0x00007ffff7b8568d in GC_try_to_collect_inner
&lt;br&gt;&amp;gt; &amp;gt; (stop_func=0x7ffff7b846d0 &amp;lt;GC_never_stop_func&amp;gt;) at ../alloc.c:421
&lt;br&gt;&amp;gt; &amp;gt; #6  0x00007ffff7b905c2 in GC_init () at ../misc.c:843
&lt;br&gt;&amp;gt; &amp;gt; #7  0x0000000000400788 in main (argc=1, argv=0x7fffffffc8e8)
&lt;br&gt;&amp;gt; &amp;gt; at ,,t.c:6 --8&amp;lt;---------------cut
&lt;br&gt;&amp;gt; &amp;gt; here---------------end---------------&amp;gt;8---
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; That's the 'stmxcsr' instruction, apparently an MMX2
&lt;br&gt;&amp;gt; &amp;gt; instruction, unconditionally used by the linux/x86_64
&lt;br&gt;&amp;gt; &amp;gt; getcontext(3) implementation.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; I find it surprising that getcontext(3) doesn't have a
&lt;br&gt;&amp;gt; &amp;gt; mechanism akin to '__x86_64_preferred_memory_instruction' to
&lt;br&gt;&amp;gt; &amp;gt; choose whether or not to use
&lt;br&gt;&amp;gt; &amp;gt; MMX2 instructions.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Comments?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Thanks,
&lt;br&gt;&amp;gt; &amp;gt; Ludo'.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; &amp;gt; Gc mailing list
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;G...@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt;&lt;a href=&quot;http://www.hpl.hp.com/hosted/linux/mail-archives/gc/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.hpl.hp.com/hosted/linux/mail-archives/gc/&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26158750&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A-GDB-7%27s-process-record-replay---BDW-GC-tp26158750p26158750.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26133291</id>
	<title>Problem of GDB interaction with interrupted system calls</title>
	<published>2009-10-30T09:10:58Z</published>
	<updated>2009-10-30T09:10:58Z</updated>
	<author>
		<name>Alexandre Rusev</name>
	</author>
	<content type="html">Hi.
&lt;br&gt;&lt;br&gt;&lt;br&gt;When the program at ht end of message debugged under GDB is stopped with
&lt;br&gt;Ctrl+C
&lt;br&gt;it's usually found in interrupted system call. (The same result is
&lt;br&gt;observed for x86 and PPC with kernels 2.6.18 and 2.6.28)
&lt;br&gt;&lt;br&gt;(gdb) where
&lt;br&gt;#0 &amp;nbsp;0xb7fe2424 in __kernel_vsyscall ()
&lt;br&gt;#1 &amp;nbsp;0xb7f36ad0 in nanosleep () from /lib/libc.so.6
&lt;br&gt;#2 &amp;nbsp;0xb7f3690e in sleep () from /lib/libc.so.6
&lt;br&gt;#3 &amp;nbsp;0x08048600 in qqq () at testBT2.c:45
&lt;br&gt;#4 &amp;nbsp;0x080487a5 in eee () at testBT2.c:73
&lt;br&gt;#5 &amp;nbsp;0x0804846a in main () at testBT2.c:17
&lt;br&gt;&lt;br&gt;The PC is pointing at the next instruction, accordingly to GDB.
&lt;br&gt;But the kernel tries to restart syscall by means of changing PC to PC-4
&lt;br&gt;(in case of PowerPC and to some other value for x86)
&lt;br&gt;and it does it's change to PC after the user continues execution of
&lt;br&gt;program in GDB with &amp;quot;cont&amp;quot; or &amp;quot;si&amp;quot; command.
&lt;br&gt;&lt;br&gt;The issue is that if user changed PC at this point or uses &amp;quot;call
&lt;br&gt;&amp;lt;func_name&amp;gt;&amp;quot; GDB command, the both changes to PC
&lt;br&gt;are added (as kernel uses PC relative change i.e. PC - 4), and the
&lt;br&gt;program continues execution at absolutely wrong place.
&lt;br&gt;&lt;br&gt;The issue may be gracefully observed if breakpoint is set just before
&lt;br&gt;&amp;lt;func_name&amp;gt; and then PC is changed to the &amp;lt;func_name&amp;gt; address.
&lt;br&gt;In such case the breakpoint is hit while it must not be.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;#include &amp;lt;stdio.h&amp;gt;
&lt;br&gt;#include &amp;lt;stdlib.h&amp;gt;
&lt;br&gt;&lt;br&gt;void qqq();
&lt;br&gt;void www();
&lt;br&gt;void eee();
&lt;br&gt;&lt;br&gt;void * xrealloc(void*, int);
&lt;br&gt;&lt;br&gt;int main(void)
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; eee();
&lt;br&gt;&amp;nbsp; &amp;nbsp; return EXIT_SUCCESS;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;void qqq() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; void *a[256];
&lt;br&gt;&amp;nbsp; &amp;nbsp; size_t i, n;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i] = malloc(n);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i - 1] = xrealloc(a[i - 1], n);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; sleep(1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i]);
&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i - 1]);
&lt;br&gt;&amp;nbsp; &amp;nbsp; sleep(1);
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;void www() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; void *a[256];
&lt;br&gt;&amp;nbsp; &amp;nbsp; size_t i, n;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i++)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i] = malloc(n);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i--)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n = (size_t) ((rand() * 256.0) / (RAND_MAX + 1.0)) + 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i - 1] = realloc(a[i - 1], n);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; sleep(1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 0; i &amp;lt; 256; i += 2)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i]);
&lt;br&gt;&amp;nbsp; &amp;nbsp; for (i = 256; i &amp;gt; 0; i -= 2)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(a[i - 1]);
&lt;br&gt;&amp;nbsp; &amp;nbsp; sleep(1);
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;void eee() {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (1) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; qqq();
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www();
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;void * xrealloc(void* addr, int n) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return realloc(addr, n);
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26133291&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problem-of-GDB-interaction-with-interrupted-system-calls-tp26133291p26133291.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26125030</id>
	<title>RE: [Gc] Re: GDB 7's process record/replay &amp; BDW-GC</title>
	<published>2009-10-29T14:47:44Z</published>
	<updated>2009-10-29T14:47:44Z</updated>
	<author>
		<name>Boehm, Hans</name>
	</author>
	<content type="html">There may be an easy GC-specific workaound, int that you can probably build it with -DNO_GETCONTEXT. &amp;nbsp;Or you might be able to link statically against libc? &amp;nbsp;But this doesn't sound like this will be the last such problem. &amp;nbsp;It sounds to me like these things really need to get fixed in gdb.
&lt;br&gt;&lt;br&gt;Hans 
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; -----Original Message-----
&lt;br&gt;&amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125030&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc-bounces@...&lt;/a&gt; 
&lt;br&gt;&amp;gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125030&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc-bounces@...&lt;/a&gt;] On Behalf Of Ludovic Courtès
&lt;br&gt;&amp;gt; Sent: Wednesday, October 28, 2009 3:54 PM
&lt;br&gt;&amp;gt; To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125030&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125030&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Subject: [Gc] Re: GDB 7's process record/replay &amp; BDW-GC
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125030&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ludo@...&lt;/a&gt; (Ludovic Courtès) writes:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; Process record doesn't support instruction 0xf6e at address 
&lt;br&gt;&amp;gt; 0x7ffff789f2f2.
&lt;br&gt;&amp;gt; &amp;gt; Process record: failed to record execution log.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Program received signal SIGTRAP, Trace/breakpoint trap.
&lt;br&gt;&amp;gt; &amp;gt; 0x00007ffff789f2f0 in memset () from 
&lt;br&gt;&amp;gt; &amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I should have started with that: a web search shows that it's 
&lt;br&gt;&amp;gt; a known issue, not specific to libgc:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &lt;a href=&quot;http://sources.redhat.com/bugzilla/show_bug.cgi?id=10743&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://sources.redhat.com/bugzilla/show_bug.cgi?id=10743&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550710&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550710&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The suggested workaround allows it to go a bit further:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; --8&amp;lt;---------------cut here---------------start-------------&amp;gt;8---
&lt;br&gt;&amp;gt; Breakpoint 1, main (argc=1, argv=0x7fffffffc8e8) at ,,t.c:6
&lt;br&gt;&amp;gt; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GC_INIT ();
&lt;br&gt;&amp;gt; (gdb) set __x86_64_preferred_memory_instruction=0
&lt;br&gt;&amp;gt; (gdb) record
&lt;br&gt;&amp;gt; (gdb) n
&lt;br&gt;&amp;gt; warning: Process record ignores the memory change of 
&lt;br&gt;&amp;gt; instruction at address 0x7ffff7612e5a because it can't get 
&lt;br&gt;&amp;gt; the value of the segment register.
&lt;br&gt;&amp;gt; warning: Process record ignores the memory change of 
&lt;br&gt;&amp;gt; instruction at address 0x7ffff784e8c3 because it can't get 
&lt;br&gt;&amp;gt; the value of the segment register.
&lt;br&gt;&amp;gt; Process record doesn't support instruction 0xfae at address 
&lt;br&gt;&amp;gt; 0x7ffff7862c00.
&lt;br&gt;&amp;gt; Process record: failed to record execution log.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Program received signal SIGTRAP, Trace/breakpoint trap.
&lt;br&gt;&amp;gt; 0x00007ffff7862c00 in getcontext () from 
&lt;br&gt;&amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; (gdb) bt
&lt;br&gt;&amp;gt; #0 &amp;nbsp;0x00007ffff7862c00 in getcontext () from 
&lt;br&gt;&amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; #1 &amp;nbsp;0x00007ffff7b96cfa in GC_with_callee_saves_pushed 
&lt;br&gt;&amp;gt; (fn=&amp;lt;value optimized out&amp;gt;, arg=0x7fffffffc73c &amp;quot;&amp;quot;) at ../mach_dep.c:194
&lt;br&gt;&amp;gt; #2 &amp;nbsp;0x00007ffff7b8e795 in GC_push_roots (all=&amp;lt;value optimized 
&lt;br&gt;&amp;gt; out&amp;gt;, cold_gc_frame=0x7fffffffc73c &amp;quot;&amp;quot;) at ../mark_rts.c:790
&lt;br&gt;&amp;gt; #3 &amp;nbsp;0x00007ffff7b8df0c in GC_mark_some 
&lt;br&gt;&amp;gt; (cold_gc_frame=0x7fffffffc73c &amp;quot;&amp;quot;) at ../mark.c:359
&lt;br&gt;&amp;gt; #4 &amp;nbsp;0x00007ffff7b853f8 in GC_stopped_mark 
&lt;br&gt;&amp;gt; (stop_func=0x7ffff7b846d0 &amp;lt;GC_never_stop_func&amp;gt;) at ../alloc.c:602
&lt;br&gt;&amp;gt; #5 &amp;nbsp;0x00007ffff7b8568d in GC_try_to_collect_inner 
&lt;br&gt;&amp;gt; (stop_func=0x7ffff7b846d0 &amp;lt;GC_never_stop_func&amp;gt;) at ../alloc.c:421
&lt;br&gt;&amp;gt; #6 &amp;nbsp;0x00007ffff7b905c2 in GC_init () at ../misc.c:843
&lt;br&gt;&amp;gt; #7 &amp;nbsp;0x0000000000400788 in main (argc=1, argv=0x7fffffffc8e8) 
&lt;br&gt;&amp;gt; at ,,t.c:6 --8&amp;lt;---------------cut 
&lt;br&gt;&amp;gt; here---------------end---------------&amp;gt;8---
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; That's the 'stmxcsr' instruction, apparently an MMX2 
&lt;br&gt;&amp;gt; instruction, unconditionally used by the linux/x86_64 
&lt;br&gt;&amp;gt; getcontext(3) implementation.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I find it surprising that getcontext(3) doesn't have a 
&lt;br&gt;&amp;gt; mechanism akin to '__x86_64_preferred_memory_instruction' to 
&lt;br&gt;&amp;gt; choose whether or not to use
&lt;br&gt;&amp;gt; MMX2 instructions.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Comments?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Ludo'.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Gc mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125030&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Gc@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.hpl.hp.com/hosted/linux/mail-archives/gc/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.hpl.hp.com/hosted/linux/mail-archives/gc/&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125030&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/RE%3A--Gc--Re%3A-GDB-7%27s-process-record-replay---BDW-GC-tp26125030p26125030.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26125029</id>
	<title>RE: [Gc] GDB 7's process record/replay &amp; BDW-GC</title>
	<published>2009-10-27T15:52:14Z</published>
	<updated>2009-10-27T15:52:14Z</updated>
	<author>
		<name>Boehm, Hans</name>
	</author>
	<content type="html">I couldn't immediately find much of a description of how the record mechanism works. &amp;nbsp;Does it just interpret or single-step, recording overwritten values? &amp;nbsp;Something cleverer? &amp;nbsp;Even if it just interprets, presumably I end up with a separate log for each thread. &amp;nbsp;If I can reverse-single-step thread individually, how do I make sure that I don't end up in an impossible state, in which one thread has observed the action of another one that hasn't executed yet?
&lt;br&gt;&lt;br&gt;I'm really trying to understand what part of the mechanism the GC might be interfering with. &amp;nbsp;The GC itself doesn't play with segment registers. &amp;nbsp;But it does use thread-local variables by default, which I think on X86 take advantage of a segment register pointing at the base of the thread structure. &amp;nbsp;Is there a chance that the problem is really with thread-local (__thread) variables?
&lt;br&gt;&lt;br&gt;Hans
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; -----Original Message-----
&lt;br&gt;&amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125029&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc-bounces@...&lt;/a&gt; 
&lt;br&gt;&amp;gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125029&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc-bounces@...&lt;/a&gt;] On Behalf Of Ludovic Courtès
&lt;br&gt;&amp;gt; Sent: Tuesday, October 27, 2009 2:52 PM
&lt;br&gt;&amp;gt; To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125029&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gc@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Cc: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125029&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Subject: [Gc] GDB 7's process record/replay &amp; BDW-GC
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; GDB 7.0 provides process record/replay facilities, which in 
&lt;br&gt;&amp;gt; turn provide support for reverse execution[*] (info &amp;quot;(gdb) 
&lt;br&gt;&amp;gt; Process Record and Replay&amp;quot;).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Unfortunately, GDB's record facility is confused by libgc's tricks:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; --8&amp;lt;---------------cut here---------------start-------------&amp;gt;8---
&lt;br&gt;&amp;gt; $ cat &amp;gt; ,,t.c &amp;lt;&amp;lt;EOF
&lt;br&gt;&amp;gt; #include &amp;lt;gc/gc.h&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; int &amp;nbsp; 
&lt;br&gt;&amp;gt; main (int argc, char *argv[])
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; &amp;nbsp; GC_INIT ();
&lt;br&gt;&amp;gt; &amp;nbsp; GC_malloc (123);
&lt;br&gt;&amp;gt; &amp;nbsp; return 0;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; EOF
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; $ gcc -Wall ,,t.c -lgc
&lt;br&gt;&amp;gt; $ gdb ./a.out 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; warning: Can not parse XML syscalls information; XML support 
&lt;br&gt;&amp;gt; was disabled at compile time.
&lt;br&gt;&amp;gt; GNU gdb (GDB) 7.0
&lt;br&gt;&amp;gt; Copyright (C) 2009 Free Software Foundation, Inc.
&lt;br&gt;&amp;gt; License GPLv3+: GNU GPL version 3 or later 
&lt;br&gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://gnu.org/licenses/gpl.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gnu.org/licenses/gpl.html&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is free software: you are free to change and redistribute it.
&lt;br&gt;&amp;gt; There is NO WARRANTY, to the extent permitted by law. &amp;nbsp;Type 
&lt;br&gt;&amp;gt; &amp;quot;show copying&amp;quot;
&lt;br&gt;&amp;gt; and &amp;quot;show warranty&amp;quot; for details.
&lt;br&gt;&amp;gt; This GDB was configured as &amp;quot;x86_64-unknown-linux-gnu&amp;quot;.
&lt;br&gt;&amp;gt; For bug reporting instructions, please see:
&lt;br&gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://www.gnu.org/software/gdb/bugs/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.gnu.org/software/gdb/bugs/&lt;/a&gt;&amp;gt;...
&lt;br&gt;&amp;gt; Reading symbols from /home/ludo/src/guile/a.out...done.
&lt;br&gt;&amp;gt; (gdb) r
&lt;br&gt;&amp;gt; Starting program: /home/ludo/src/guile/a.out [Thread 
&lt;br&gt;&amp;gt; debugging using libthread_db enabled]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Program exited normally.
&lt;br&gt;&amp;gt; (gdb) b main
&lt;br&gt;&amp;gt; Breakpoint 1 at 0x400783: file ,,t.c, line 6.
&lt;br&gt;&amp;gt; (gdb) r
&lt;br&gt;&amp;gt; Starting program: /home/ludo/src/guile/a.out [Thread 
&lt;br&gt;&amp;gt; debugging using libthread_db enabled]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Breakpoint 1, main (argc=1, argv=0x7fffffffc8e8) at ,,t.c:6
&lt;br&gt;&amp;gt; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GC_INIT ();
&lt;br&gt;&amp;gt; (gdb) record
&lt;br&gt;&amp;gt; (gdb) c
&lt;br&gt;&amp;gt; Continuing.
&lt;br&gt;&amp;gt; warning: Process record ignores the memory change of 
&lt;br&gt;&amp;gt; instruction at address 0x7ffff7612e5a because it can't get 
&lt;br&gt;&amp;gt; the value of the segment register.
&lt;br&gt;&amp;gt; warning: Process record ignores the memory change of 
&lt;br&gt;&amp;gt; instruction at address 0x7ffff784e8c3 because it can't get 
&lt;br&gt;&amp;gt; the value of the segment register.
&lt;br&gt;&amp;gt; Process record doesn't support instruction 0xf6e at address 
&lt;br&gt;&amp;gt; 0x7ffff789f2f2.
&lt;br&gt;&amp;gt; Process record: failed to record execution log.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Program received signal SIGTRAP, Trace/breakpoint trap.
&lt;br&gt;&amp;gt; 0x00007ffff789f2f0 in memset () from 
&lt;br&gt;&amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; (gdb) bt
&lt;br&gt;&amp;gt; #0 &amp;nbsp;0x00007ffff789f2f0 in memset () from 
&lt;br&gt;&amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; #1 &amp;nbsp;0x00007ffff7b8a7c8 in GC_init_headers () at ../headers.c:197
&lt;br&gt;&amp;gt; #2 &amp;nbsp;0x00007ffff7b904cb in GC_init () at ../misc.c:788
&lt;br&gt;&amp;gt; #3 &amp;nbsp;0x0000000000400788 in main (argc=1, argv=0x7fffffffc8e8) 
&lt;br&gt;&amp;gt; at ,,t.c:6
&lt;br&gt;&amp;gt; (gdb) c
&lt;br&gt;&amp;gt; Continuing.
&lt;br&gt;&amp;gt; Process record doesn't support instruction 0xf6e at address 
&lt;br&gt;&amp;gt; 0x7ffff789f2f2.
&lt;br&gt;&amp;gt; Process record: failed to record execution log.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Program received signal SIGABRT, Aborted.
&lt;br&gt;&amp;gt; 0x00007ffff789f2f0 in memset () from 
&lt;br&gt;&amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; (gdb) bt
&lt;br&gt;&amp;gt; #0 &amp;nbsp;0x00007ffff789f2f0 in memset () from 
&lt;br&gt;&amp;gt; /nix/store/s88vdfglm94x7jn0vqm24pqhq460s0c7-glibc-2.9/lib/libc.so.6
&lt;br&gt;&amp;gt; #1 &amp;nbsp;0x00007ffff7b8a7c8 in GC_init_headers () at ../headers.c:197
&lt;br&gt;&amp;gt; #2 &amp;nbsp;0x00007ffff7b904cb in GC_init () at ../misc.c:788
&lt;br&gt;&amp;gt; #3 &amp;nbsp;0x0000000000400788 in main (argc=1, argv=0x7fffffffc8e8) 
&lt;br&gt;&amp;gt; at ,,t.c:6 --8&amp;lt;---------------cut 
&lt;br&gt;&amp;gt; here---------------end---------------&amp;gt;8---
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Is it a known issue? &amp;nbsp;Any idea how to fix it?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Ludo'.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; [*] The 'multi-thread' target doesn't support reverse 
&lt;br&gt;&amp;gt; execution, but the
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; 'record' target does. &amp;nbsp;Thus 'record' is the only way to 
&lt;br&gt;&amp;gt; get reverse
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; execution for multi-threaded programs.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Gc mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125029&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Gc@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.hpl.hp.com/hosted/linux/mail-archives/gc/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.hpl.hp.com/hosted/linux/mail-archives/gc/&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26125029&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/RE%3A--Gc--GDB-7%27s-process-record-replay---BDW-GC-tp26125029p26125029.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113420</id>
	<title>Re: How does one get static procedure names?</title>
	<published>2009-10-27T13:03:43Z</published>
	<updated>2009-10-27T13:03:43Z</updated>
	<author>
		<name>Andreas Schwab-2</name>
	</author>
	<content type="html">Bruce Korb &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26113420&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bruce.korb@...&lt;/a&gt;&amp;gt; writes:
&lt;br&gt;&lt;br&gt;&amp;gt; Sorry. &amp;nbsp; When you do a &amp;quot;bt&amp;quot; using gdb, you see the function
&lt;br&gt;&amp;gt; names, whether they be &amp;quot;static&amp;quot; or have global (external)
&lt;br&gt;&amp;gt; linkage. &amp;nbsp;The function backtrace_symbols(), on the other
&lt;br&gt;&amp;gt; hand, doe *not* print static scope function names.
&lt;br&gt;&lt;br&gt;backtrace_symbols can only deal with dynamic symbols, which are the only
&lt;br&gt;ones available at runtime. &amp;nbsp;If you want to resolve normal symbols you
&lt;br&gt;need to read them from the (unstripped) binary, like addr2line does.
&lt;br&gt;&lt;br&gt;Andreas.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Andreas Schwab, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26113420&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;schwab@...&lt;/a&gt;
&lt;br&gt;GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 &amp;nbsp;01D3 44D5 214B 8276 4ED5
&lt;br&gt;&amp;quot;And now for something completely different.&amp;quot;
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113420.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113406</id>
	<title>Re: How does one get static procedure names?</title>
	<published>2009-10-27T12:43:13Z</published>
	<updated>2009-10-27T12:43:13Z</updated>
	<author>
		<name>Bruce Korb</name>
	</author>
	<content type="html">On Tue, Oct 27, 2009 at 12:37 PM, Daniel Jacobowitz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26113406&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;drow@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Tue, Oct 27, 2009 at 12:33:39PM -0700, Bruce Korb wrote:
&lt;br&gt;&amp;gt;&amp;gt; Exactly.  I know it'd be some work.  I think I need to
&lt;br&gt;&amp;gt;&amp;gt; call:  dlopen(NULL, RTLD_NOW)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; No.  You need to open the file and have your own ELF and symbol table
&lt;br&gt;&amp;gt; reader.  They are not in the area mapped by dlopen.
&lt;br&gt;&lt;br&gt;OK. &amp;nbsp;Still not terribly hard:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static char const exe_fmt[] =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;/proc/%d/exe&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; char bf[sizeof (exe_fmt) + 12];
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sprintf(bf, exe_fmt, getpid());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; path_len = readlink(bf, exe_path, sizeof (exe_path) - 1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;(This is for Linux only...)
&lt;br&gt;&lt;br&gt;&amp;gt; GDB is almost certainly not where you want to get this code from.  We
&lt;br&gt;&amp;gt; just use BFD...
&lt;br&gt;&lt;br&gt;Ah! &amp;nbsp;There we go. &amp;nbsp;That's what I was looking for. &amp;nbsp;Thank you!
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113406.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113369</id>
	<title>Re: How does one get static procedure names?</title>
	<published>2009-10-27T12:37:31Z</published>
	<updated>2009-10-27T12:37:31Z</updated>
	<author>
		<name>Daniel Jacobowitz-2</name>
	</author>
	<content type="html">On Tue, Oct 27, 2009 at 12:33:39PM -0700, Bruce Korb wrote:
&lt;br&gt;&amp;gt; Exactly. &amp;nbsp;I know it'd be some work. &amp;nbsp;I think I need to
&lt;br&gt;&amp;gt; call: &amp;nbsp;dlopen(NULL, RTLD_NOW)
&lt;br&gt;&lt;br&gt;No. &amp;nbsp;You need to open the file and have your own ELF and symbol table
&lt;br&gt;reader. &amp;nbsp;They are not in the area mapped by dlopen.
&lt;br&gt;&lt;br&gt;&amp;gt; and then copy &amp; fiddle code out of GDB. &amp;nbsp;yes? &amp;nbsp;:)
&lt;br&gt;&lt;br&gt;GDB is almost certainly not where you want to get this code from. &amp;nbsp;We
&lt;br&gt;just use BFD...
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daniel Jacobowitz
&lt;br&gt;CodeSourcery
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113369.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113357</id>
	<title>Re: How does one get static procedure names?</title>
	<published>2009-10-27T12:33:39Z</published>
	<updated>2009-10-27T12:33:39Z</updated>
	<author>
		<name>Bruce Korb</name>
	</author>
	<content type="html">On Tue, Oct 27, 2009 at 12:27 PM, Daniel Jacobowitz &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26113357&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;drow@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Tue, Oct 27, 2009 at 11:56:46AM -0700, Bruce Korb wrote:
&lt;br&gt;&amp;gt;&amp;gt; Sorry.   When you do a &amp;quot;bt&amp;quot; using gdb, you see the function
&lt;br&gt;&amp;gt;&amp;gt; names, whether they be &amp;quot;static&amp;quot; or have global (external)
&lt;br&gt;&amp;gt;&amp;gt; linkage.  The function backtrace_symbols(), on the other
&lt;br&gt;&amp;gt;&amp;gt; hand, doe *not* print static scope function names.  Even if
&lt;br&gt;&amp;gt;&amp;gt; it takes some work, I'd like to &amp;quot;fix&amp;quot; the constraint.  However,
&lt;br&gt;&amp;gt;&amp;gt; I wasn't able to decipher the gdb source well enough to figure
&lt;br&gt;&amp;gt;&amp;gt; out how it accomplished this feat.  So, is there some place
&lt;br&gt;&amp;gt;&amp;gt; in the GDB source where I ought to be looking?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You can't readily do so.  backtrace_symbols is using the dynamic
&lt;br&gt;&amp;gt; symbol table, which is loaded into memory.  Local symbols are not
&lt;br&gt;&amp;gt; added to the dynamic symbol table.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; GDB reads both the local symbol table and the DWARF/stabs debug
&lt;br&gt;&amp;gt; information.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You'd need an additional symbol table reader which read them off disk
&lt;br&gt;&amp;gt; instead of out of RAM.
&lt;/div&gt;&lt;br&gt;Exactly. &amp;nbsp;I know it'd be some work. &amp;nbsp;I think I need to
&lt;br&gt;call: &amp;nbsp;dlopen(NULL, RTLD_NOW)
&lt;br&gt;&lt;br&gt;and then copy &amp; fiddle code out of GDB. &amp;nbsp;yes? &amp;nbsp;:)
&lt;br&gt;Or, do I have to figure out the actual file name and replace
&lt;br&gt;NULL with that file name? &amp;nbsp;Either way....now what?
&lt;br&gt;Just point me to some code &amp; I ought to be okay.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113357.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113344</id>
	<title>Re: How does one get static procedure names?</title>
	<published>2009-10-27T12:27:01Z</published>
	<updated>2009-10-27T12:27:01Z</updated>
	<author>
		<name>Daniel Jacobowitz-2</name>
	</author>
	<content type="html">On Tue, Oct 27, 2009 at 11:56:46AM -0700, Bruce Korb wrote:
&lt;br&gt;&amp;gt; Sorry. &amp;nbsp; When you do a &amp;quot;bt&amp;quot; using gdb, you see the function
&lt;br&gt;&amp;gt; names, whether they be &amp;quot;static&amp;quot; or have global (external)
&lt;br&gt;&amp;gt; linkage. &amp;nbsp;The function backtrace_symbols(), on the other
&lt;br&gt;&amp;gt; hand, doe *not* print static scope function names. &amp;nbsp;Even if
&lt;br&gt;&amp;gt; it takes some work, I'd like to &amp;quot;fix&amp;quot; the constraint. &amp;nbsp;However,
&lt;br&gt;&amp;gt; I wasn't able to decipher the gdb source well enough to figure
&lt;br&gt;&amp;gt; out how it accomplished this feat. &amp;nbsp;So, is there some place
&lt;br&gt;&amp;gt; in the GDB source where I ought to be looking?
&lt;br&gt;&lt;br&gt;You can't readily do so. &amp;nbsp;backtrace_symbols is using the dynamic
&lt;br&gt;symbol table, which is loaded into memory. &amp;nbsp;Local symbols are not
&lt;br&gt;added to the dynamic symbol table.
&lt;br&gt;&lt;br&gt;GDB reads both the local symbol table and the DWARF/stabs debug
&lt;br&gt;information.
&lt;br&gt;&lt;br&gt;You'd need an additional symbol table reader which read them off disk
&lt;br&gt;instead of out of RAM.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Daniel Jacobowitz
&lt;br&gt;CodeSourcery
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113344.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113325</id>
	<title>Re: How does one get static procedure names?</title>
	<published>2009-10-27T11:56:46Z</published>
	<updated>2009-10-27T11:56:46Z</updated>
	<author>
		<name>Bruce Korb</name>
	</author>
	<content type="html">On Tue, Oct 27, 2009 at 11:40 AM, Paul Pluzhnikov
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26113325&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ppluzhnikov@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Tue, Oct 27, 2009 at 11:32 AM, Bruce Korb &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26113325&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bruce.korb@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I know GDB has some way to do it, but I couldn't locate
&lt;br&gt;&amp;gt;&amp;gt; the code that does it.  A pointer on where to look would
&lt;br&gt;&amp;gt;&amp;gt; be really helpful and greatly appreciated!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Your question is rather unclear :-(
&lt;br&gt;&lt;br&gt;Sorry. &amp;nbsp; When you do a &amp;quot;bt&amp;quot; using gdb, you see the function
&lt;br&gt;names, whether they be &amp;quot;static&amp;quot; or have global (external)
&lt;br&gt;linkage. &amp;nbsp;The function backtrace_symbols(), on the other
&lt;br&gt;hand, doe *not* print static scope function names. &amp;nbsp;Even if
&lt;br&gt;it takes some work, I'd like to &amp;quot;fix&amp;quot; the constraint. &amp;nbsp;However,
&lt;br&gt;I wasn't able to decipher the gdb source well enough to figure
&lt;br&gt;out how it accomplished this feat. &amp;nbsp;So, is there some place
&lt;br&gt;in the GDB source where I ought to be looking?
&lt;br&gt;&lt;br&gt;Thank you!
&lt;br&gt;&lt;br&gt;Regards, Bruce
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113325.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113316</id>
	<title>Re: How does one get static procedure names?</title>
	<published>2009-10-27T11:40:22Z</published>
	<updated>2009-10-27T11:40:22Z</updated>
	<author>
		<name>Paul Pluzhnikov-4</name>
	</author>
	<content type="html">On Tue, Oct 27, 2009 at 11:32 AM, Bruce Korb &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26113316&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bruce.korb@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; I know GDB has some way to do it, but I couldn't locate
&lt;br&gt;&amp;gt; the code that does it.  A pointer on where to look would
&lt;br&gt;&amp;gt; be really helpful and greatly appreciated!
&lt;br&gt;&lt;br&gt;Your question is rather unclear :-(
&lt;br&gt;&lt;br&gt;Are you looking for
&lt;br&gt;A) how to set a breakpoint in a static procedure in GDB, or
&lt;br&gt;B) how to find an address of a given static function in a given executable, or
&lt;br&gt;C) a list of all static functions in a given executable, or
&lt;br&gt;D) something else (if so, what exactly?)
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;-- 
&lt;br&gt;Paul Pluzhnikov
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113316.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26113305</id>
	<title>How does one get static procedure names?</title>
	<published>2009-10-27T11:32:50Z</published>
	<updated>2009-10-27T11:32:50Z</updated>
	<author>
		<name>Bruce Korb</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I know GDB has some way to do it, but I couldn't locate
&lt;br&gt;the code that does it. &amp;nbsp;A pointer on where to look would
&lt;br&gt;be really helpful and greatly appreciated!
&lt;br&gt;&lt;br&gt;Thank you in advance.
&lt;br&gt;&lt;br&gt;Regards, Bruce
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-does-one-get-static-procedure-names--tp26113305p26113305.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26065521</id>
	<title>have gdb go until SIGSEGV including at the start/end?</title>
	<published>2009-10-26T00:34:31Z</published>
	<updated>2009-10-26T00:34:31Z</updated>
	<author>
		<name>Jay K-3</name>
	</author>
	<content type="html">&lt;br&gt;I have a program with a race condition.
&lt;br&gt;On Windows it hits an access violation eventually if I run it in a loop (like very 400 runs).
&lt;br&gt;I want to test it on a Unix system (e.g. GNU/Linux or MacOSX or Solaris or OpenBSD).
&lt;br&gt;&amp;nbsp;
&lt;br&gt;On Windows I use:
&lt;br&gt;&amp;nbsp;
&lt;br&gt;foo.cmd:
&lt;br&gt;@echo off
&lt;br&gt;setlocal
&lt;br&gt;set a=1
&lt;br&gt;:loop
&lt;br&gt;echo %a%
&lt;br&gt;\bin\x86\cdb -g -G foo.exe
&lt;br&gt;set /a a=a + 1
&lt;br&gt;goto :loop
&lt;br&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;this runs my program in a loop, in a debugger, until it hits an access violation.
&lt;br&gt;It prints how many times it has run before each run.
&lt;br&gt;&amp;nbsp;-g means go right away at the start of the process 
&lt;br&gt;&amp;nbsp;-G means go past the end of the process 
&lt;br&gt;&amp;nbsp;By default the debugger stops on access violation (SIGSEGV).
&lt;br&gt;&amp;nbsp;set /a is for &amp;quot;arithmetic&amp;quot; (expression evaluation) 
&lt;br&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;What is the equivalent with gdb/sh? (Or at least gdb).
&lt;br&gt;I've tried a bit with -x and -batch, no luck.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Thanks,
&lt;br&gt;&amp;nbsp;- Jay 		 	 &amp;nbsp; 		 &amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/have-gdb-go-until-SIGSEGV-including-at-the-start-end--tp26065521p26065521.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26052606</id>
	<title>Cygwin gdb 7.0 build configure error</title>
	<published>2009-10-25T15:43:12Z</published>
	<updated>2009-10-25T15:43:12Z</updated>
	<author>
		<name>allanw</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I downloaded the source code. Under cygwin, I have got an error when I run ./configure. Here it is:
&lt;br&gt;&lt;br&gt;awang@fmcna ~/gdbSrce/gdb-7.0
&lt;br&gt;$ ./configure --target=powerpc
&lt;br&gt;./configure: line 27: syntax error near unexpected token `$'\r''
&lt;br&gt;'/configure: line 27: `esac
&lt;br&gt;&lt;br&gt;Could anyone help me out? The cygwin is the latest release. Thanks.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Cygwin-gdb-7.0-build-configure-error-tp26052606p26052606.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25831145</id>
	<title>GDB's BUG</title>
	<published>2009-10-09T08:01:42Z</published>
	<updated>2009-10-09T08:01:42Z</updated>
	<author>
		<name>Xenon System</name>
	</author>
	<content type="html">&lt;html&gt;
&lt;head&gt;

&lt;/head&gt;
&lt;body class='hmmessage'&gt;
I used gdb-6.8 on Ubutu 9.04. and I type this&lt;br&gt;in gnome-terminal :&lt;br&gt;&amp;gt;&amp;gt; gdb -q myprog&lt;br&gt;&amp;gt;&amp;gt; list&lt;br&gt;but it displays :&lt;br&gt;&amp;gt;&amp;gt; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ../sysdeps/i386/elf/start.S: No such file or directory.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in ../sysdeps/i386/elf/start.S&lt;br&gt;&lt;br&gt;Please help me.&lt;br&gt;Regards&lt;br&gt;Sarun&lt;br&gt;&lt;br&gt;(sorry for my english, I'm not strong with it)&lt;br&gt; 		 	   		  &lt;br /&gt;&lt;hr /&gt;Keep your friends updated— &lt;a href='http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010' target='_new' rel=&quot;nofollow&quot;&gt;even when you’re not signed in.&lt;/a&gt;&lt;/body&gt;
&lt;/html&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25831145&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/GDB%27s-BUG-tp25831145p25831145.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25779679</id>
	<title>&lt;incomplete type&gt;</title>
	<published>2009-10-06T13:34:27Z</published>
	<updated>2009-10-06T13:34:27Z</updated>
	<author>
		<name>Clemens-11</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;got the error &amp;lt;incomplete type&amp;gt; for a non typedefed class.
&lt;br&gt;&lt;br&gt;How can I yvoid this ud get the class information ?
&lt;br&gt;&lt;br&gt;thx
&lt;br&gt;Clemens
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25779679&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%3Cincomplete-type%3E-tp25779679p25779679.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25497980</id>
	<title>Reverse debugging questions</title>
	<published>2009-09-17T12:32:54Z</published>
	<updated>2009-09-17T12:32:54Z</updated>
	<author>
		<name>Manoharan Vijaya Raghavan</name>
	</author>
	<content type="html">&lt;div&gt;Hi All, &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;This mail has my questions regarding reverse debugging...&lt;/div&gt;
&lt;div&gt;1. I need not be explained in simple / basic terms... &lt;br&gt;2. I have used gdb... as well as I have done a few modifications to gdb code for &lt;br&gt;   in house usage... &lt;br&gt;3. I would like to know (and possibly contribute) what could be the probable &lt;br&gt;
   solutions for the problems which I see...&lt;/div&gt;
&lt;div&gt;&lt;br&gt;Questions :- &lt;/div&gt;
&lt;div&gt;      1. Let us say a process which you want to reverse step has created &lt;br&gt;         a file ... natuarally you are supposed to delete the file when reverse stepping&lt;/div&gt;
&lt;div&gt;         so that at the time before executing the previous lines the file was not &lt;br&gt;         existing ... &lt;br&gt;                  the reason I want the &amp;quot;system state&amp;quot; not just the process context &lt;br&gt;         to be same is &lt;/div&gt;

&lt;div&gt;  Let us say my program has the following lines...&lt;/div&gt;
&lt;div&gt;1110                printf(&amp;quot;Let us create that file \n&amp;quot;);&lt;br&gt;1111                if ((fd = open(&amp;quot;xyz&amp;quot;,O_WRONLY | O_EXCL | O_CREAT, mode)) &amp;lt; 0)&lt;br&gt;1112                {&lt;br&gt;1113                     /* do some error processing */&lt;br&gt;
1114                     exit(1);&lt;br&gt;1115                }&lt;br&gt;1116                fwrite(fd,.............&lt;br&gt; &lt;br&gt;         Let us say I am in the line 1116..... now I want to  step back... &lt;br&gt;         I go to the line 1110... &lt;/div&gt;

&lt;div&gt;         Are you going to jump to the code in previous line and restore the &lt;br&gt;         process / thread context and execute the code again when user wants&lt;br&gt;         to step forward ?&lt;/div&gt;
&lt;div&gt;         if that is the case then while stepping forward again... I will &lt;br&gt;         get an error as the file &amp;quot;xyz&amp;quot; already exists and I will be going &lt;br&gt;         to a code flow which is different that it was before...&lt;br&gt;
      &lt;br&gt;         there more scenarios along the same line such as &lt;br&gt;              1. socket operations...&lt;br&gt;              2. File read / write&lt;br&gt;              3. semaphore operations...&lt;br&gt;              4. child process creations ... &lt;br&gt;
              5. Signals... &lt;br&gt;              6. thread scheduling in exact reverse order as it occured before... &lt;br&gt;              etc... &lt;/div&gt;
&lt;div&gt;       can we do a record and play back... I mean... just capture&lt;br&gt;       the &amp;quot;change in process state&amp;quot; for each and every instruction and while &lt;br&gt;       doing the reverse debugging ... just simply play it back ? then it may&lt;br&gt;
       not exactly be a reverse debugging ... may be it is something else... &lt;br&gt;       a reverse play back of some core files (ofcourse diff) ... &lt;br&gt;       (is this the technique you are already using ?).....&lt;br&gt;       if not so then why can&amp;#39;t we use this... ? just store the difference &lt;br&gt;
       in thread context and memory alone each time and then play it for &lt;br&gt;       already executed instructions when user wants to step through them...&lt;br&gt;       &lt;br&gt;       In case of record and play back may be it becomes something like software &lt;br&gt;
       breakpoint (an internal one) in each and every line of the process... &lt;/div&gt;
&lt;div&gt;       In this approach (record and play) there is a limitation that  user &lt;br&gt;       cannot just like that alter the flow from an already executed &lt;br&gt;       instructions without side effects (how to cancel the effect of &lt;br&gt;
       instructions already executed... i.e., restoring the system state) &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;-- The New Symbol&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Reverse-debugging-questions-tp25497980p25497980.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25356216</id>
	<title>Re: How to get gdb to run continuously</title>
	<published>2009-09-08T03:04:20Z</published>
	<updated>2009-09-08T03:04:20Z</updated>
	<author>
		<name>parag-4</name>
	</author>
	<content type="html">On Sep 8, 2:34 pm, parag &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25356216&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;parag.p...@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I have run a script and I dont want gdb to manually press enter all
&lt;br&gt;&amp;gt; the time
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ---Type &amp;lt;return&amp;gt; to continue, or q &amp;lt;return&amp;gt; to quit---
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; due to this , teh script is asking me to press thousands of enters,
&lt;br&gt;&amp;gt; whenevr it stops
&lt;br&gt;&amp;gt; can this be done with
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; the script is something like the following
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; while (1)
&lt;br&gt;&amp;gt; cont
&lt;br&gt;&amp;gt; display a-&amp;gt;b
&lt;br&gt;&amp;gt; end
&lt;/div&gt;&lt;br&gt;I got the answer
&lt;br&gt;set height 100000
&lt;br&gt;and it will show at least 100000 line before stopping :)
&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25356216&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-get-gdb-to-run-continuously-tp25356215p25356216.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25356215</id>
	<title>How to get gdb to run continuously</title>
	<published>2009-09-08T02:34:17Z</published>
	<updated>2009-09-08T02:34:17Z</updated>
	<author>
		<name>parag-4</name>
	</author>
	<content type="html">I have run a script and I dont want gdb to manually press enter all
&lt;br&gt;the time
&lt;br&gt;&lt;br&gt;---Type &amp;lt;return&amp;gt; to continue, or q &amp;lt;return&amp;gt; to quit---
&lt;br&gt;&lt;br&gt;&lt;br&gt;due to this , teh script is asking me to press thousands of enters,
&lt;br&gt;whenevr it stops
&lt;br&gt;can this be done with
&lt;br&gt;&lt;br&gt;the script is something like the following
&lt;br&gt;&lt;br&gt;while (1)
&lt;br&gt;cont
&lt;br&gt;display a-&amp;gt;b
&lt;br&gt;end
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25356215&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-get-gdb-to-run-continuously-tp25356215p25356215.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25322566</id>
	<title>GDB RSP protocol question</title>
	<published>2009-09-06T15:02:22Z</published>
	<updated>2009-09-06T15:02:22Z</updated>
	<author>
		<name>NarenB</name>
	</author>
	<content type="html">I am a WinDbg user trying to become familiar with GDB and RSP protocol that GDB uses.
&lt;br&gt;&lt;br&gt;Can we assume that the GDB client and server communication is always a synchronous ? That is the GDB server sends a response to the client's request and there is no unsolicited packets from the GDB server ?
&lt;br&gt;&lt;br&gt;If the GDB client issues a continue command, is the only response to that is when the breakpoint (that was set earlier on) is hit ? 
&lt;br&gt;&lt;br&gt;Thanks !!&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/GDB-RSP-protocol-question-tp25322566p25322566.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25322496</id>
	<title>Breaking execution after continue command</title>
	<published>2009-09-06T14:56:20Z</published>
	<updated>2009-09-06T14:56:20Z</updated>
	<author>
		<name>NarenB</name>
	</author>
	<content type="html">I am a WinDbg user trying to become familiar with GDB.
&lt;br&gt;&lt;br&gt;After issuing a continue command (resuming program execution), while the program is running, is there a way I can break into the program ? Something like COntrol-Break in WinDbg ?
&lt;br&gt;&lt;br&gt;Can we break in the first place ? Or after saying continue, the only way we break is when the breakpoint that was previously set, gets hit ?
&lt;br&gt;&lt;br&gt;Thanks !!
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Breaking-execution-after-continue-command-tp25322496p25322496.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25285734</id>
	<title>GNU gdb 6.2.1 BUG on NetBSD</title>
	<published>2009-09-03T02:51:33Z</published>
	<updated>2009-09-03T02:51:33Z</updated>
	<author>
		<name>Lorenzo Ribaldi</name>
	</author>
	<content type="html">Running GDB on netbsd it prints this message:&lt;br&gt;&lt;br&gt;&lt;div style=&quot;margin-left: 40px;&quot;&gt;# gdb --write /netbsd&lt;br&gt;&lt;br&gt;warning: offsetof (struct sigcontext, sc_pc) yields 92 instead of 44.&lt;br&gt;Please report this to &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25285734&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;&amp;gt;.&lt;br&gt;

&lt;br&gt;warning: offsetof (struct sigcontext, sc_sp) yields 104 instead of 56.&lt;br&gt;Please report this to &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25285734&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;&amp;gt;.&lt;br&gt;GNU gdb 6.2.1&lt;br&gt;Copyright 2004 Free Software Foundation, Inc.&lt;br&gt;

GDB is free software, covered by the GNU General Public License, and you are&lt;br&gt;welcome to change it and/or distribute copies of it under certain conditions.&lt;br&gt;Type &amp;quot;show copying&amp;quot; to see the conditions.&lt;br&gt;There is absolutely no warranty for GDB.  Type &amp;quot;show warranty&amp;quot; for details.&lt;br&gt;

This GDB was configured as &amp;quot;i386--netbsdelf&amp;quot;...(no debugging symbols found)...&lt;br&gt;&lt;br&gt;(gdb) set nmbclusters=2048&lt;br&gt;(gdb) quit&lt;br&gt;Memory fault (core dumped)&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;/div&gt;Regards&lt;br&gt;Ribaldi Lorenzo&lt;br&gt;&lt;br&gt;&lt;br&gt;

&lt;br&gt;&lt;br&gt;&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;bug-gdb mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=25285734&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug-gdb@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.gnu.org/mailman/listinfo/bug-gdb&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.gnu.org/mailman/listinfo/bug-gdb&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---Bugs-f1620.html&quot; embed=&quot;fixTarget[1620]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - Bugs&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/GNU-gdb-6.2.1-BUG-on-NetBSD-tp25285734p25285734.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-25217157</id>
	<title>conditional watchpoint</title>
	<published>2009-08-30T17:55:22Z</published>
	<updated>2009-08-30T17:55:22Z</updated>
	<author>
		<name>lehe</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;Is there anyway to set conditional watchpoint, like &amp;quot;watch var1 if var1==0&amp;quot;? In my case, the condition does't work. gdb stops whenever var1's value is changed, instead of untill &amp;quot;var1==0&amp;quot; is true. My gdb is GNU gdb 6.8-debian.
&lt;br&gt;&lt;br&gt;Thanks and regards!
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/conditional-watchpoint-tp25217157p25217157.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-24983937</id>
	<title>Re: gdb says that &quot;disassemble /m&quot; is not a valid command</title>
	<published>2009-08-15T04:28:52Z</published>
	<updated>2009-08-15T04:28:52Z</updated>
	<author>
		<name>Thomas Schwinge-6</name>
	</author>
	<content type="html">Hello!
&lt;br&gt;&lt;br&gt;On Fri, Aug 14, 2009 at 05:53:16PM +0300, Nikos Chantziaras wrote:
&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 08/14/2009 11:22 AM, Thomas Schwinge wrote:
&lt;br&gt;&amp;gt; &amp;gt;On Wed, Aug 12, 2009 at 07:44:35PM +0300, Nikos Chantziaras wrote:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; (gdb) disassemble /m
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; A syntax error in expression, near `/m'.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;Is the documentation out of date? &amp;nbsp;How do I get source and assembly at
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;the same time? &amp;nbsp;&amp;quot;help disassemble&amp;quot; doesn't say anything about &amp;quot;/m&amp;quot; and
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;neither the gdb info pages.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;Your version of GDB is too old
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 6.8 is the latest release I can find on 
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.gnu.org/software/gdb/download/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.gnu.org/software/gdb/download/&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;This is correct, the new release has not yet been done. &amp;nbsp;If using the
&lt;br&gt;last release, you should have a look at ``the documentation generated
&lt;br&gt;from the last release'' -- see
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://www.gnu.org/software/gdb/documentation/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.gnu.org/software/gdb/documentation/&lt;/a&gt;&amp;gt;.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;&amp;nbsp;Thomas
&lt;br&gt;&lt;br /&gt; &lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;signature.asc&lt;/strong&gt; (198 bytes) &lt;a href=&quot;http://old.nabble.com/attachment/24983937/0/signature.asc&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/gdb-says-that-%22disassemble--m%22-is-not-a-valid-command-tp24941556p24983937.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-24973046</id>
	<title>Re: gdb says that &quot;disassemble /m&quot; is not a valid command</title>
	<published>2009-08-14T07:53:16Z</published>
	<updated>2009-08-14T07:53:16Z</updated>
	<author>
		<name>Nikos Chantziaras</name>
	</author>
	<content type="html">On 08/14/2009 11:22 AM, Thomas Schwinge wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Wed, Aug 12, 2009 at 07:44:35PM +0300, Nikos Chantziaras wrote:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;(gdb) disassemble /m
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;A syntax error in expression, near `/m'.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Is the documentation out of date? &amp;nbsp;How do I get source and assembly at
&lt;br&gt;&amp;gt;&amp;gt; the same time? &amp;nbsp;&amp;quot;help disassemble&amp;quot; doesn't say anything about &amp;quot;/m&amp;quot; and
&lt;br&gt;&amp;gt;&amp;gt; neither the gdb info pages.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Your version of GDB is too old
&lt;/div&gt;&lt;br&gt;6.8 is the latest release I can find on 
&lt;br&gt;&lt;a href=&quot;http://www.gnu.org/software/gdb/download/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.gnu.org/software/gdb/download/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/gdb-says-that-%22disassemble--m%22-is-not-a-valid-command-tp24941556p24973046.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-24968064</id>
	<title>Re: gdb says that &quot;disassemble /m&quot; is not a valid command</title>
	<published>2009-08-14T01:22:39Z</published>
	<updated>2009-08-14T01:22:39Z</updated>
	<author>
		<name>Thomas Schwinge-6</name>
	</author>
	<content type="html">Hello!
&lt;br&gt;&lt;br&gt;On Wed, Aug 12, 2009 at 07:44:35PM +0300, Nikos Chantziaras wrote:
&lt;br&gt;&amp;gt; &amp;nbsp; (gdb) disassemble /m
&lt;br&gt;&amp;gt; &amp;nbsp; A syntax error in expression, near `/m'.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Is the documentation out of date? &amp;nbsp;How do I get source and assembly at 
&lt;br&gt;&amp;gt; the same time? &amp;nbsp;&amp;quot;help disassemble&amp;quot; doesn't say anything about &amp;quot;/m&amp;quot; and 
&lt;br&gt;&amp;gt; neither the gdb info pages.
&lt;br&gt;&lt;br&gt;Your version of GDB is too old, or this feature is too new: it is
&lt;br&gt;available since 2008-05-05 only, whereas GDB 6.8 has been released on
&lt;br&gt;2008-03-27 already.
&lt;br&gt;&lt;br&gt;What you can use, outside of the debugger, is ``objdump -S''.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;&amp;nbsp;Thomas
&lt;br&gt;&lt;br /&gt; &lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;signature.asc&lt;/strong&gt; (198 bytes) &lt;a href=&quot;http://old.nabble.com/attachment/24968064/0/signature.asc&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/gdb-says-that-%22disassemble--m%22-is-not-a-valid-command-tp24941556p24968064.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-24941556</id>
	<title>gdb says that &quot;disassemble /m&quot; is not a valid command</title>
	<published>2009-08-12T09:44:35Z</published>
	<updated>2009-08-12T09:44:35Z</updated>
	<author>
		<name>Nikos Chantziaras</name>
	</author>
	<content type="html">I'm trying to disassemble a C++ function with gdb 6.8. &amp;nbsp;I've in the 
&lt;br&gt;manual at:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://sourceware.org/gdb/current/onlinedocs/gdb_9.html#SEC64&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://sourceware.org/gdb/current/onlinedocs/gdb_9.html#SEC64&lt;/a&gt;&lt;br&gt;&lt;br&gt;that &amp;quot;disassemble /m&amp;quot; should also print the source line together with 
&lt;br&gt;the assembly dump. &amp;nbsp;However, when actually trying it out I get:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;(gdb) disassemble /m
&lt;br&gt;&amp;nbsp; &amp;nbsp;A syntax error in expression, near `/m'.
&lt;br&gt;&lt;br&gt;Is the documentation out of date? &amp;nbsp;How do I get source and assembly at 
&lt;br&gt;the same time? &amp;nbsp;&amp;quot;help disassemble&amp;quot; doesn't say anything about &amp;quot;/m&amp;quot; and 
&lt;br&gt;neither the gdb info pages.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Gnu---gdb---General-f1619.html&quot; embed=&quot;fixTarget[1619]&quot; target=&quot;_top&quot; &gt;Gnu - gdb - General&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/gdb-says-that-%22disassemble--m%22-is-not-a-valid-command-tp24941556p24941556.html" />
</entry>

</feed>
