122 lines · plain
1; REQUIRES: x86-registered-target2 3; Test case 1 - General options.4 5; test.cpp6; 1 using INTPTR = const int *;7; 2 int foo(INTPTR ParamPtr, unsigned ParamUnsigned, bool ParamBool) {8; 3 if (ParamBool) {9; 4 typedef int INTEGER;10; 5 const INTEGER CONSTANT = 7;11; 6 return CONSTANT;12; 7 }13; 8 return ParamUnsigned;14; 9 }15 16; Print basic details.17; The following command prints basic details for all the logical elements18; sorted by the debug information internal offset; it includes its lexical19; level and debug info format.20 21; RUN: llvm-debuginfo-analyzer --attribute=level,format \22; RUN: --output-sort=id \23; RUN: --print=scopes,symbols,types,lines,instructions \24; RUN: %p/Inputs/test-dwarf-clang.o 2>&1 | \25; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s26 27; RUN: llvm-debuginfo-analyzer --attribute=level,format \28; RUN: --output-sort=id \29; RUN: --print=elements \30; RUN: %p/Inputs/test-dwarf-clang.o 2>&1 | \31; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s32 33; For DWARF, `--output-sort=offset` matches `--output-sort=id`, i.e.,34; `LVElement`s are always iterated in the order in which they were added.35; RUN: llvm-debuginfo-analyzer --attribute=level,format \36; RUN: --output-sort=offset \37; RUN: --print=scopes,symbols,types,lines,instructions \38; RUN: %p/Inputs/test-dwarf-clang.o 2>&1 | \39; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s40 41; ONE: Logical View:42; ONE-NEXT: [000] {File} 'test-dwarf-clang.o' -> elf64-x86-6443; ONE-EMPTY:44; ONE-NEXT: [001] {CompileUnit} 'test.cpp'45; ONE-NEXT: [002] 2 {Function} extern not_inlined 'foo' -> 'int'46; ONE-NEXT: [003] 2 {Parameter} 'ParamPtr' -> 'INTPTR'47; ONE-NEXT: [003] 2 {Parameter} 'ParamUnsigned' -> 'unsigned int'48; ONE-NEXT: [003] 2 {Parameter} 'ParamBool' -> 'bool'49; ONE-NEXT: [003] {Block}50; ONE-NEXT: [004] 5 {Variable} 'CONSTANT' -> 'const INTEGER'51; ONE-NEXT: [004] 5 {Line}52; ONE-NEXT: [004] {Code} 'movl $0x7, -0x1c(%rbp)'53; ONE-NEXT: [004] 6 {Line}54; ONE-NEXT: [004] {Code} 'movl $0x7, -0x4(%rbp)'55; ONE-NEXT: [004] {Code} 'jmp 0x6'56; ONE-NEXT: [003] 4 {TypeAlias} 'INTEGER' -> 'int'57; ONE-NEXT: [003] 2 {Line}58; ONE-NEXT: [003] {Code} 'pushq %rbp'59; ONE-NEXT: [003] {Code} 'movq %rsp, %rbp'60; ONE-NEXT: [003] {Code} 'movb %dl, %al'61; ONE-NEXT: [003] {Code} 'movq %rdi, -0x10(%rbp)'62; ONE-NEXT: [003] {Code} 'movl %esi, -0x14(%rbp)'63; ONE-NEXT: [003] {Code} 'andb $0x1, %al'64; ONE-NEXT: [003] {Code} 'movb %al, -0x15(%rbp)'65; ONE-NEXT: [003] 3 {Line}66; ONE-NEXT: [003] {Code} 'testb $0x1, -0x15(%rbp)'67; ONE-NEXT: [003] {Code} 'je 0x13'68; ONE-NEXT: [003] 8 {Line}69; ONE-NEXT: [003] {Code} 'movl -0x14(%rbp), %eax'70; ONE-NEXT: [003] 8 {Line}71; ONE-NEXT: [003] {Code} 'movl %eax, -0x4(%rbp)'72; ONE-NEXT: [003] 9 {Line}73; ONE-NEXT: [003] {Code} 'movl -0x4(%rbp), %eax'74; ONE-NEXT: [003] {Code} 'popq %rbp'75; ONE-NEXT: [003] {Code} 'retq'76; ONE-NEXT: [002] 1 {TypeAlias} 'INTPTR' -> '* const int'77; ONE-NEXT: [002] 9 {Line}78 79; RUN: llvm-debuginfo-analyzer --attribute=level,format \80; RUN: --output-sort=none \81; RUN: --print=scopes,symbols,types,lines,instructions \82; RUN: %p/Inputs/test-dwarf-clang.o 2>&1 | \83; RUN: FileCheck --strict-whitespace -check-prefix=ONE-NOSORT %s84 85; ONE-NOSORT: Logical View:86; ONE-NOSORT-NEXT: [000] {File} 'test-dwarf-clang.o' -> elf64-x86-6487; ONE-NOSORT-EMPTY:88; ONE-NOSORT-NEXT: [001] {CompileUnit} 'test.cpp'89; ONE-NOSORT-NEXT: [002] 2 {Function} extern not_inlined 'foo' -> 'int'90; ONE-NOSORT-NEXT: [003] {Block}91; ONE-NOSORT-NEXT: [004] 5 {Variable} 'CONSTANT' -> 'const INTEGER'92; ONE-NOSORT-NEXT: [004] 5 {Line}93; ONE-NOSORT-NEXT: [004] {Code} 'movl $0x7, -0x1c(%rbp)'94; ONE-NOSORT-NEXT: [004] 6 {Line}95; ONE-NOSORT-NEXT: [004] {Code} 'movl $0x7, -0x4(%rbp)'96; ONE-NOSORT-NEXT: [004] {Code} 'jmp 0x6'97; ONE-NOSORT-NEXT: [003] 4 {TypeAlias} 'INTEGER' -> 'int'98; ONE-NOSORT-NEXT: [003] 2 {Parameter} 'ParamPtr' -> 'INTPTR'99; ONE-NOSORT-NEXT: [003] 2 {Parameter} 'ParamUnsigned' -> 'unsigned int'100; ONE-NOSORT-NEXT: [003] 2 {Parameter} 'ParamBool' -> 'bool'101; ONE-NOSORT-NEXT: [003] 2 {Line}102; ONE-NOSORT-NEXT: [003] {Code} 'pushq %rbp'103; ONE-NOSORT-NEXT: [003] {Code} 'movq %rsp, %rbp'104; ONE-NOSORT-NEXT: [003] {Code} 'movb %dl, %al'105; ONE-NOSORT-NEXT: [003] {Code} 'movq %rdi, -0x10(%rbp)'106; ONE-NOSORT-NEXT: [003] {Code} 'movl %esi, -0x14(%rbp)'107; ONE-NOSORT-NEXT: [003] {Code} 'andb $0x1, %al'108; ONE-NOSORT-NEXT: [003] {Code} 'movb %al, -0x15(%rbp)'109; ONE-NOSORT-NEXT: [003] 3 {Line}110; ONE-NOSORT-NEXT: [003] {Code} 'testb $0x1, -0x15(%rbp)'111; ONE-NOSORT-NEXT: [003] {Code} 'je 0x13'112; ONE-NOSORT-NEXT: [003] 8 {Line}113; ONE-NOSORT-NEXT: [003] {Code} 'movl -0x14(%rbp), %eax'114; ONE-NOSORT-NEXT: [003] 8 {Line}115; ONE-NOSORT-NEXT: [003] {Code} 'movl %eax, -0x4(%rbp)'116; ONE-NOSORT-NEXT: [003] 9 {Line}117; ONE-NOSORT-NEXT: [003] {Code} 'movl -0x4(%rbp), %eax'118; ONE-NOSORT-NEXT: [003] {Code} 'popq %rbp'119; ONE-NOSORT-NEXT: [003] {Code} 'retq'120; ONE-NOSORT-NEXT: [002] 1 {TypeAlias} 'INTPTR' -> '* const int'121; ONE-NOSORT-NEXT: [002] 9 {Line}122