Groups > Borland > Borland C plus plus builder command line tools > Additional diagnostic data




TDUMP loses track of seg names with > 255 segs

TDUMP loses track of seg names with > 255 segs
Thu, 25 Jan 2007 17:51:38 -050
The program below can be used to generate a .ASM file that will induce this
problem when assembled into .OBJ

Compile it into MAKEMA32.EXE and run it redirecting it's output into a file
MANY.ASM like this:

MAKEMA32 500 4 > MANY.ASM

Assemble MANY.ASM with TASM32

Use TDUMP to look at the resultant OBJ.

This was induced on 2006 Architect trial.
----------------------------------- Cut here -------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>

#define MAXSEGS  256
#define MAXBYTES 1

typedef unsigned long ULONG;

static void usage(void)
 {
 printf("usage: MAKEMA32 [/?][nnnn][dddd]\n"
  "/?   - this help\n"
  "nnnn - create .ASM file (to stdout) with nnnn segments\n"
  "dddd - number of bytes to insert in each segment\n"
  " \n"
  "Default nnnn=%lu\n"
  "Default dddd=%lu\n",
   MAXSEGS,MAXBYTES
  );
 exit(-1);
 }

int main(int argc, char *argv[], char *envp[])
 {
 ULONG nsegs  = MAXSEGS;
 ULONG nbytes = MAXSEGS;
 ULONG i;
 char  Use32;

 if (argc > 1)
  {
  if (strncmp("/?", argv[1], 2) == 0)
   usage();
  nsegs = atol(argv[1]);
  if (argc > 2)
   nbytes = atol(argv[2]);
  }

 Use32 = (nbytes > 65536L) ? 1 : 0;

 if (Use32)
  printf(".386\n");
 for (i=0L; i<nsegs; i++)
  {
  if (Use32)
   printf("SEG%05ld SEGMENT USE32 PARA PUBLIC 'CODE'\n", i);
  else
   printf("SEG%05ld SEGMENT PARA PUBLIC 'CODE'\n", i);

  if (nbytes < 65536L)
   printf("\tdb %lu DUP(0)\n",nbytes);
  else if (Use32)
   {
   printf("\tdb %lu DUP(0)\n",nbytes);
   printf("LAB%d LABEL NEAR\n",i);
   printf("\tPUBLIC LAB%d\n",i);
   printf("\t NOP\n");
   printf("LAB%d_1 LABEL NEAR\n",i);
   printf("\tPUBLIC LAB%d_1\n",i);
   printf("\t NOP\n");
   }
  else if (nbytes == 65536L)
   {
   printf("\tdb %lu DUP(0)\n",nbytes-1);
   printf("\tdb 0\n");
   }
  else
   {
   printf("WTF????\n");
   }
  printf("SEG%05ld ENDS\n",i);
  printf(" \n\n");
  }

 printf("STARTSEG SEGMENT PARA PUBLIC 'CODE'\n");
   printf("START LABEL FAR\n");
 printf("\tASSUME CS:STARTSEG ; Older MASM's puke without this
ASSUME\n");
 printf("\tASSUME DS:NOTHING\n");
 printf("\tASSUME ES:NOTHING\n");
 printf("\tPUSH CS\n");
 printf("\tPOP  SS\n");
 printf("\tMOV  SP, 1000\n");
   printf("\tCALL GETMSG\n");
 printf("\tdb 'Hello from MANY.ASM',13,10,'$'\n");
 printf("GETMSG LABEL NEAR\n");
 printf("\tPOP DX\n");
 printf("\tPUSH CS\n");
 printf("\tPOP  DS\n");
 printf("\tMOV AH, 9\n");
 printf("\tINT 21H\n");
 printf("\tMOV AX,4C00H\n");
 printf("\tINT 21H\n");
 printf("\tDB  1500 dup (0)\n");
 printf("STARTSEG ENDS\n");

 printf("END START\n");
 return 0;
 }

Post Reply
Additional diagnostic data
Thu, 25 Jan 2007 18:01:15 -050
I should say it seems to be picking them up OK through the SEGDEF's:

blah, blah, blah....
003A32 LNAMES
    Name 998: 'SEG00498'
    Name 999: 'CODE'
003A44 SEGDEF 499: SEG00498        PARA  PUBLIC  Class 'CODE'  Length: 0004
003A50 LNAMES
    Name 1000: 'SEG00499'
    Name 1001: 'CODE'
blah, blah, blah....

But loses track of the seg names in the LE/LIDATA records:

004BDE LIDATA
  Segment: SEG00253       Offset: 0000
    Repeat     4. times,     1. Blocks
    Repeat     1. times,     1. Bytes
    0000: 00                                                 .
004BF0 LIDATA
  Segment: SEG00254       Offset: 0000
    Repeat     4. times,     1. Blocks
    Repeat     1. times,     1. Bytes
    0000: 00                                                 .
004C02 LIDATA
  Segment: Unknown_SegNameOffset: 0000     <<------- HERE
    Repeat     4. times,     1. Blocks
    Repeat     1. times,     1. Bytes
    0000: 00                                                 .
004C14 LIDATA
  Segment: Unknown_SegNameOffset: 0000
    Repeat     4. times,     1. Blocks
    Repeat     1. times,     1. Bytes
    0000: 00

<cutaway@bellsouth.net> wrote in message
news:45b931cb@newsgroups.borland.com...
> The program below can be used to generate a .ASM file that will induce
this
> problem when assembled into .OBJ
> ...

Post Reply
about | contact