diff options
| author | Ben Cheng <bccheng@android.com> | 2010-03-09 22:32:03 -0800 |
|---|---|---|
| committer | Ben Cheng <bccheng@android.com> | 2010-03-09 22:32:03 -0800 |
| commit | 2a9413710c94405d35722b4134532f1ae1e87b42 (patch) | |
| tree | f3dce0b96867975ab52b5d722d7a548fca4311ec /tools | |
| parent | 699c9eb5630d4016a984f5b501a7171848e8daa9 (diff) | |
| download | android_dalvik-2a9413710c94405d35722b4134532f1ae1e87b42.tar.gz android_dalvik-2a9413710c94405d35722b4134532f1ae1e87b42.tar.bz2 android_dalvik-2a9413710c94405d35722b4134532f1ae1e87b42.zip | |
Align fake data in the same page offsets as those in the bugreport.
Sometimes the crash in the JIT'ed code is due to CPU bugs which are sensitive
to placement of the code.
Change-Id: I017ec3620f8172e2fac9e7abfa07f76b65db2306
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/gdbjithelper/gdbjithelper.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/tools/gdbjithelper/gdbjithelper.c b/tools/gdbjithelper/gdbjithelper.c index d0f9ce385..862fcae2f 100644 --- a/tools/gdbjithelper/gdbjithelper.c +++ b/tools/gdbjithelper/gdbjithelper.c @@ -16,6 +16,11 @@ #include <unistd.h> #include <stdio.h> +#include <malloc.h> +#include <string.h> + +/* Currently debuggerd dumps 20 words each around PC and LR */ +#define NUM_DUMPED_WORDS 20 volatile int done; @@ -63,22 +68,39 @@ int codeLR[] = { 0x4284aa7a, 0xf927f7b7, 0x40112268, 0x419da7f8, }; -void dumpCode() +/* For example: 463ba1e4 & 0xfff */ +#define START_PC_PAGE_OFFSET 0x1e4 + +/* For example: 463ba1a8 & 0xfff */ +#define START_LR_PAGE_OFFSET 0x1a8 + +/* Each points to a two-page buffer */ +char *codePCCache, *codeLRCache; + +void dumpCode(int *pc, int *lr) { unsigned int i; - for (i = 0; i < sizeof(codePC)/sizeof(int); i++) { - printf("codePC[%d]: %#x\n", i, codePC[i]); + for (i = 0; i < NUM_DUMPED_WORDS; i++) { + printf("%p codePC[%d]: %#010x\n", pc + i, i, pc[i]); } - for (i = 0; i < sizeof(codeLR)/sizeof(int); i++) { - printf("codeLR[%d]: %#x\n", i, codeLR[i]); + for (i = 0; i < NUM_DUMPED_WORDS; i++) { + printf("%p codeLR[%d]: %#010x\n", lr + i, i, lr[i]); } } int main() { - dumpCode(); + codePCCache = memalign(4096, 8192); + codeLRCache = memalign(4096, 8192); + + memcpy(codePCCache + START_PC_PAGE_OFFSET, codePC, 4 * NUM_DUMPED_WORDS); + memcpy(codeLRCache + START_LR_PAGE_OFFSET, codeLR, 4 * NUM_DUMPED_WORDS); + + dumpCode((int *) (codePCCache + START_PC_PAGE_OFFSET), + (int *) (codeLRCache + START_LR_PAGE_OFFSET)); + while (!done) { sleep(1000); } |
