BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TDUMP loses track of seg names with > 255 segs

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Jan 26, 2007 4:51 am    Post subject: TDUMP loses track of seg names with > 255 segs Reply with quote



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;
}
Back to top
Guest






PostPosted: Fri Jan 26, 2007 5:01 am    Post subject: Additional diagnostic data Reply with quote



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 (AT) bellsouth (DOT) net> wrote in message
news:45b931cb (AT) newsgroups (DOT) borland.com...
Quote:
The program below can be used to generate a .ASM file that will induce
this
problem when assembled into .OBJ
...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.