Browse Source

make dump work for any stream not just stdout and stderr

cache-refactoring
Aleksey Demakov 19 years ago
parent
commit
62d643164f
  1. 5
      ChangeLog
  2. 19
      jit/jit-dump.c

5
ChangeLog

@ -1,3 +1,8 @@
2006-05-04 Radek Polak <psonek2@seznam.cz>
* jit/jit-dump.c (dump_object_code): Now can dump to any stream
not just stdout and stderr.
2006-05-01 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-rules-x86.sel, jit/jit-rules-x86.ins: fix problem with

19
jit/jit-dump.c

@ -641,14 +641,14 @@ static void dump_interp_code(FILE *stream, void **pc, void **end)
#else /* !JIT_BACKEND_INTERP */
/*
* Dump the native object code representation of a function.
* Can only dump to stdout or stderr at the moment.
* Dump the native object code representation of a function to stream.
*/
static void dump_object_code(FILE *stream, void *start, void *end)
{
char cmdline[BUFSIZ];
unsigned char *pc = (unsigned char *)start;
FILE *file;
int ch;
#if JIT_WIN32_PLATFORM
/*
@ -693,9 +693,18 @@ static void dump_object_code(FILE *stream, void *start, void *end)
fclose(file);
sprintf(cmdline, "as %s -o %s", s_path, o_path);
system(cmdline);
sprintf(cmdline, "objdump --adjust-vma=%ld -d %s%s",
(long)(jit_nint)start, o_path, (stream == stderr ? " 1>&2" : ""));
sprintf(cmdline, "objdump --adjust-vma=%ld -d %s > %s",
(long)(jit_nint)start, o_path, s_path);
system(cmdline);
file = fopen(s_path, "r");
if(file)
{
while((ch = getc(file)) != EOF)
{
putc(ch, stream);
}
fclose(file);
}
unlink(s_path);
unlink(o_path);
putc('\n', stream);
@ -706,7 +715,7 @@ static void dump_object_code(FILE *stream, void *start, void *end)
/*@
* @deftypefun void jit_dump_function ({FILE *} stream, jit_function_t func, {const char *} name)
* Dump the three-address instructions within a function to a stdio stream.
* Dump the three-address instructions within a function to a stream.
* The @code{name} is attached to the output as a friendly label, but
* has no other significance.
*

Loading…
Cancel
Save