+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
#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
/*
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);
/*@
* @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.
*