Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix Darwin breakage
@ 2009-08-14 16:32 Paul Pluzhnikov
  2009-08-14 17:56 ` Paul Pluzhnikov
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Paul Pluzhnikov @ 2009-08-14 16:32 UTC (permalink / raw)
  To: gdb-patches ml; +Cc: Christian Thalinger

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

Greetings,

This patch:
  http://sourceware.org/ml/gdb-patches/2009-07/msg00417.html
caused Darwin/MacOSX to stop working with assertion:
  objfiles.c:793: internal-error: qsort_cmp: Assertion
`obj_section_endaddr (sect1) <= sect2_addr' failed.

Turns out this worked only "by accident" before.

Here is a proposed fix. Tested by running "./gdb ./gdb", setting
breakpoints, etc.
(I don't have dejagnu setup on MacOS yet).

Thanks,
-- 
Paul Pluzhnikov

2009-08-14  Paul Pluzhnikov  <ppluzhnikov@google.com>

        * objfiles.h (OBJF_NOT_MAPPED): New macro.
        * objfiles.c (update_section_map): Ignore unmapped objfiles.
        * machoread.c (macho_oso_symfile): Set OBJF_NOT_MAPPED for oso files.

[-- Attachment #2: gdb-macho-20090814.txt --]
[-- Type: text/plain, Size: 2834 bytes --]

Index: machoread.c
===================================================================
RCS file: /cvs/src/src/gdb/machoread.c,v
retrieving revision 1.5
diff -p -u -r1.5 machoread.c
--- machoread.c	19 Jun 2009 14:30:30 -0000	1.5
+++ machoread.c	14 Aug 2009 16:08:50 -0000
@@ -406,7 +406,7 @@ macho_oso_symfile (struct objfile *main_
 	      bfd_close (member_bfd);
 	    }
 	    else
-	      symbol_file_add_from_bfd (member_bfd, 0, addrs, 0);
+	      symbol_file_add_from_bfd (member_bfd, 0, addrs, OBJF_NOT_MAPPED);
 	}
       else
 	{
@@ -429,7 +429,7 @@ macho_oso_symfile (struct objfile *main_
 	      continue;
 	    }
   
-	  symbol_file_add_from_bfd (abfd, 0, addrs, 0);
+	  symbol_file_add_from_bfd (abfd, 0, addrs, OBJF_NOT_MAPPED);
 	}
       xfree (oso->symbols);
       xfree (oso->offsets);
@@ -592,7 +592,7 @@ macho_symfile_read (struct objfile *objf
 	  oso_vector = NULL;
 
 	  /* Now recurse: read dwarf from dsym.  */
-	  symbol_file_add_from_bfd (dsym_bfd, 0, NULL, 0);
+	  symbol_file_add_from_bfd (dsym_bfd, 0, NULL, OBJF_NOT_MAPPED);
       
 	  /* Don't try to read dwarf2 from main file or shared libraries.  */
 	  return;
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.91
diff -p -u -r1.91 objfiles.c
--- objfiles.c	10 Aug 2009 22:09:22 -0000	1.91
+++ objfiles.c	14 Aug 2009 16:08:50 -0000
@@ -840,16 +840,20 @@ update_section_map (struct obj_section *
     & SEC_THREAD_LOCAL) == 0)
 
   map_size = 0;
-  ALL_OBJSECTIONS (objfile, s)
-    if (insert_p (objfile, s))
-      map_size += 1;
+  ALL_OBJFILES (objfile)	
+    if ((objfile->flags & OBJF_NOT_MAPPED) == 0)
+      ALL_OBJFILE_OSECTIONS (objfile, s)
+	if (insert_p (objfile, s))
+	  map_size += 1;
 
   map = xmalloc (map_size * sizeof (*map));
 
   i = 0;
-  ALL_OBJSECTIONS (objfile, s)
-    if (insert_p (objfile, s))
-      map[i++] = s;
+  ALL_OBJFILES (objfile)	
+    if ((objfile->flags & OBJF_NOT_MAPPED) == 0)
+      ALL_OBJFILE_OSECTIONS (objfile, s)
+	if (insert_p (objfile, s))
+	  map[i++] = s;
 
 #undef insert_p
 
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.61
diff -p -u -r1.61 objfiles.h
--- objfiles.h	4 Aug 2009 18:46:05 -0000	1.61
+++ objfiles.h	14 Aug 2009 16:08:50 -0000
@@ -414,6 +414,12 @@ struct objfile
 
 #define OBJF_USERLOADED	(1 << 3)	/* User loaded */
 
+/* This objfile is not mapped into the process address space. We only have it
+   for its debug bits.  One example is MACH-O ("other source") object
+   files.  */
+
+#define OBJF_NOT_MAPPED (1 << 4)        /* Not mapped */
+
 /* The object file that the main symbol table was loaded from (e.g. the
    argument to the "symbol-file" or "file" command).  */
 

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

end of thread, other threads:[~2009-08-21  7:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-14 16:32 [patch] Fix Darwin breakage Paul Pluzhnikov
2009-08-14 17:56 ` Paul Pluzhnikov
2009-08-14 19:09   ` Tom Tromey
2009-08-14 18:32 ` Tom Tromey
2009-08-14 19:15   ` Paul Pluzhnikov
2009-08-18 12:24 ` Christian Thalinger
2009-08-18 16:17   ` Paul Pluzhnikov
2009-08-20 17:01     ` Christian Thalinger
2009-08-20 17:09       ` Paul Pluzhnikov
2009-08-20 17:16         ` Christian Thalinger
2009-08-21 11:30         ` Christian Thalinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox