<div dir="ltr">Thank you, Clayton. This is very helpful.<div><br></div><div>We <span style="font-family:arial,sans-serif;font-size:12px">use the LLDB specific GDB remote extensions, and our debugger server supports "qRegisterInfo" package. "</span>reg 0x3c" is the frame pointer.</div>
<div><br></div><div>In the example mentioned above, we have SP = FP - 40 for current call frame.</div><div>And variable "a" is stored at address (<span style="font-family:arial,sans-serif;font-size:12px">FP + -24) from asm instruction </span><span style="font-family:arial,sans-serif;font-size:12px">[FP + -24] = R3;;</span></div>
<div><span style="font-family:arial,sans-serif;font-size:12px">Thus we can conclude that SP + 16 = </span>FP - 40 + 16 = FP -24 is the desired address. Here "16" is the offset obtained from debug info.</div><div>
<br></div><div>So I guess there is something incompatible between our compiler backend and debug info generator.</div><div>Here is my questions:</div><div>1. How can we specify which register should be <span style="font-family:arial,sans-serif;font-size:12px">DW_AT_frame_base?</span></div>
<div><span style="font-family:arial,sans-serif;font-size:12px">2. How can we adjust the offset in </span><span style="font-family:arial,sans-serif;font-size:12px">DW_AT_location for variables?</span></div><div><span style="font-family:arial,sans-serif;font-size:12px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:12px">Best regards.</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-02-20 3:03 GMT+08:00 Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If I had to guess, I would venture to say your problem is one of:<br>
1 - you don't have your registers correctly defined and didn't specify the DWARF register numbers for your register context<br>
2 - your DWARF is incorrect<br>
<br>
I am guessing #1 is your issue.<br>
<br>
How are you debugging your program? Are you using the GDB remote protocol? If so, how did you tell LLDB about all of your CPU registers? Did you use the LLDB specific GDB remote extensions? Did you specify a target definition python file? You will need to make sure that you tell LLDB about all of your CPU registers and also tell LLDB the DWARF register number for each register accurately.<br>
<br>
Variable "a" has debug info:<br>
<br>
0x00000054: DW_TAG_variable [4]<br>
DW_AT_name( "a" )<br>
DW_AT_decl_file( "/home/yangyy/workspace/newlib/test.c" )<br>
DW_AT_decl_line( 4 )<br>
DW_AT_type( {0x0000007f} ( int ) )<br>
DW_AT_location( fbreg +16 )<br>
<br>
The location says it is at the frame base register + 16 bytes. The frame base is defined in the parent DIE:<br>
<br>
0x00000022: DW_TAG_subprogram [2] *<br>
DW_AT_name( "main" )<br>
DW_AT_decl_file( "/home/yangyy/workspace/newlib/test.c" )<br>
DW_AT_decl_line( 2 )<br>
DW_AT_prototyped( true )<br>
DW_AT_type( {0x0000007f} ( int ) )<br>
DW_AT_external( true )<br>
DW_AT_low_pc( 0x00000028 )<br>
DW_AT_high_pc( 0x00000084 )<br>
DW_AT_frame_base( regx 0x0000003c )<br>
<br>
So it says the frame base register is DWARF register 0x3c. In your target definition you will need to have told us which register has the DWARF register number 0x3c, otherwise we will fail to evaluate the expression.<br>
<br>
Greg<br>
<div><div class="h5"><br>
<br>
On Feb 18, 2014, at 11:10 PM, 杨勇勇 <<a href="mailto:triple.yang@gmail.com">triple.yang@gmail.com</a>> wrote:<br>
<br>
> Sorry, this is the attachment.<br>
><br>
><br>
> 2014-02-19 15:08 GMT+08:00 杨勇勇 <<a href="mailto:triple.yang@gmail.com">triple.yang@gmail.com</a>>:<br>
> Thank you.<br>
><br>
> Here is an example and the attchment contains extra files including object file and executable file.<br>
> I want to print for example the value of "a", but lldb command "frame variable a" displays "0" and so does "b", and "c".<br>
> Meanwhile, the value is correct if I directly check registers or memory.<br>
><br>
> Following content is composed of three part:<br>
> 1. C program.<br>
> 2. assembly file including directives of dwarf debug info.<br>
> 3. dwarf debug info dumpped from executable file with llvm-dwarfdump.<br>
><br>
> ///////////////////////////////////////////////////////////////////////////////////////////<br>
> // C<br>
> int<br>
> main(int argc, char *argv[])<br>
> {<br>
> int a = 11;<br>
> int b = 22;<br>
> int c = a+b;<br>
> return c;<br>
> }<br>
><br>
> ######################################<br>
> # asm including dwarf debugging info<br>
> .file "test.c"<br>
> .section .debug_info,"",@progbits<br>
> Lsection_info:<br>
> .section .debug_abbrev,"",@progbits<br>
> Lsection_abbrev:<br>
> .section .debug_aranges,"",@progbits<br>
> .section .debug_macinfo,"",@progbits<br>
> .section .debug_line,"",@progbits<br>
> Lsection_line:<br>
> .section .debug_loc,"",@progbits<br>
> .section .debug_pubtypes,"",@progbits<br>
> .section .debug_str,"MS",@progbits,1<br>
> Linfo_string:<br>
> .section .debug_ranges,"",@progbits<br>
> Ldebug_range:<br>
> .section .debug_loc,"",@progbits<br>
> Lsection_debug_loc:<br>
> .text<br>
> Ltext_begin:<br>
> .data<br>
> .file 1 "test.c"<br>
> .text<br>
> .global main<br>
> .type main,@function<br>
> main: # @main<br>
> Lfunc_begin0:<br>
> .loc 1 3 0 # test.c:3:0<br>
> # BB#0: # %entry<br>
> .loc 1 2 0 prologue_end # test.c:2:0<br>
> [SP + -4] = FP;;<br>
> [SP + -8] = J30;;<br>
> FP = SP;;<br>
> J31 = -40;;<br>
> SP = SP + J31;;<br>
> #DEBUG_VALUE: main:argc <- undef<br>
> #DEBUG_VALUE: main:argv <- undef<br>
> R2 = 0;;<br>
> R3 = 11;;<br>
> [FP + -12] = R2;;<br>
> [FP + -16] = R0;;<br>
> [FP + -20] = R1;;<br>
> .loc 1 4 0 # test.c:4:0<br>
> [FP + -24] = R3;;<br>
> R2 = 22;;<br>
> .loc 1 5 0 # test.c:5:0<br>
> [FP + -28] = R2;;<br>
> .loc 1 6 0 # test.c:6:0<br>
> R3 = [FP + -24];;<br>
> R2 = R3 + R2 (T);;<br>
> [FP + -32] = R2;;<br>
> .loc 1 7 0 # test.c:7:0<br>
> [FP + -36] = R0;;<br>
> R0 = R2;;<br>
> [FP + -40] = R1;;<br>
> SP = FP;;<br>
> J30 = [SP + -8];;<br>
> FP = [SP + -4];;<br>
> jump J30;;<br>
> Ltmp0:<br>
> Ltmp1:<br>
> .size main, Ltmp1-main<br>
> Lfunc_end0:<br>
><br>
> Ltext_end:<br>
> .data<br>
> Ldata_end:<br>
> .text<br>
> Lsection_end1:<br>
> .section .debug_info,"",@progbits<br>
> L.debug_info_begin0:<br>
> .int 148 # Length of Compilation Unit Info<br>
> .short 2 # DWARF version number<br>
> .int L.debug_abbrev_begin # Offset Into Abbrev. Section<br>
> .byte 4 # Address Size (in bytes)<br>
> .byte 1 # Abbrev [1] 0xb:0x8d DW_TAG_compile_unit<br>
> .int Linfo_string0 # DW_AT_producer<br>
> .short 12 # DW_AT_language<br>
> .int Linfo_string1 # DW_AT_name<br>
> .int 0 # DW_AT_low_pc<br>
> .int Lsection_line # DW_AT_stmt_list<br>
> .int Linfo_string2 # DW_AT_comp_dir<br>
> .byte 2 # Abbrev [2] 0x22:0x5d DW_TAG_subprogram<br>
> .int Linfo_string3 # DW_AT_name<br>
> .byte 1 # DW_AT_decl_file<br>
> .byte 2 # DW_AT_decl_line<br>
> # DW_AT_prototyped<br>
> .int 127 # DW_AT_type<br>
> # DW_AT_external<br>
> .int Lfunc_begin0 # DW_AT_low_pc<br>
> .int Lfunc_end0 # DW_AT_high_pc<br>
> .byte 2 # DW_AT_frame_base<br>
> .byte 144<br>
> .byte 60<br>
> .byte 3 # Abbrev [3] 0x38:0xe DW_TAG_formal_parameter<br>
> .int Linfo_string5 # DW_AT_name<br>
> .byte 1 # DW_AT_decl_file<br>
> .byte 2 # DW_AT_decl_line<br>
> .int 127 # DW_AT_type<br>
> .byte 2 # DW_AT_location<br>
> .byte 145<br>
> .byte 24<br>
> .byte 3 # Abbrev [3] 0x46:0xe DW_TAG_formal_parameter<br>
> .int Linfo_string6 # DW_AT_name<br>
> .byte 1 # DW_AT_decl_file<br>
> .byte 2 # DW_AT_decl_line<br>
> .int 146 # DW_AT_type<br>
> .byte 2 # DW_AT_location<br>
> .byte 145<br>
> .byte 20<br>
> .byte 4 # Abbrev [4] 0x54:0xe DW_TAG_variable<br>
> .int Linfo_string8 # DW_AT_name<br>
> .byte 1 # DW_AT_decl_file<br>
> .byte 4 # DW_AT_decl_line<br>
> .int 127 # DW_AT_type<br>
> .byte 2 # DW_AT_location<br>
> .byte 145<br>
> .byte 16<br>
> .byte 4 # Abbrev [4] 0x62:0xe DW_TAG_variable<br>
> .int Linfo_string9 # DW_AT_name<br>
> .byte 1 # DW_AT_decl_file<br>
> .byte 5 # DW_AT_decl_line<br>
> .int 127 # DW_AT_type<br>
> .byte 2 # DW_AT_location<br>
> .byte 145<br>
> .byte 12<br>
> .byte 4 # Abbrev [4] 0x70:0xe DW_TAG_variable<br>
> .int Linfo_string10 # DW_AT_name<br>
> .byte 1 # DW_AT_decl_file<br>
> .byte 6 # DW_AT_decl_line<br>
> .int 127 # DW_AT_type<br>
> .byte 2 # DW_AT_location<br>
> .byte 145<br>
> .byte 8<br>
> .byte 0 # End Of Children Mark<br>
> .byte 5 # Abbrev [5] 0x7f:0x7 DW_TAG_base_type<br>
> .int Linfo_string4 # DW_AT_name<br>
> .byte 5 # DW_AT_encoding<br>
> .byte 4 # DW_AT_byte_size<br>
> .byte 5 # Abbrev [5] 0x86:0x7 DW_TAG_base_type<br>
> .int Linfo_string7 # DW_AT_name<br>
> .byte 6 # DW_AT_encoding<br>
> .byte 1 # DW_AT_byte_size<br>
> .byte 6 # Abbrev [6] 0x8d:0x5 DW_TAG_pointer_type<br>
> .int 134 # DW_AT_type<br>
> .byte 6 # Abbrev [6] 0x92:0x5 DW_TAG_pointer_type<br>
> .int 141 # DW_AT_type<br>
> .byte 0 # End Of Children Mark<br>
> L.debug_info_end0:<br>
> .section .debug_abbrev,"",@progbits<br>
> L.debug_abbrev_begin:<br>
> .byte 1 # Abbreviation Code<br>
> .byte 17 # DW_TAG_compile_unit<br>
> .byte 1 # DW_CHILDREN_yes<br>
> .byte 37 # DW_AT_producer<br>
> .byte 14 # DW_FORM_strp<br>
> .byte 19 # DW_AT_language<br>
> .byte 5 # DW_FORM_data2<br>
> .byte 3 # DW_AT_name<br>
> .byte 14 # DW_FORM_strp<br>
> .byte 17 # DW_AT_low_pc<br>
> .byte 1 # DW_FORM_addr<br>
> .byte 16 # DW_AT_stmt_list<br>
> .byte 6 # DW_FORM_data4<br>
> .byte 27 # DW_AT_comp_dir<br>
> .byte 14 # DW_FORM_strp<br>
> .byte 0 # EOM(1)<br>
> .byte 0 # EOM(2)<br>
> .byte 2 # Abbreviation Code<br>
> .byte 46 # DW_TAG_subprogram<br>
> .byte 1 # DW_CHILDREN_yes<br>
> .byte 3 # DW_AT_name<br>
> .byte 14 # DW_FORM_strp<br>
> .byte 58 # DW_AT_decl_file<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 59 # DW_AT_decl_line<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 39 # DW_AT_prototyped<br>
> .byte 25 # DW_FORM_flag_present<br>
> .byte 73 # DW_AT_type<br>
> .byte 19 # DW_FORM_ref4<br>
> .byte 63 # DW_AT_external<br>
> .byte 25 # DW_FORM_flag_present<br>
> .byte 17 # DW_AT_low_pc<br>
> .byte 1 # DW_FORM_addr<br>
> .byte 18 # DW_AT_high_pc<br>
> .byte 1 # DW_FORM_addr<br>
> .byte 64 # DW_AT_frame_base<br>
> .byte 10 # DW_FORM_block1<br>
> .byte 0 # EOM(1)<br>
> .byte 0 # EOM(2)<br>
> .byte 3 # Abbreviation Code<br>
> .byte 5 # DW_TAG_formal_parameter<br>
> .byte 0 # DW_CHILDREN_no<br>
> .byte 3 # DW_AT_name<br>
> .byte 14 # DW_FORM_strp<br>
> .byte 58 # DW_AT_decl_file<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 59 # DW_AT_decl_line<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 73 # DW_AT_type<br>
> .byte 19 # DW_FORM_ref4<br>
> .byte 2 # DW_AT_location<br>
> .byte 10 # DW_FORM_block1<br>
> .byte 0 # EOM(1)<br>
> .byte 0 # EOM(2)<br>
> .byte 4 # Abbreviation Code<br>
> .byte 52 # DW_TAG_variable<br>
> .byte 0 # DW_CHILDREN_no<br>
> .byte 3 # DW_AT_name<br>
> .byte 14 # DW_FORM_strp<br>
> .byte 58 # DW_AT_decl_file<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 59 # DW_AT_decl_line<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 73 # DW_AT_type<br>
> .byte 19 # DW_FORM_ref4<br>
> .byte 2 # DW_AT_location<br>
> .byte 10 # DW_FORM_block1<br>
> .byte 0 # EOM(1)<br>
> .byte 0 # EOM(2)<br>
> .byte 5 # Abbreviation Code<br>
> .byte 36 # DW_TAG_base_type<br>
> .byte 0 # DW_CHILDREN_no<br>
> .byte 3 # DW_AT_name<br>
> .byte 14 # DW_FORM_strp<br>
> .byte 62 # DW_AT_encoding<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 11 # DW_AT_byte_size<br>
> .byte 11 # DW_FORM_data1<br>
> .byte 0 # EOM(1)<br>
> .byte 0 # EOM(2)<br>
> .byte 6 # Abbreviation Code<br>
> .byte 15 # DW_TAG_pointer_type<br>
> .byte 0 # DW_CHILDREN_no<br>
> .byte 73 # DW_AT_type<br>
> .byte 19 # DW_FORM_ref4<br>
> .byte 0 # EOM(1)<br>
> .byte 0 # EOM(2)<br>
> .byte 0 # EOM(3)<br>
> L.debug_abbrev_end:<br>
> .section .debug_aranges,"",@progbits<br>
> .section .debug_ranges,"",@progbits<br>
> .section .debug_macinfo,"",@progbits<br>
> .section .debug_str,"MS",@progbits,1<br>
> Linfo_string0:<br>
> .asciz "clang version 3.3 (/opt/git.repo/clang.git/ b422d20530588813b09057b45d5b383f0b175ced) (/opt/git.repo/llvm.git/ 57b428f0a6be7b81bc364b0088992b1f820b516e)"<br>
> Linfo_string1:<br>
> .asciz "test.c"<br>
> Linfo_string2:<br>
> .asciz "/home/yangyy/workspace/newlib"<br>
> Linfo_string3:<br>
> .asciz "main"<br>
> Linfo_string4:<br>
> .asciz "int"<br>
> Linfo_string5:<br>
> .asciz "argc"<br>
> Linfo_string6:<br>
> .asciz "argv"<br>
> Linfo_string7:<br>
> .asciz "char"<br>
> Linfo_string8:<br>
> .asciz "a"<br>
> Linfo_string9:<br>
> .asciz "b"<br>
> Linfo_string10:<br>
> .asciz "c"<br>
><br>
> #########################################<br>
> # dwarf debug info dumpped from its executable file with llvm-dwarfdump<br>
> mspu.out: file format ELF32-mspu<br>
><br>
> .debug_abbrev contents:<br>
> Abbrev table for offset: 0x00000000<br>
> [1] DW_TAG_compile_unit DW_CHILDREN_yes<br>
> DW_AT_producer DW_FORM_strp<br>
> DW_AT_language DW_FORM_data2<br>
> DW_AT_name DW_FORM_strp<br>
> DW_AT_low_pc DW_FORM_addr<br>
> DW_AT_stmt_list DW_FORM_data4<br>
> DW_AT_comp_dir DW_FORM_strp<br>
><br>
> [2] DW_TAG_subprogram DW_CHILDREN_yes<br>
> DW_AT_name DW_FORM_strp<br>
> DW_AT_decl_file DW_FORM_data1<br>
> DW_AT_decl_line DW_FORM_data1<br>
> DW_AT_prototyped DW_FORM_flag_present<br>
> DW_AT_type DW_FORM_ref4<br>
> DW_AT_external DW_FORM_flag_present<br>
> DW_AT_low_pc DW_FORM_addr<br>
> DW_AT_high_pc DW_FORM_addr<br>
> DW_AT_frame_base DW_FORM_block1<br>
><br>
> [3] DW_TAG_formal_parameter DW_CHILDREN_no<br>
> DW_AT_name DW_FORM_strp<br>
> DW_AT_decl_file DW_FORM_data1<br>
> DW_AT_decl_line DW_FORM_data1<br>
> DW_AT_type DW_FORM_ref4<br>
> DW_AT_location DW_FORM_block1<br>
><br>
> [4] DW_TAG_variable DW_CHILDREN_no<br>
> DW_AT_name DW_FORM_strp<br>
> DW_AT_decl_file DW_FORM_data1<br>
> DW_AT_decl_line DW_FORM_data1<br>
> DW_AT_type DW_FORM_ref4<br>
> DW_AT_location DW_FORM_block1<br>
><br>
> [5] DW_TAG_base_type DW_CHILDREN_no<br>
> DW_AT_name DW_FORM_strp<br>
> DW_AT_encoding DW_FORM_data1<br>
> DW_AT_byte_size DW_FORM_data1<br>
><br>
> [6] DW_TAG_pointer_type DW_CHILDREN_no<br>
> DW_AT_type DW_FORM_ref4<br>
><br>
><br>
> .debug_info contents:<br>
> 0x00000000: Compile Unit: length = 0x00000094 version = 0x0002 abbr_offset = 0x0000 addr_size = 0x04 (next CU at 0x00000098)<br>
><br>
> 0x0000000b: DW_TAG_compile_unit [1] *<br>
> 0x0000000c: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 3.3 (/opt/git.repo/clang.git/ b422d20530588813b09057b45d5b383f0b175ced) (/opt/git.repo/llvm.git/ 57b428f0a6be7b81bc364b0088992b1f820b516e)")<br>
> 0x00000010: DW_AT_language [DW_FORM_data2] (0x000c)<br>
> 0x00000012: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000099] = "test.c")<br>
> 0x00000016: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)<br>
> 0x0000001a: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)<br>
> 0x0000001e: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x000000a0] = "/home/yangyy/workspace/newlib")<br>
><br>
> 0x00000022: DW_TAG_subprogram [2] *<br>
> 0x00000023: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000be] = "main")<br>
> 0x00000027: DW_AT_decl_file [DW_FORM_data1] (0x01)<br>
> 0x00000028: DW_AT_decl_line [DW_FORM_data1] (0x02)<br>
> 0x00000029: DW_AT_prototyped [DW_FORM_flag_present] (true)<br>
> 0x00000029: DW_AT_type [DW_FORM_ref4] (cu + 0x007f => {0x0000007f})<br>
> 0x0000002d: DW_AT_external [DW_FORM_flag_present] (true)<br>
> 0x0000002d: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000028)<br>
> 0x00000031: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000084)<br>
> 0x00000035: DW_AT_frame_base [DW_FORM_block1] (<0x02> 90 3c )<br>
><br>
> 0x00000038: DW_TAG_formal_parameter [3]<br>
> 0x00000039: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000c7] = "argc")<br>
> 0x0000003d: DW_AT_decl_file [DW_FORM_data1] (0x01)<br>
> 0x0000003e: DW_AT_decl_line [DW_FORM_data1] (0x02)<br>
> 0x0000003f: DW_AT_type [DW_FORM_ref4] (cu + 0x007f => {0x0000007f})<br>
> 0x00000043: DW_AT_location [DW_FORM_block1] (<0x02> 91 18 )<br>
><br>
> 0x00000046: DW_TAG_formal_parameter [3]<br>
> 0x00000047: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000cc] = "argv")<br>
> 0x0000004b: DW_AT_decl_file [DW_FORM_data1] (0x01)<br>
> 0x0000004c: DW_AT_decl_line [DW_FORM_data1] (0x02)<br>
> 0x0000004d: DW_AT_type [DW_FORM_ref4] (cu + 0x0092 => {0x00000092})<br>
> 0x00000051: DW_AT_location [DW_FORM_block1] (<0x02> 91 14 )<br>
><br>
> 0x00000054: DW_TAG_variable [4]<br>
> 0x00000055: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000d6] = "a")<br>
> 0x00000059: DW_AT_decl_file [DW_FORM_data1] (0x01)<br>
> 0x0000005a: DW_AT_decl_line [DW_FORM_data1] (0x04)<br>
> 0x0000005b: DW_AT_type [DW_FORM_ref4] (cu + 0x007f => {0x0000007f})<br>
> 0x0000005f: DW_AT_location [DW_FORM_block1] (<0x02> 91 10 )<br>
><br>
> 0x00000062: DW_TAG_variable [4]<br>
> 0x00000063: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000d8] = "b")<br>
> 0x00000067: DW_AT_decl_file [DW_FORM_data1] (0x01)<br>
> 0x00000068: DW_AT_decl_line [DW_FORM_data1] (0x05)<br>
> 0x00000069: DW_AT_type [DW_FORM_ref4] (cu + 0x007f => {0x0000007f})<br>
> 0x0000006d: DW_AT_location [DW_FORM_block1] (<0x02> 91 0c )<br>
><br>
> 0x00000070: DW_TAG_variable [4]<br>
> 0x00000071: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000da] = "c")<br>
> 0x00000075: DW_AT_decl_file [DW_FORM_data1] (0x01)<br>
> 0x00000076: DW_AT_decl_line [DW_FORM_data1] (0x06)<br>
> 0x00000077: DW_AT_type [DW_FORM_ref4] (cu + 0x007f => {0x0000007f})<br>
> 0x0000007b: DW_AT_location [DW_FORM_block1] (<0x02> 91 08 )<br>
><br>
> 0x0000007e: NULL<br>
><br>
> 0x0000007f: DW_TAG_base_type [5]<br>
> 0x00000080: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000c3] = "int")<br>
> 0x00000084: DW_AT_encoding [DW_FORM_data1] (0x05)<br>
> 0x00000085: DW_AT_byte_size [DW_FORM_data1] (0x04)<br>
><br>
> 0x00000086: DW_TAG_base_type [5]<br>
> 0x00000087: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000d1] = "char")<br>
> 0x0000008b: DW_AT_encoding [DW_FORM_data1] (0x06)<br>
> 0x0000008c: DW_AT_byte_size [DW_FORM_data1] (0x01)<br>
><br>
> 0x0000008d: DW_TAG_pointer_type [6]<br>
> 0x0000008e: DW_AT_type [DW_FORM_ref4] (cu + 0x0086 => {0x00000086})<br>
><br>
> 0x00000092: DW_TAG_pointer_type [6]<br>
> 0x00000093: DW_AT_type [DW_FORM_ref4] (cu + 0x008d => {0x0000008d})<br>
><br>
> 0x00000097: NULL<br>
><br>
> .debug_frame contents:<br>
><br>
><br>
> .debug_aranges contents:<br>
><br>
> .debug_line contents:<br>
> Line table prologue:<br>
> total_length: 0x00000037<br>
> version: 2<br>
> prologue_length: 0x0000001d<br>
> min_inst_length: 1<br>
> default_is_stmt: 1<br>
> line_base: -5<br>
> line_range: 14<br>
> opcode_base: 13<br>
> standard_opcode_lengths[DW_LNS_copy] = 0<br>
> standard_opcode_lengths[DW_LNS_advance_pc] = 1<br>
> standard_opcode_lengths[DW_LNS_advance_line] = 1<br>
> standard_opcode_lengths[DW_LNS_set_file] = 1<br>
> standard_opcode_lengths[DW_LNS_set_column] = 1<br>
> standard_opcode_lengths[DW_LNS_negate_stmt] = 0<br>
> standard_opcode_lengths[DW_LNS_set_basic_block] = 0<br>
> standard_opcode_lengths[DW_LNS_const_add_pc] = 0<br>
> standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1<br>
> standard_opcode_lengths[DW_LNS_set_prologue_end] = 0<br>
> standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0<br>
> standard_opcode_lengths[DW_LNS_set_isa] = 1<br>
> Dir Mod Time File Len File Name<br>
> ---- ---------- ---------- ---------------------------<br>
> file_names[ 1] 0 0x00000000 0x00000000 test.c<br>
><br>
> Address Line Column File ISA Flags<br>
> ------------------ ------ ------ ------ --- -------------<br>
> 0x0000000000000028 2 0 1 0 is_stmt prologue_end<br>
> 0x0000000000000050 4 0 1 0 is_stmt<br>
> 0x0000000000000058 5 0 1 0 is_stmt<br>
> 0x000000000000005c 6 0 1 0 is_stmt<br>
> 0x0000000000000068 7 0 1 0 is_stmt<br>
> 0x0000000000000084 7 0 1 0 is_stmt end_sequence<br>
><br>
> .debug_str contents:<br>
> 0x00000000: "clang version 3.3 (/opt/git.repo/clang.git/ b422d20530588813b09057b45d5b383f0b175ced) (/opt/git.repo/llvm.git/ 57b428f0a6be7b81bc364b0088992b1f820b516e)"<br>
> 0x00000099: "test.c"<br>
> 0x000000a0: "/home/yangyy/workspace/newlib"<br>
> 0x000000be: "main"<br>
> 0x000000c3: "int"<br>
> 0x000000c7: "argc"<br>
> 0x000000cc: "argv"<br>
> 0x000000d1: "char"<br>
> 0x000000d6: "a"<br>
> 0x000000d8: "b"<br>
> 0x000000da: "c"<br>
><br>
> .debug_ranges contents:<br>
><br>
> .debug_pubnames contents:<br>
> Length: 0<br>
> Version: 0<br>
> Offset in .debug_info: 0<br>
> Size: 0<br>
><br>
> Offset Name<br>
><br>
> .debug_abbrev.dwo contents:<br>
> < EMPTY ><br>
><br>
><br>
><br>
> 2014-02-19 2:28 GMT+08:00 Greg Clayton <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>>:<br>
><br>
> All of this information is contained in the DWARF debug info that you must generate. Are you generating DWARF? If not, you will need to. If so, please attach an example program that contains DWARF and specify which function you are having trouble getting variable information for.<br>
><br>
> Greg Clayton<br>
><br>
> On Feb 18, 2014, at 12:44 AM, 杨勇勇 <<a href="mailto:triple.yang@gmail.com">triple.yang@gmail.com</a>> wrote:<br>
><br>
> > Hi, all<br>
> ><br>
> > I ported llvm backend and lldb recently. Both tools can basically work.<br>
> > lldb is able to debug programs in asm style and frame unwinding is OK.<br>
> ><br>
> > But "frame variable XX" does not work because lldb is not able to determine the address of<br>
> > XX from debug info.<br>
> ><br>
> > Can someone give any clue?<br>
> > Thanks in advance.<br>
> ><br>
> > --<br>
> > 杨勇勇 (Yang Yong-Yong)<br>
> > _______________________________________________<br>
> > lldb-dev mailing list<br>
> > <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
><br>
><br>
><br>
><br>
> --<br>
> 杨勇勇 (Yang Yong-Yong)<br>
><br>
><br>
><br>
> --<br>
> 杨勇勇 (Yang Yong-Yong)<br>
</div></div>> <example.tar.bz2><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>杨勇勇 (Yang Yong-Yong)
</div>