Changeset 309


Ignore:
Timestamp:
Jun 10, 2003, 7:42:21 PM (22 years ago)
Author:
bird
Message:

#456: duplicate public text symbol _main as main so the debugger can find where to start debugging.

File:
1 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r308 r309  
    12831283}
    12841284
     1285/* Write main alias if _main is a pubdef.
     1286   The debugger looks for 'main' not '_main' in the symbol table. */
     1287static void write_pubdef_main ()
     1288{
     1289    int i;
     1290
     1291    if (opt_rmunder || strip_symbols)
     1292        return;
     1293
     1294    for (i = 0; i < sym_count; ++i)
     1295      if ((sym_ptr[i].n_type & ~N_EXT) == N_TEXT)
     1296        {
     1297          const char * name    = str_ptr + sym_ptr[i].n_un.n_strx;
     1298          dword        address = sym_ptr[i].n_value;
     1299          if (   (sym_ptr[i].n_type & N_EXT)
     1300              && !strcmp(name, "_main"))
     1301            {
     1302              int big = ((address >= 0x10000 || force_big) == big);
     1303
     1304              name++; /* skip the underscore */
     1305              if (out_lib != NULL)
     1306                {
     1307                  if (omflib_add_pub (out_lib, name, mod_page, lib_errmsg) != 0)
     1308                    error (lib_errmsg);
     1309                }
     1310              init_rec (big ? PUBDEF|REC32 : PUBDEF);
     1311              put_idx (flat_index);
     1312              put_idx (text_index);
     1313              put_sym (name);
     1314              if (big)
     1315                put_32 (address);
     1316              else
     1317                put_16 (address);
     1318              put_idx (0);        /* type index */
     1319              write_rec ();
     1320              break;
     1321            }
     1322        }
     1323}
    12851324
    12861325/* Write PUBDEF records into the output file for all the public N_TEXT
     
    12921331  write_pubdef1 (N_TEXT, text_index, FALSE, 0);
    12931332  write_pubdef1 (N_TEXT, text_index, TRUE, 0);
     1333  /* kso #456 2003-06-10: The debugger looks for 'main' not '_main'. */
     1334  write_pubdef_main ();
    12941335  write_pubdef1 (N_DATA, udat_index, FALSE, text_size);
    12951336  write_pubdef1 (N_DATA, udat_index, TRUE, text_size);
Note: See TracChangeset for help on using the changeset viewer.