From 9c1938e75f12b78450ac02f652c5f0581fb022e5 Mon Sep 17 00:00:00 2001 From: gingold Date: Tue, 6 Oct 2009 07:23:05 +0000 Subject: [PATCH] 2009-10-06 Tristan Gingold * darwin-nat.c: Add __TEXT __info_plist content. (darwin_attach_pid): Update error message. --- gdb/ChangeLog | 5 +++++ gdb/darwin-nat.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4ea21170d5..8e7bf5f22d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-10-06 Tristan Gingold + + * darwin-nat.c: Add __TEXT __info_plist content. + (darwin_attach_pid): Update error message. + 2009-10-06 Joel Brobecker * MAINTAINERS: Add Tristan Gingold as Maintainer of the Darwin port. diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 237c4652cd..daa9df9f0c 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -147,6 +147,34 @@ static struct inferior *darwin_inf_fake_stop; /* This controls output of inferior debugging. */ static int darwin_debug_flag = 0; +/* Create a __TEXT __info_plist section in the executable so that gdb could + be signed. This is required to get an authorization for task_for_pid. + + Once gdb is built, you can either: + * make it setgid procmod + * or codesign it with any system-trusted signing authority. + See taskgated(8) for details. */ +static const unsigned char info_plist[] +__attribute__ ((section ("__TEXT,__info_plist"),used)) = + "\n" + "\n" + "\n" + "\n" + " CFBundleIdentifier\n" + " org.gnu.gdb\n" + " CFBundleName\n" + " gdb\n" + " CFBundleVersion\n" + " 1.0\n" + " SecTaskAccess\n" + " \n" + " allowed\n" + " debug\n" + " \n" + "\n" + "\n"; + static void inferior_debug (int level, const char *fmt, ...) { @@ -1323,7 +1351,7 @@ darwin_attach_pid (struct inferior *inf) } error (_("Unable to find Mach task port for process-id %d: %s (0x%lx).\n" - " (please check gdb is setgid procmod)"), + " (please check gdb is codesigned - see taskgated(8))"), inf->pid, mach_error_string (kret), (unsigned long) kret); } -- 2.11.0