Changeset 804


Ignore:
Timestamp:
Oct 5, 2003, 6:04:56 AM (22 years ago)
Author:
bird
Message:

#456: Two bool fixes. Make the type an enum. When passed as parameter it's
32bit, but GCC moves it to a 8bit auto variable - thus GCC generates two stabs
for it. Debugger needs a { between them to see both.
#456: Made fake struct for struct/class forward declarations. (stupid GCC)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxomf/stabshll.c

    • Property cvs2svn:cvs-rev changed from 1.25 to 1.26
    r803 r804  
    13131313  t.d.types.list = list;
    13141314  t1 = type_add (&t);
     1315  free (list);
    13151316
    13161317  t = *tp;
     
    16501651        t.index = 0x80;         /* 8 bit signed */
    16511652      else if (range_lo == -32768 && range_hi == 32767)
    1652         t.index = 0x80;         /* 16 bit signed */
     1653        t.index = 0x81;         /* 16 bit signed */
    16531654      else if (range_lo == -2147483647 - 1 && range_hi == 2147483647)
    16541655        t.index = 0x82;         /* 32 bit signed */
     
    18671868          if (size == 8 && code == -16)
    18681869            {
     1870#if 0 /* debugger doesn't understand this game */
    18691871              t.tag = ty_prim;
    18701872              t.index = 0x90;   /* 8 bit boolean */
     1873#else
     1874              t.tag = ty_values;
     1875              t.d.values.count = 2;
     1876              t.d.values.list = xmalloc (2 * sizeof (*t.d.values.list));
     1877              t.d.values.list[0].index = 0;
     1878              t.d.values.list[0].name  = strpool_add (str_pool, "false");
     1879              t.d.values.list[1].index = 1;
     1880              t.d.values.list[1].name  = strpool_add (str_pool, "true");
     1881              t1 = type_add (&t);
     1882              free (t.d.values.list);
     1883
     1884              t.tag = ty_prim;
     1885              t.index = 0x80;
     1886              t2 = type_add (&t);
     1887
     1888              t.tag = ty_enu;
     1889              t.index = -1;
     1890              t.d.enu.values = t1;
     1891              t.d.enu.type = t2;
     1892              t.d.enu.name = add_struct_name (NULL);
     1893              t.d.enu.first = 0;
     1894              t.d.enu.last = 1;
     1895#endif
    18711896            }
    18721897          else
     
    19271952        case 'u':
    19281953          {
     1954            /* make a fake structure. */
     1955            t.tag = ty_prim;
     1956            t.index = 0x80;
     1957            tlist = xmalloc (1 * sizeof (*t.d.types.list));
     1958            tlist[0] = type_add (&t);
     1959            t.tag = ty_types;
     1960            t.index = -1;
     1961            t.d.types.count = 1;
     1962            t.d.types.list = tlist;
     1963            t1 = type_add (&t);
     1964            free (tlist);
     1965
     1966            t.tag = ty_fields;
     1967            t.index = -1;
     1968            t.d.fields.count = 1;
     1969            t.d.fields.list = xmalloc (1 * sizeof (*t.d.fields.list));
     1970            t.d.fields.list[0].offset = 0;
     1971            t.d.fields.list[0].name = strpool_add (str_pool, "This_Is_an_Incomplete_Structure_SORRY");
     1972            t2 = type_add (&t);
     1973            free (t.d.fields.list);
     1974
    19291975            t.tag = ty_struc;
    1930             t.d.struc.types = NULL;
    1931             t.d.struc.fields = NULL;
    1932             t.d.struc.size = 0;
    1933             t.d.struc.count = 0;
     1976            t.index = -1;
     1977            t.d.struc.types = t1;
     1978            t.d.struc.fields = t2;
     1979            t.d.struc.size = 1;
     1980            t.d.struc.count = 1;
    19341981            t.d.struc.name = strpool_addn (str_pool, parse_ptr, p1 - parse_ptr);
    19351982            t.d.struc.flags = STRUC_FORWARD;
     
    20302077                  /* kso #456 2003-06-11: Don't mess with forward defines! */
    20312078                  if (!(   (t1->d.struc.flags & STRUC_FORWARD)
    2032                         && t1->d.struc.types == NULL
    2033                         && t1->d.struc.fields == NULL))
     2079                        /*&& t1->d.struc.types == NULL
     2080                        && t1->d.struc.fields == NULL*/))
    20342081                    struct_to_class (t1);
    20352082                  break;
     
    22962343          for (t3 = type_head; t3 != NULL; t3 = t3->next)
    22972344            if (t3->tag == ty_struc && t3->d.struc.name == t.d.class.name
    2298                 && t3->d.struc.types == NULL && t3->d.struc.fields == NULL
     2345                /*&& t3->d.struc.types == NULL && t3->d.struc.fields == NULL */
    22992346                && (t3->d.struc.flags & STRUC_FORWARD))
    23002347              {
     
    23262373            }
    23272374          t2 = type_add (&t);
     2375          free (t.d.fields.list);
    23282376
    23292377          t.tag = ty_struc;
     
    23402388          for (t3 = type_head; t3 != NULL; t3 = t3->next)
    23412389            if (t3->tag == ty_struc && t3->d.struc.name == t.d.struc.name
    2342                 && t3->d.struc.types == NULL && t3->d.struc.fields == NULL
     2390                /* && t3->d.struc.types == NULL && t3->d.struc.fields == NULL */
    23432391                && (t3->d.struc.flags & STRUC_FORWARD))
    23442392              {
     
    23932441        }
    23942442      t1 = type_add (&t);
     2443      free (t.d.values.list);
    23952444
    23962445      t.tag = ty_prim;
     
    26192668          t.d.types.list = list;
    26202669          t1 = type_add (&t);
     2670          free (list);
    26212671
    26222672          make_type (t1, &ti_1);
     
    31443194      hll_end (block_stack[block_grow.count].patch_ptr, 0,
    31453195               sym_ptr[i].n_value - block_stack[block_grow.count].addr);
     3196      if (block_grow.count == 1) /* we make one extra begin */
     3197        {
     3198          --block_grow.count;
     3199          hll_end (block_stack[block_grow.count].patch_ptr, 0,
     3200                   sym_ptr[i].n_value - block_stack[block_grow.count].addr);
     3201        }
    31463202      if (block_grow.count == 0 && proc_patch_base != 0)
    31473203        fun_end (i);
     
    31713227    abort ();
    31723228  n = p - str;
    3173   name = strpool_addn(str_pool, str, n);
     3229
     3230  /*
     3231   * The debuggers doesn't like looong names. Besides it doesn't know how to
     3232   * demangle them either. This is the place to deal with this.
     3233   * (The limit seems to be 106 bytes.)
     3234   *
     3235   * For now we'll just make sure the name ain't too long.
     3236   */
     3237  if (n > 106)
     3238    {
     3239      char szName[106];
     3240      memcpy(szName, str, sizeof(szName) - 1);
     3241      szName[sizeof(szName) - 1] = '!'; /* mark it as cut. */
     3242      name = strpool_addn(str_pool, str, sizeof(szName));
     3243    }
     3244  else
     3245    name = strpool_addn(str_pool, str, n);
    31743246
    31753247  proc_start_addr = symbol->n_value;
     
    35763648
    35773649          /* Now look for N_LBRAC */
    3578 
    35793650          next_lbrac (i);
    35803651          if (lbrac_index != -1)
     
    35853656          else
    35863657            {/* kso #456 2003-06-05: We need a begin to catch the parameters. */
    3587               struct relocation_info r = {0};
    3588               sst_start (SST_begin);
    3589               r.r_address = sst.size;
    3590               buffer_dword (&sst, proc_start_addr);         /* Segment offset */
    3591               buffer_dword (&sst, text_size - proc_start_addr); /* Length */
    3592               sst_end ();
    3593               r.r_length = 2;
    3594               r.r_symbolnum = N_TEXT;
    3595               buffer_mem (&sst_reloc, &r, sizeof (r));
    35963658              prologue_length = 0;
     3659              block_begin (proc_start_addr);
    35973660            }
    35983661
    35993662          /* Parameters */
    3600 
    36013663          while (*index + 1 < sym_count && sym_ptr[*index+1].n_type == N_PSYM)
    36023664            {
     
    36053667            }
    36063668
     3669          /* Start another block for the local variables. This is to work
     3670             around some missing bracets in stabs and to fix problem with
     3671             C++ bool type.  */
     3672          dword addr = proc_start_addr + prologue_length;
     3673          if (lbrac_index >= 0 && sym_ptr[lbrac_index].n_value > addr)
     3674            addr = sym_ptr[lbrac_index].n_value;
     3675          block_begin (addr);
     3676
     3677          /* Local variables  (fix for boolparam testcase too). */
     3678          while (*index + 1 < sym_count && sym_ptr[*index+1].n_type == N_LSYM)
     3679            {
     3680              ++(*index);
     3681              parse_symbol (index, -1, "LSYM", TRUE);
     3682            }
     3683
    36073684          /* If there's no N_LBRAC, write SST_end now */
    3608 
    36093685          if (lbrac_index == -1)
    36103686            {/* kso #456 2003-06-05: We need a begin to catch the parameters. */
    3611               //block_end (proc_start_addr);
    3612               sst_start (SST_end);
    3613               sst_end ();
    3614               fun_end (*index+1);
     3687              while (block_grow.count > 0)
     3688                block_end (*index+1);
    36153689            }
    36163690          break;
Note: See TracChangeset for help on using the changeset viewer.