public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* Fixes for Mac OS X/x86 building/running
@ 2009-03-11 19:41 Jonas Maebe
  2009-03-12 18:30 ` Jonas Maebe
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jonas Maebe @ 2009-03-11 19:41 UTC (permalink / raw)
  To: archer

[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]

Hello,

Archer (archer branch) is currently broken on Mac OS X/x86. The  
attached (minor) patches fix this:

* darwin-nat.c.patch fixes compilation errors due to some missing  
"struct target_ops *" parameters. Probably caused by:

commit be44ac148163ced0dde7b8ff23c8f1cc49efa106
Author: Pedro Alves <pedro@codesourcery.com>
Date:   Mon Feb 23 00:03:47 2009 +0000

* machoread.c.patch fixes a crash caused by a missing function pointer  
field (sym_read_psymbols) initializer in the middle of macho's struct  
sym_fns (so the subsequent function pointer initializers were all  
shifted). I've simply copied the elfread.c implementation of  
read_psyms (because it appeared to be generic) and it seems to work  
fine (if it's called at all). I guess this needs to be solved in a  
better way though (maybe a NULL pointer would be enough). I'm not sure  
why I didn't see this crash when I built gdb last time (on January 17  
from the archer-jankratochvil-vla banch), as this field was already  
added on 2008-09-09 (by Tom Tromey) according to git.

With these two patches applied, the Mac OS X build and works fine  
again on i386 (at least in my cursory testing).


Jonas

[-- Attachment #2: machoread.c.patch --]
[-- Type: application/octet-stream, Size: 1085 bytes --]

diff --git a/gdb/machoread.c b/gdb/machoread.c
index d8d3bd2..bed7f86 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -675,11 +675,26 @@ macho_symfile_offsets (struct objfile *objfile,
     }
 }
 
+static void
+read_psyms (struct objfile *objfile)
+{
+  if (dwarf2_has_info (objfile))
+    {
+      /* DWARF 2 sections */
+      dwarf2_build_psymtabs (objfile, 0);
+    }
+
+  /* FIXME: kettenis/20030504: This still needs to be integrated with
+     dwarf2read.c in a better way.  */
+  dwarf2_build_frame_info (objfile);
+}
+
 static struct sym_fns macho_sym_fns = {
   bfd_target_mach_o_flavour,
 
   macho_new_init,               /* sym_new_init: init anything gbl to entire symtab */
   macho_symfile_init,           /* sym_init: read initial info, setup for sym_read() */
+  read_psyms,                   /* sym_read_psymbols */
   macho_symfile_read,           /* sym_read: read a symbol file into symtab */
   macho_symfile_finish,         /* sym_finish: finished with file, cleanup */
   macho_symfile_offsets,        /* sym_offsets:  xlate external to internal form */

[-- Attachment #3: darwin-nat.c.patch --]
[-- Type: application/octet-stream, Size: 1897 bytes --]

diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 15a4b55..cabd4e2 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -90,7 +90,7 @@ static void darwin_mourn_inferior (struct target_ops *ops);
 
 static int darwin_lookup_task (char *args, task_t * ptask, int *ppid);
 
-static void darwin_kill_inferior (void);
+static void darwin_kill_inferior (struct target_ops *ops);
 
 static void darwin_ptrace_me (void);
 
@@ -668,7 +668,7 @@ darwin_mourn_inferior (struct target_ops *ops)
 }
 
 static void
-darwin_stop_inferior (darwin_inferior *inf)
+darwin_stop_inferior (struct target_ops *ops, darwin_inferior *inf)
 {
   struct target_waitstatus wstatus;
   ptid_t ptid;
@@ -688,7 +688,7 @@ darwin_stop_inferior (darwin_inferior *inf)
   if (res != 0)
     warning (_("cannot kill: %s\n"), strerror (errno));
 
-  ptid = darwin_wait (inferior_ptid, &wstatus);
+  ptid = darwin_wait (ops, inferior_ptid, &wstatus);
   gdb_assert (wstatus.kind = TARGET_WAITKIND_STOPPED);
 }
 
@@ -706,7 +706,7 @@ darwin_kill_inferior (struct target_ops *ops)
   if (ptid_equal (inferior_ptid, null_ptid))
     return;
 
-  darwin_stop_inferior (darwin_inf);
+  darwin_stop_inferior (ops, darwin_inf);
 
   res = PTRACE (PT_KILL, darwin_inf->pid, 0, 0);
   gdb_assert (res == 0);
@@ -720,7 +720,7 @@ darwin_kill_inferior (struct target_ops *ops)
   kret = task_resume (darwin_inf->task);
   MACH_CHECK_ERROR (kret);
 
-  ptid = darwin_wait (inferior_ptid, &wstatus);
+  ptid = darwin_wait (ops, inferior_ptid, &wstatus);
 
   /* This double wait seems required...  */
   res = waitpid (darwin_inf->pid, &status, 0);
@@ -1011,7 +1011,7 @@ darwin_detach (struct target_ops *ops, char *args, int from_tty)
       gdb_flush (gdb_stdout);
     }
 
-  darwin_stop_inferior (darwin_inf);
+  darwin_stop_inferior (ops, darwin_inf);
 
   kret = darwin_restore_exception_ports (darwin_inf);
   MACH_CHECK_ERROR (kret);

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-03-12 23:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-11 19:41 Fixes for Mac OS X/x86 building/running Jonas Maebe
2009-03-12 18:30 ` Jonas Maebe
2009-03-12 18:41   ` Joel Brobecker
2009-03-12 19:28     ` Jonas Maebe
2009-03-12 20:56 ` Tom Tromey
2009-03-12 21:45   ` Jonas Maebe
2009-03-12 22:19     ` [Archer] " Joel Brobecker
2009-03-12 22:33     ` Tom Tromey
2009-03-12 23:07       ` Jonas Maebe
2009-03-12 23:25       ` Tom Tromey
2009-03-12 22:40 ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).