Last active
September 30, 2015 16:37
-
-
Save monkbroc/51e9d165d04183e607af to your computer and use it in GitHub Desktop.
Start GDB for the Photon with symbols for all 3 parts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
READELF=arm-none-eabi-readelf | |
GDB=arm-none-eabi-gdb | |
COMMON_BUILD=~/Programming/Photon/build | |
PLATFORM_ID=6 | |
LTO= | |
function elf { | |
echo $COMMON_BUILD/target/$1/platform-$PLATFORM_ID-m$LTO/$1.elf | |
} | |
SYSTEM_PART1_ELF=$(elf system-part1) | |
SYSTEM_PART2_ELF=$(elf system-part2) | |
USER_PART_ELF=$(elf user-part) | |
function text_section_address { | |
$READELF $1 --headers | grep .text | head -n 1 | sed "s/.*PROGBITS *\\([^ ]*\\).*/0x\\1/" | |
} | |
SYSTEM_PART1_ADDRESS=$(text_section_address $SYSTEM_PART1_ELF) | |
SYSTEM_PART2_ADDRESS=$(text_section_address $SYSTEM_PART2_ELF) | |
USER_PART_ADDRESS=$(text_section_address $USER_PART_ELF) | |
$GDB \ | |
-ex "target remote localhost:3333" \ | |
-ex "set confirm off" \ | |
-ex "add-symbol-file $SYSTEM_PART1_ELF $SYSTEM_PART1_ADDRESS" \ | |
-ex "add-symbol-file $SYSTEM_PART2_ELF $SYSTEM_PART2_ADDRESS" \ | |
-ex "add-symbol-file $USER_PART_ELF $USER_PART_ADDRESS" \ | |
-ex "set confirm on" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comments on simplifying this script would be appreciated. 🙌