jitdump.c (9b07e27f88b9cd785cdb23f9a2231c12521dda94) | jitdump.c (598b7c6919c7bbcc1243009721a01bc12275ff3e) |
---|---|
1#include <sys/types.h> 2#include <stdio.h> 3#include <stdlib.h> 4#include <string.h> 5#include <fcntl.h> 6#include <unistd.h> 7#include <inttypes.h> 8#include <byteswap.h> --- 49 unchanged lines hidden (view full) --- 58#define hmax(a, b) ((a) > (b) ? (a) : (b)) 59#define get_jit_tool(t) (container_of(tool, struct jit_tool, tool)) 60 61static int 62jit_emit_elf(char *filename, 63 const char *sym, 64 uint64_t code_addr, 65 const void *code, | 1#include <sys/types.h> 2#include <stdio.h> 3#include <stdlib.h> 4#include <string.h> 5#include <fcntl.h> 6#include <unistd.h> 7#include <inttypes.h> 8#include <byteswap.h> --- 49 unchanged lines hidden (view full) --- 58#define hmax(a, b) ((a) > (b) ? (a) : (b)) 59#define get_jit_tool(t) (container_of(tool, struct jit_tool, tool)) 60 61static int 62jit_emit_elf(char *filename, 63 const char *sym, 64 uint64_t code_addr, 65 const void *code, |
66 int csize) | 66 int csize, 67 void *debug, 68 int nr_debug_entries) |
67{ 68 int ret, fd; 69 70 if (verbose > 0) 71 fprintf(stderr, "write ELF image %s\n", filename); 72 73 fd = open(filename, O_CREAT|O_TRUNC|O_WRONLY, 0644); 74 if (fd == -1) { 75 pr_warning("cannot create jit ELF %s: %s\n", filename, strerror(errno)); 76 return -1; 77 } 78 | 69{ 70 int ret, fd; 71 72 if (verbose > 0) 73 fprintf(stderr, "write ELF image %s\n", filename); 74 75 fd = open(filename, O_CREAT|O_TRUNC|O_WRONLY, 0644); 76 if (fd == -1) { 77 pr_warning("cannot create jit ELF %s: %s\n", filename, strerror(errno)); 78 return -1; 79 } 80 |
79 ret = jit_write_elf(fd, code_addr, sym, (const void *)code, csize); | 81 ret = jit_write_elf(fd, code_addr, sym, (const void *)code, csize, debug, nr_debug_entries); |
80 81 close(fd); 82 83 if (ret) 84 unlink(filename); 85 86 return ret; 87} --- 254 unchanged lines hidden (view full) --- 342 jd->dir, 343 pid, 344 count); 345 346 size++; /* for \0 */ 347 348 size = PERF_ALIGN(size, sizeof(u64)); 349 uaddr = (uintptr_t)code; | 82 83 close(fd); 84 85 if (ret) 86 unlink(filename); 87 88 return ret; 89} --- 254 unchanged lines hidden (view full) --- 344 jd->dir, 345 pid, 346 count); 347 348 size++; /* for \0 */ 349 350 size = PERF_ALIGN(size, sizeof(u64)); 351 uaddr = (uintptr_t)code; |
350 ret = jit_emit_elf(filename, sym, addr, (const void *)uaddr, csize); | 352 ret = jit_emit_elf(filename, sym, addr, (const void *)uaddr, csize, jd->debug_data, jd->nr_debug_entries); |
351 352 if (jd->debug_data && jd->nr_debug_entries) { 353 free(jd->debug_data); 354 jd->debug_data = NULL; 355 jd->nr_debug_entries = 0; 356 } 357 358 if (ret) { --- 312 unchanged lines hidden --- | 353 354 if (jd->debug_data && jd->nr_debug_entries) { 355 free(jd->debug_data); 356 jd->debug_data = NULL; 357 jd->nr_debug_entries = 0; 358 } 359 360 if (ret) { --- 312 unchanged lines hidden --- |