diff options
| author | Ben Cheng <bccheng@android.com> | 2010-03-09 22:42:05 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2010-03-09 22:42:05 -0800 |
| commit | 154518bf766e0ce49c88b24c04fa300e6414b25d (patch) | |
| tree | f2919e6f994245f934a3647ddfdca41b4e761c06 /tools | |
| parent | 2f2ed90330e81b3f71f712209ef38582e44adab9 (diff) | |
| parent | f9135f326ac0556f1d6e8f9bcf161e4a6d618678 (diff) | |
am f9135f32: Merge "Align fake data in the same page offsets as those in the bugreport."
Merge commit 'f9135f326ac0556f1d6e8f9bcf161e4a6d618678' into dalvik-dev
* commit 'f9135f326ac0556f1d6e8f9bcf161e4a6d618678':
Align fake data in the same page offsets as those in the bugreport.
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); } |
