This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[Darwin]: Do not set binary preference to spawn the shell (PR 13901)
- From: Tristan Gingold <gingold at adacore dot com>
- To: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>
- Date: Wed, 11 Apr 2012 15:42:27 +0200
- Subject: [Darwin]: Do not set binary preference to spawn the shell (PR 13901)
Hi,
as discussed, the approach to fix PR 13901 wasn't correct. The right way is not to try to
read (or modify) registers of the shell.
This is now allowed by a previous patch.
The remaining work, done by this patch, is simply to revert the first approach.
Manually tested on a i386-darwin debugger.
Tristan.
2012-04-11 Tristan Gingold <gingold@adacore.com>
PR gdb/13901
* darwin-nat.c (darwin_execvp): Revert previous patch.
Index: darwin-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/darwin-nat.c,v
retrieving revision 1.34
diff -c -r1.34 darwin-nat.c
*** darwin-nat.c 11 Apr 2012 13:17:05 -0000 1.34
--- darwin-nat.c 11 Apr 2012 13:42:00 -0000
***************
*** 1529,1550 ****
return;
}
- /* Specify the same binary preference to spawn the shell as the
- exec binary. This avoids spawning a 64bit shell while debugging
- a 32bit program, which may confuse gdb.
- Also, this slightly breaks internal layers as we suppose the binary
- is Mach-O. Doesn't harm in practice. */
- if (exec_bfd != NULL)
- {
- cpu_type_t pref;
- size_t ocount;
-
- pref = bfd_mach_o_get_data (exec_bfd)->header.cputype;
- res = posix_spawnattr_setbinpref_np (&attr, 1, &pref, &ocount);
- if (res != 0 || ocount != 1)
- fprintf_unfiltered (gdb_stderr, "Cannot set posix_spawn binpref\n");
- }
-
posix_spawnp (NULL, argv[0], NULL, &attr, argv, env);
}
--- 1529,1534 ----