This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Linux MAY_FOLLOW_EXEC #2 [Re: RFC: Fix crash on i386 (%gs-)threaded programs using execve(2)]


Hi Daniel,

On Mon, 24 Jul 2006 21:03:32 +0200, Daniel Jacobowitz wrote:
...
> The reason I find it so disorienting is this:
> 
> % gdb file1
> 
> (gdb) run
> [starts file1]
> [file1 execs file2]
> [file2 exits]
> 
> (gdb) run
> [file2 starts instead of file1!]
> 
> I don't know if it should do that or not.  I tend to use "run" a lot
> and want to get back to the beginning of my debug session.

Included restoration patch using make_run_cleanup(), session log below.

That waitpid(3) WNOHANG smells there for me but it does not hurt the testsuite.
Should I investigate it more?

2006-07-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* inf-ptrace.c (inf_ptrace_mourn_inferior): waitpid(3) with WNOHANG
	to avoid lockup on the introduced TARGET_WAITKIND_EXECD handling.
	* infrun.c (follow_exec): Unconditionally enabled by MAY_FOLLOW_EXEC.
	Provide restoration of exec_bfd and symfile_objfile for any new "run".
	* linux-thread-db.c (thread_db_wait): Handle TARGET_WAITKIND_EXECD.
	* linux-thread-db.c (thread_db_mourn_inferior): Turn off threading.
	* foll-exec.exp: Uncoditionally enabled for all platforms.
	Relaxed regex to apply besides HP-UX also for GNU/Linux backtrace.


Thanks,
Jan

------------------------------------------------------------------------------

(gdb) file execve
Reading symbols from /tmp/execve...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) catch exec
Catchpoint 1 (exec)
(gdb) set args gdb-entered parameters
(gdb) run
Starting program: /tmp/execve gdb-entered parameters
Executing new program: /tmp/hello
[Switching to process 16524]
Catchpoint 1 (exec'd /tmp/hello), 0x44031840 in ?? ()
(gdb) show args
Argument list to give program being debugged when it is started is "gdb-entered parameters".
(gdb) info files
Symbols from "/tmp/hello".
Unix child process:
	Using the running image of child process 16524.
	While running this, GDB does not access memory from...
Local exec file:
	`/tmp/hello', file type elf32-i386.
[...]
(gdb) c
Continuing.
[New process 16524]
hello world

Program exited normally.
(gdb) info files
Symbols from "/tmp/hello".
Local exec file:
	`/tmp/hello', file type elf32-i386.
[...]
(gdb) run
Starting program: /tmp/execve gdb-entered parameters
Executing new program: /tmp/hello
[Switching to process 16827]

Catchpoint 1 (exec'd /tmp/hello), 0x44031840 in ?? ()
(gdb)

Attachment: gdb-6.5-follow-exec.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]