summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanh-arm <dan.handley@arm.com>2016-11-23 18:16:15 +0000
committerGitHub <noreply@github.com>2016-11-23 18:16:15 +0000
commit2fa94890aebe74f0279a4bb796471aaa049815d2 (patch)
tree2739ee3ced17e493128017b3e8b498f502388f2c
parent984d54bb6978f7897ce5ec7f7fa514a1475c4ab8 (diff)
parentb91d935feebdf2c3edef19949023645b6cb34b20 (diff)
Merge pull request #763 from douglas-raillard-arm/dr/add_debug_frame_info
Add CFI debug frame information for ASM functions
-rw-r--r--include/common/asm_macros_common.S21
1 files changed, 20 insertions, 1 deletions
diff --git a/include/common/asm_macros_common.S b/include/common/asm_macros_common.S
index 023124b3..4e9f8bb9 100644
--- a/include/common/asm_macros_common.S
+++ b/include/common/asm_macros_common.S
@@ -33,12 +33,30 @@
/*
* This macro is used to create a function label and place the
* code into a separate text section based on the function name
- * to enable elimination of unused code during linking
+ * to enable elimination of unused code during linking. It also adds
+ * basic debug information to enable call stack printing most of the
+ * time.
*/
.macro func _name
+ /*
+ * Add Call Frame Information entry in the .debug_frame section for
+ * debugger consumption. This enables callstack printing in debuggers.
+ * This does not use any space in the final loaded binary, only in the
+ * ELF file.
+ * Note that a function manipulating the CFA pointer location (i.e. the
+ * x29 frame pointer on AArch64) should declare it using the
+ * appropriate .cfi* directives, or be prepared to have a degraded
+ * debugging experience.
+ */
+ .cfi_sections .debug_frame
.section .text.\_name, "ax"
.type \_name, %function
.func \_name
+ /*
+ * .cfi_startproc and .cfi_endproc are needed to output entries in
+ * .debug_frame
+ */
+ .cfi_startproc
\_name:
.endm
@@ -47,6 +65,7 @@
*/
.macro endfunc _name
.endfunc
+ .cfi_endproc
.size \_name, . - \_name
.endm