Set debugging option based on NO_TRACE_MSGS define. Only output 32-bit

relay stubs if debugging is on.
This commit is contained in:
Alexandre Julliard 2000-11-27 23:48:08 +00:00
parent c77cbbcd1f
commit 1a5e22f558
3 changed files with 66 additions and 57 deletions

View File

@ -418,6 +418,7 @@ void RELAY_SetupDLL( const char *module )
int on = 1; int on = 1;
if (!debug->call) continue; /* not a normal function */ if (!debug->call) continue; /* not a normal function */
if (debug->call != 0xe8 && debug->call != 0xe9) break; /* not a debug thunk at all */
if ((name = find_exported_name( module, exports, i + exports->Base ))) if ((name = find_exported_name( module, exports, i + exports->Base )))
{ {

View File

@ -28,10 +28,16 @@ int DLLHeapSize = 0;
int UsePIC = 0; int UsePIC = 0;
int nb_entry_points = 0; int nb_entry_points = 0;
int nb_names = 0; int nb_names = 0;
int debugging = 1;
int nb_debug_channels = 0; int nb_debug_channels = 0;
int nb_lib_paths = 0; int nb_lib_paths = 0;
/* we only support relay debugging on i386 */
#if defined(__i386__) && !defined(NO_TRACE_MSGS)
int debugging = 1;
#else
int debugging = 0;
#endif
char DLLName[80]; char DLLName[80];
char DLLFileName[80]; char DLLFileName[80];
char DLLInitFunc[80]; char DLLInitFunc[80];

View File

@ -136,16 +136,17 @@ static void output_exports( FILE *outfile, int nr_exports, int fwd_size )
} }
fprintf( outfile, " } exp;\n" ); fprintf( outfile, " } exp;\n" );
#ifdef __i386__ if (debugging)
fprintf( outfile, " struct {\n" ); {
fprintf( outfile, " unsigned char jmp;\n" ); fprintf( outfile, " struct {\n" );
fprintf( outfile, " unsigned char addr[4];\n" ); fprintf( outfile, " unsigned char jmp;\n" );
fprintf( outfile, " unsigned char ret;\n" ); fprintf( outfile, " unsigned char addr[4];\n" );
fprintf( outfile, " unsigned short args;\n" ); fprintf( outfile, " unsigned char ret;\n" );
fprintf( outfile, " func_ptr orig;\n" ); fprintf( outfile, " unsigned short args;\n" );
fprintf( outfile, " unsigned int argtypes;\n" ); fprintf( outfile, " func_ptr orig;\n" );
fprintf( outfile, " } relay[%d];\n", nr_exports ); fprintf( outfile, " unsigned int argtypes;\n" );
#endif /* __i386__ */ fprintf( outfile, " } relay[%d];\n", nr_exports );
}
fprintf( outfile, "} exports = {\n {\n" ); fprintf( outfile, "} exports = {\n {\n" );
fprintf( outfile, " 0,\n" ); /* Characteristics */ fprintf( outfile, " 0,\n" ); /* Characteristics */
@ -248,57 +249,58 @@ static void output_exports( FILE *outfile, int nr_exports, int fwd_size )
/* output relays */ /* output relays */
#ifdef __i386__ if (debugging)
fprintf( outfile, " },\n {\n" );
for (i = Base; i <= Limit; i++)
{ {
ORDDEF *odp = Ordinals[i]; fprintf( outfile, " },\n {\n" );
unsigned int j, mask = 0; for (i = Base; i <= Limit; i++)
/* skip non-existent entry points */
if (!odp) goto ignore;
/* skip non-functions */
if ((odp->type != TYPE_STDCALL) &&
(odp->type != TYPE_CDECL) &&
(odp->type != TYPE_REGISTER)) goto ignore;
/* skip norelay entry points */
if (odp->flags & FLAG_NORELAY) goto ignore;
for (j = 0; odp->u.func.arg_types[j]; j++)
{ {
if (odp->u.func.arg_types[j] == 't') mask |= 1<< (j*2); ORDDEF *odp = Ordinals[i];
if (odp->u.func.arg_types[j] == 'W') mask |= 2<< (j*2); unsigned int j, mask = 0;
}
if ((odp->flags & FLAG_RET64) && (j < 16)) mask |= 0x80000000;
switch(odp->type) /* skip non-existent entry points */
{ if (!odp) goto ignore;
case TYPE_STDCALL: /* skip non-functions */
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc2, 0x%04x, %s, 0x%08x }", if ((odp->type != TYPE_STDCALL) &&
strlen(odp->u.func.arg_types) * sizeof(int), (odp->type != TYPE_CDECL) &&
odp->u.func.link_name, mask ); (odp->type != TYPE_REGISTER)) goto ignore;
break; /* skip norelay entry points */
case TYPE_CDECL: if (odp->flags & FLAG_NORELAY) goto ignore;
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc3, 0x%04x, %s, 0x%08x }",
strlen(odp->u.func.arg_types) * sizeof(int),
odp->u.func.link_name, mask );
break;
case TYPE_REGISTER:
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc3, 0x%04x, %s, 0x%08x }",
0x8000 | (strlen(odp->u.func.arg_types) * sizeof(int)),
make_internal_name( odp, "regs" ), mask );
break;
default:
assert(0);
}
goto done;
ignore: for (j = 0; odp->u.func.arg_types[j]; j++)
fprintf( outfile, " { 0, { 0,0,0,0 }, 0, 0, 0, 0 }" ); {
done: if (odp->u.func.arg_types[j] == 't') mask |= 1<< (j*2);
if (i < Limit) fprintf( outfile, ",\n" ); if (odp->u.func.arg_types[j] == 'W') mask |= 2<< (j*2);
}
if ((odp->flags & FLAG_RET64) && (j < 16)) mask |= 0x80000000;
switch(odp->type)
{
case TYPE_STDCALL:
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc2, 0x%04x, %s, 0x%08x }",
strlen(odp->u.func.arg_types) * sizeof(int),
odp->u.func.link_name, mask );
break;
case TYPE_CDECL:
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc3, 0x%04x, %s, 0x%08x }",
strlen(odp->u.func.arg_types) * sizeof(int),
odp->u.func.link_name, mask );
break;
case TYPE_REGISTER:
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc3, 0x%04x, %s, 0x%08x }",
0x8000 | (strlen(odp->u.func.arg_types) * sizeof(int)),
make_internal_name( odp, "regs" ), mask );
break;
default:
assert(0);
}
goto done;
ignore:
fprintf( outfile, " { 0, { 0,0,0,0 }, 0, 0, 0, 0 }" );
done:
if (i < Limit) fprintf( outfile, ",\n" );
}
} }
#endif /* __i386__ */
fprintf( outfile, " }\n};\n\n" ); fprintf( outfile, " }\n};\n\n" );