/[gcl]/gcl/o/unexmacosx.c
ViewVC logotype

Diff of /gcl/o/unexmacosx.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by camm, Thu Sep 4 15:13:35 2003 UTC revision 1.3 by rlbk, Thu Sep 4 21:45:52 2003 UTC
# Line 98  Boston, MA 02111-1307, USA.  */ Line 98  Boston, MA 02111-1307, USA.  */
98  #include <mach-o/loader.h>  #include <mach-o/loader.h>
99  #include <objc/malloc.h>  #include <objc/malloc.h>
100    
101    #include <sys/mman.h>
102    
103  #define VERBOSE 1  #define VERBOSE 1
104    
105  /* Size of buffer used to copy data from the input file to the output  /* Size of buffer used to copy data from the input file to the output
# Line 475  static void Line 477  static void
477  print_load_command (struct load_command *lc)  print_load_command (struct load_command *lc)
478  {  {
479    print_load_command_name (lc->cmd);    print_load_command_name (lc->cmd);
480    printf ("%10lx", lc->cmdsize);    printf ("%#10lx", lc->cmdsize);
481    
482    if (lc->cmd == LC_SEGMENT)    if (lc->cmd == LC_SEGMENT)
483      {      {
# Line 484  print_load_command (struct load_command Line 486  print_load_command (struct load_command
486        int j;        int j;
487    
488        scp = (struct segment_command *) lc;        scp = (struct segment_command *) lc;
489        printf (" %-16.16s %#10lx %#8lx\n",        printf (" %-16.16s %#10lx %#10lx\n",
490                scp->segname, scp->vmaddr, scp->vmsize);                scp->segname, scp->vmaddr, scp->vmsize);
491    
492        sectp = (struct section *) (scp + 1);        sectp = (struct section *) (scp + 1);
493        for (j = 0; j < scp->nsects; j++)        for (j = 0; j < scp->nsects; j++)
494          {          {
495            printf ("                           %-16.16s %#10lx %#8lx\n",            printf ("                               %-16.16s %#10lx %#10lx\n",
496                    sectp->sectname, sectp->addr, sectp->size);                    sectp->sectname, sectp->addr, sectp->size);
497            sectp++;            sectp++;
498          }          }
# Line 567  read_load_commands () Line 569  read_load_commands ()
569            text_seg_lowest_offset);            text_seg_lowest_offset);
570    
571    printf ("--- List of Load Commands in Input File ---\n");    printf ("--- List of Load Commands in Input File ---\n");
572    printf ("# cmd              cmdsize name                address     size\n");    printf ("no cmd                 cmdsize name                address       size\n");
573    
574    for (i = 0; i < nlc; i++)    for (i = 0; i < nlc; i++)
575      {      {
576        printf ("%1d ", i);        printf ("%#2d ", i);
577        print_load_command (lca[i]);        print_load_command (lca[i]);
578      }      }
579  }  }
# Line 992  unexec_init_emacs_zone () Line 994  unexec_init_emacs_zone ()
994    }    }
995  }  }
996    
997  static size_t stub_size (malloc_zone_t *zone, const void *ptr) {  static size_t stub_size (malloc_zone_t *zone, const void *ptr)
998      extern size_t my_size (const void *);  {
999      return my_size (ptr);      object *p;
1000        extern object malloc_list;
1001        
1002        for (p = &malloc_list ; *p && !endp(*p) ; p = &((*p)->c.c_cdr)) {
1003            if ((*p)->c.c_car->st.st_self == ptr) {
1004                return ((*p)->c.c_car->st.st_dim);
1005            }
1006        }
1007        return (0);
1008  }  }
1009    
1010  static void *stub_malloc (malloc_zone_t *zone, size_t size) {  static void *stub_malloc (malloc_zone_t *zone, size_t size)
1011    {
1012      extern void *my_malloc (size_t);      extern void *my_malloc (size_t);
1013      return my_malloc (size);      return my_malloc (size);
1014  }  }
1015    
1016  static void *stub_calloc (malloc_zone_t *zone, size_t num_items, size_t size) {  static void *stub_calloc (malloc_zone_t *zone, size_t num_items, size_t size)
1017    {
1018      extern void *my_calloc (size_t, size_t);      extern void *my_calloc (size_t, size_t);
1019      return my_calloc (num_items, size);      return my_calloc (num_items, size);
1020  }  }
1021    
1022  static void *stub_valloc (malloc_zone_t *zone, size_t size) {  static void *stub_valloc (malloc_zone_t *zone, size_t size)
1023    {
1024      extern void *my_valloc (size_t);      extern void *my_valloc (size_t);
1025      return my_valloc (size);      return my_valloc (size);
1026  }  }
1027    
1028  static void *stub_realloc (malloc_zone_t *zone, void *ptr, size_t size) {  static void *stub_realloc (malloc_zone_t *zone, void *ptr, size_t size)
1029    {
1030      extern void *my_realloc (void *, size_t);      extern void *my_realloc (void *, size_t);
1031      return my_realloc (ptr, size);      return my_realloc (ptr, size);
1032  }  }
1033    
1034  static void stub_free (malloc_zone_t *zone, void *ptr) {  static void stub_free (malloc_zone_t *zone, void *ptr)
1035    {
1036      extern void my_free (void *ptr);      extern void my_free (void *ptr);
1037      my_free (ptr);      my_free (ptr);
1038  }  }
# Line 1074  char *my_sbrk (int incr) Line 1089  char *my_sbrk (int incr)
1089          }          }
1090          mark_region ((unsigned long) mach_brkpt, (unsigned long) big_heap);          mark_region ((unsigned long) mach_brkpt, (unsigned long) big_heap);
1091                    
1092          mach_mapstart = mach_brkpt;          mach_mapstart = mach_brkpt;
1093          mach_maplimit = mach_brkpt + big_heap;          mach_maplimit = mach_brkpt + big_heap;
1094      }      }
1095      if (incr == 0) {      if (incr == 0) {
1096          return (mach_brkpt);          return (mach_brkpt);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26