dwarf

How to make local labels in GNU GAS ELF output that GDB can break on but not count as functions?

独自空忆成欢 提交于 2019-12-02 03:47:47
问题 When writing assembly manually with GNU GAS, within a function, I want to set a label such that: GDB won't treat that label as the function name I can use b mylabel to break on the label A similar question for nasm has been asked at: Break at local label using GDB for NASM assembly but I wanted to make it more precise here that I want GNU GAS and ELF output. E.g. if I defined a normal label mylabel as in: main.S .text .global _start _start: /* exit */ mov $60, %rax mylabel: mov $0, %rdi

How to make local labels in GNU GAS ELF output that GDB can break on but not count as functions?

柔情痞子 提交于 2019-12-02 02:30:43
When writing assembly manually with GNU GAS, within a function, I want to set a label such that: GDB won't treat that label as the function name I can use b mylabel to break on the label A similar question for nasm has been asked at: Break at local label using GDB for NASM assembly but I wanted to make it more precise here that I want GNU GAS and ELF output. E.g. if I defined a normal label mylabel as in: main.S .text .global _start _start: /* exit */ mov $60, %rax mylabel: mov $0, %rdi syscall that does not satisfy me because when GDB reaches the mov $0, %rdi , bt shows mylabel as the

Basic OS X Assembly and the Mach-O format

左心房为你撑大大i 提交于 2019-11-30 07:01:20
问题 I am interested in programming in x86-64 assembly on the Mac OS X platform. I came across this page about creating a 248B Mach-O program, which led me to Apple's own Mach-O format reference. After that I thought I'd make that same simple C program in Xcode and check out the generated assembly. This was the code: int main(int argc, const char * argv[]) { return 42; } But the assembly generated was 334 lines, containing (based on the 248B model) a lot of excess content. Firstly, why is so much

GAS: Explanation of .cfi_def_cfa_offset

时光毁灭记忆、已成空白 提交于 2019-11-29 19:51:52
I would like an explanation for the values used with the .cfi_def_cfa_offset directives in assembly generated by GCC. I know vaguely that the .cfi directives are involved in call frames and stack unwinding, but I would like a more detailed explanation of why, for example, the values 16 and 8 are used in the assembly outputted by GCC in compiling the following C program on my 64-bit Ubuntu machine. The C program: #include <stdio.h> int main(int argc, char** argv) { printf("%d", 0); return 0; } I invoked GCC on the source file test.c as follows: gcc -S -O3 test.c . I know that -O3 enables

Extract global variables from a.out file

心不动则不痛 提交于 2019-11-29 04:06:00
Edit (updated question) I have a simple C program: // it is not important to know what the code does you may skip the code main.c #include <bsp.h> unsigned int AppCtr; unsigned char AppFlag; int SOME_LARGE_VARIABLE; static void AppTest (void); void main (void) { AppCtr = 0; AppFlag = 0; AppTest(); } static void Foo(void){ SOME_LARGE_VARIABLE=15; } static void AppTest (void) { unsigned int i; i = 0; while (i < 200000) { i++; } BSP_Test(); SOME_LARGE_VARIABLE=3; Foo(); } bsp.c extern int SOME_LARGE_VARIABLE; extern unsigned char AppFlag; unsigned int long My_GREAT_COUNTER; void BSP_Test (void) {

Basic OS X Assembly and the Mach-O format

六月ゝ 毕业季﹏ 提交于 2019-11-29 00:39:34
I am interested in programming in x86-64 assembly on the Mac OS X platform. I came across this page about creating a 248B Mach-O program , which led me to Apple's own Mach-O format reference . After that I thought I'd make that same simple C program in Xcode and check out the generated assembly. This was the code: int main(int argc, const char * argv[]) { return 42; } But the assembly generated was 334 lines, containing (based on the 248B model) a lot of excess content. Firstly, why is so much DWARF debug info included in the Release build of a C executable? Secondly, I notice the Mach-O

GAS: Explanation of .cfi_def_cfa_offset

夙愿已清 提交于 2019-11-28 14:35:58
问题 I would like an explanation for the values used with the .cfi_def_cfa_offset directives in assembly generated by GCC. I know vaguely that the .cfi directives are involved in call frames and stack unwinding, but I would like a more detailed explanation of why, for example, the values 16 and 8 are used in the assembly outputted by GCC in compiling the following C program on my 64-bit Ubuntu machine. The C program: #include <stdio.h> int main(int argc, char** argv) { printf("%d", 0); return 0; }

Library to read ELF file DWARF debug information

只愿长相守 提交于 2019-11-27 20:36:12
Any recommendations for a good cross-platform library for reading ELF file debug information in DWARF format? I'd like to read the DWARF debug info in a Python program. There's a new kid on the block - pyelftools - a pure Python library for parsing the ELF and DWARF formats. Give it a try. It aims to be feature-complete and is currently in active development, so any problems should be handled quickly and enthusiastically :-) Martin v. Löwis The concept of "ELF debug info" doesn't really exist: the ELF specification leaves the content of the .debug section deliberately unspecified. Common debug

where/how does Apples GCC store DWARF inside an executable

和自甴很熟 提交于 2019-11-27 19:11:19
Where/how does Apples GCC store DWARF inside an executable? I compiled a binary via gcc -gdwarf-2 (Apples GCC). However, neither objdump -g nor objdump -h does show me any debug information. Also libbfd does not find any debug information. (I asked on the binutils-mailinglist about it here .) I am able however to extract the debugging information via dsymutil (into a dSYM). libbfd is also able to read those debug info then. Jason Molenda On Mac OS X there was a decision to have the linker ( ld ) not process all of the debug information when you link your program. The debug information is often

Extract global variables from a.out file

守給你的承諾、 提交于 2019-11-27 18:09:33
问题 Edit (updated question) I have a simple C program: // it is not important to know what the code does you may skip the code main.c #include <bsp.h> unsigned int AppCtr; unsigned char AppFlag; int SOME_LARGE_VARIABLE; static void AppTest (void); void main (void) { AppCtr = 0; AppFlag = 0; AppTest(); } static void Foo(void){ SOME_LARGE_VARIABLE=15; } static void AppTest (void) { unsigned int i; i = 0; while (i < 200000) { i++; } BSP_Test(); SOME_LARGE_VARIABLE=3; Foo(); } bsp.c extern int SOME