shafik updated this revision to Diff 283703.
shafik added a comment.

- Add more tests


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85376/new/

https://reviews.llvm.org/D85376

Files:
  lldb/source/Core/ValueObjectChild.cpp
  lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/Makefile
  
lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/TestValueObjPassByRef.py
  lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/main.s

Index: lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/main.s
===================================================================
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/main.s
@@ -0,0 +1,653 @@
+## This was generated from the following code:
+##
+## We are testing how ValueObject deals with bit-fields when an argument is
+## passed by register. Compiling at -O1 allows us to capture this case and
+## test it.
+##
+## #include <stdint.h>
+## #include <stdio.h>
+##
+## typedef union
+## {
+##  uint32_t raw;
+##  struct
+##  {
+##    uint32_t a : 8;
+##    uint32_t b : 8;
+##    uint32_t c : 6;
+##    uint32_t d : 2;
+##    uint32_t e : 6;
+##    uint32_t f : 2;
+##  } ;
+## } U;
+##
+## void f(U u) {
+##   printf( "%d\n", u.raw);
+##   return;
+## }
+##
+## int main() {
+##   U u;
+##   u.raw = 0x64A40101;
+##
+##   f(u);
+## }
+##
+## Compiled as follows:
+##
+##
+## clang -g -O1 main.c  -o main
+## clang -g -O1 main.c -S -o main.s
+##
+	.section	__TEXT,__text,regular,pure_instructions
+	.build_version macos, 10, 15	sdk_version 10, 15
+	.globl	_f                      ## -- Begin function f
+	.p2align	4, 0x90
+_f:                                     ## @f
+Lfunc_begin0:
+	.file	1 "/Users/shafik/code" "main.c"
+	.loc	1 18 0                  ## main.c:18:0
+	.cfi_startproc
+## %bb.0:
+	pushq	%rbp
+	.cfi_def_cfa_offset 16
+	.cfi_offset %rbp, -16
+	movq	%rsp, %rbp
+	.cfi_def_cfa_register %rbp
+	##DEBUG_VALUE: f:u <- $edi
+	movl	%edi, %esi
+Ltmp0:
+	##DEBUG_VALUE: f:u <- $esi
+	.loc	1 19 3 prologue_end     ## main.c:19:3
+	leaq	L_.str(%rip), %rdi
+	##DEBUG_VALUE: f:u <- $esi
+	xorl	%eax, %eax
+	popq	%rbp
+	jmp	_printf                 ## TAILCALL
+Ltmp1:
+Lfunc_end0:
+	.cfi_endproc
+                                        ## -- End function
+	.globl	_main                   ## -- Begin function main
+	.p2align	4, 0x90
+_main:                                  ## @main
+Lfunc_begin1:
+	.loc	1 23 0                  ## main.c:23:0
+	.cfi_startproc
+## %bb.0:
+	pushq	%rbp
+	.cfi_def_cfa_offset 16
+	.cfi_offset %rbp, -16
+	movq	%rsp, %rbp
+	.cfi_def_cfa_register %rbp
+Ltmp2:
+	##DEBUG_VALUE: main:u <- 1688469761
+	.loc	1 27 3 prologue_end     ## main.c:27:3
+	movl	$1688469761, %edi       ## imm = 0x64A40101
+	callq	_f
+Ltmp3:
+	.loc	1 28 1                  ## main.c:28:1
+	xorl	%eax, %eax
+	popq	%rbp
+	retq
+Ltmp4:
+Lfunc_end1:
+	.cfi_endproc
+                                        ## -- End function
+	.section	__TEXT,__cstring,cstring_literals
+L_.str:                                 ## @.str
+	.asciz	"%d\n"
+
+	.file	2 "/Applications/Xcode5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/_types" "_uint32_t.h"
+	.section	__DWARF,__debug_str,regular,debug
+Linfo_string:
+	.asciz	"Apple clang version 11.0.0 (clang-1100.0.31.5)" ## string offset=0
+	.asciz	"main.c"                ## string offset=47
+	.asciz	"/Users/shafik/code"    ## string offset=54
+	.asciz	"f"                     ## string offset=73
+	.asciz	"main"                  ## string offset=75
+	.asciz	"int"                   ## string offset=80
+	.asciz	"u"                     ## string offset=84
+	.asciz	"U"                     ## string offset=86
+	.asciz	"raw"                   ## string offset=88
+	.asciz	"uint32_t"              ## string offset=92
+	.asciz	"unsigned int"          ## string offset=101
+	.asciz	"a"                     ## string offset=114
+	.asciz	"b"                     ## string offset=116
+	.asciz	"c"                     ## string offset=118
+	.asciz	"d"                     ## string offset=120
+	.asciz	"e"                     ## string offset=122
+	.section	__DWARF,__debug_loc,regular,debug
+Lsection_debug_loc:
+Ldebug_loc0:
+.set Lset0, Lfunc_begin0-Lfunc_begin0
+	.quad	Lset0
+.set Lset1, Ltmp0-Lfunc_begin0
+	.quad	Lset1
+	.short	1                       ## Loc expr size
+	.byte	85                      ## super-register DW_OP_reg5
+.set Lset2, Ltmp0-Lfunc_begin0
+	.quad	Lset2
+.set Lset3, Ltmp1-Lfunc_begin0
+	.quad	Lset3
+	.short	1                       ## Loc expr size
+	.byte	84                      ## super-register DW_OP_reg4
+	.quad	0
+	.quad	0
+	.section	__DWARF,__debug_abbrev,regular,debug
+Lsection_abbrev:
+	.byte	1                       ## Abbreviation Code
+	.byte	17                      ## DW_TAG_compile_unit
+	.byte	1                       ## DW_CHILDREN_yes
+	.byte	37                      ## DW_AT_producer
+	.byte	14                      ## DW_FORM_strp
+	.byte	19                      ## DW_AT_language
+	.byte	5                       ## DW_FORM_data2
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	16                      ## DW_AT_stmt_list
+	.byte	23                      ## DW_FORM_sec_offset
+	.byte	27                      ## DW_AT_comp_dir
+	.byte	14                      ## DW_FORM_strp
+	.ascii	"\264B"                 ## DW_AT_GNU_pubnames
+	.byte	25                      ## DW_FORM_flag_present
+	.ascii	"\341\177"              ## DW_AT_APPLE_optimized
+	.byte	25                      ## DW_FORM_flag_present
+	.byte	17                      ## DW_AT_low_pc
+	.byte	1                       ## DW_FORM_addr
+	.byte	18                      ## DW_AT_high_pc
+	.byte	6                       ## DW_FORM_data4
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	2                       ## Abbreviation Code
+	.byte	46                      ## DW_TAG_subprogram
+	.byte	1                       ## DW_CHILDREN_yes
+	.byte	17                      ## DW_AT_low_pc
+	.byte	1                       ## DW_FORM_addr
+	.byte	18                      ## DW_AT_high_pc
+	.byte	6                       ## DW_FORM_data4
+	.byte	64                      ## DW_AT_frame_base
+	.byte	24                      ## DW_FORM_exprloc
+	.byte	122                     ## DW_AT_call_all_calls
+	.byte	25                      ## DW_FORM_flag_present
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	39                      ## DW_AT_prototyped
+	.byte	25                      ## DW_FORM_flag_present
+	.byte	63                      ## DW_AT_external
+	.byte	25                      ## DW_FORM_flag_present
+	.ascii	"\341\177"              ## DW_AT_APPLE_optimized
+	.byte	25                      ## DW_FORM_flag_present
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	3                       ## Abbreviation Code
+	.byte	5                       ## DW_TAG_formal_parameter
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	2                       ## DW_AT_location
+	.byte	23                      ## DW_FORM_sec_offset
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	73                      ## DW_AT_type
+	.byte	19                      ## DW_FORM_ref4
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	4                       ## Abbreviation Code
+	.byte	46                      ## DW_TAG_subprogram
+	.byte	1                       ## DW_CHILDREN_yes
+	.byte	17                      ## DW_AT_low_pc
+	.byte	1                       ## DW_FORM_addr
+	.byte	18                      ## DW_AT_high_pc
+	.byte	6                       ## DW_FORM_data4
+	.byte	64                      ## DW_AT_frame_base
+	.byte	24                      ## DW_FORM_exprloc
+	.byte	122                     ## DW_AT_call_all_calls
+	.byte	25                      ## DW_FORM_flag_present
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	73                      ## DW_AT_type
+	.byte	19                      ## DW_FORM_ref4
+	.byte	63                      ## DW_AT_external
+	.byte	25                      ## DW_FORM_flag_present
+	.ascii	"\341\177"              ## DW_AT_APPLE_optimized
+	.byte	25                      ## DW_FORM_flag_present
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	5                       ## Abbreviation Code
+	.byte	52                      ## DW_TAG_variable
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	28                      ## DW_AT_const_value
+	.byte	15                      ## DW_FORM_udata
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	73                      ## DW_AT_type
+	.byte	19                      ## DW_FORM_ref4
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	6                       ## Abbreviation Code
+	.byte	72                      ## DW_TAG_call_site
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	127                     ## DW_AT_call_origin
+	.byte	19                      ## DW_FORM_ref4
+	.byte	125                     ## DW_AT_call_return_pc
+	.byte	1                       ## DW_FORM_addr
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	7                       ## Abbreviation Code
+	.byte	36                      ## DW_TAG_base_type
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	62                      ## DW_AT_encoding
+	.byte	11                      ## DW_FORM_data1
+	.byte	11                      ## DW_AT_byte_size
+	.byte	11                      ## DW_FORM_data1
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	8                       ## Abbreviation Code
+	.byte	22                      ## DW_TAG_typedef
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	73                      ## DW_AT_type
+	.byte	19                      ## DW_FORM_ref4
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	9                       ## Abbreviation Code
+	.byte	23                      ## DW_TAG_union_type
+	.byte	1                       ## DW_CHILDREN_yes
+	.byte	11                      ## DW_AT_byte_size
+	.byte	11                      ## DW_FORM_data1
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	10                      ## Abbreviation Code
+	.byte	13                      ## DW_TAG_member
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	73                      ## DW_AT_type
+	.byte	19                      ## DW_FORM_ref4
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	56                      ## DW_AT_data_member_location
+	.byte	11                      ## DW_FORM_data1
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	11                      ## Abbreviation Code
+	.byte	13                      ## DW_TAG_member
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	73                      ## DW_AT_type
+	.byte	19                      ## DW_FORM_ref4
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	56                      ## DW_AT_data_member_location
+	.byte	11                      ## DW_FORM_data1
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	12                      ## Abbreviation Code
+	.byte	19                      ## DW_TAG_structure_type
+	.byte	1                       ## DW_CHILDREN_yes
+	.byte	11                      ## DW_AT_byte_size
+	.byte	11                      ## DW_FORM_data1
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	13                      ## Abbreviation Code
+	.byte	13                      ## DW_TAG_member
+	.byte	0                       ## DW_CHILDREN_no
+	.byte	3                       ## DW_AT_name
+	.byte	14                      ## DW_FORM_strp
+	.byte	73                      ## DW_AT_type
+	.byte	19                      ## DW_FORM_ref4
+	.byte	58                      ## DW_AT_decl_file
+	.byte	11                      ## DW_FORM_data1
+	.byte	59                      ## DW_AT_decl_line
+	.byte	11                      ## DW_FORM_data1
+	.byte	13                      ## DW_AT_bit_size
+	.byte	11                      ## DW_FORM_data1
+	.byte	107                     ## DW_AT_data_bit_offset
+	.byte	11                      ## DW_FORM_data1
+	.byte	0                       ## EOM(1)
+	.byte	0                       ## EOM(2)
+	.byte	0                       ## EOM(3)
+	.section	__DWARF,__debug_info,regular,debug
+Lsection_info:
+Lcu_begin0:
+.set Lset4, Ldebug_info_end0-Ldebug_info_start0 ## Length of Unit
+	.long	Lset4
+Ldebug_info_start0:
+	.short	4                       ## DWARF version number
+.set Lset5, Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
+	.long	Lset5
+	.byte	8                       ## Address Size (in bytes)
+	.byte	1                       ## Abbrev [1] 0xb:0x10c DW_TAG_compile_unit
+	.long	0                       ## DW_AT_producer
+	.short	12                      ## DW_AT_language
+	.long	47                      ## DW_AT_name
+.set Lset6, Lline_table_start0-Lsection_line ## DW_AT_stmt_list
+	.long	Lset6
+	.long	54                      ## DW_AT_comp_dir
+                                        ## DW_AT_GNU_pubnames
+                                        ## DW_AT_APPLE_optimized
+	.quad	Lfunc_begin0            ## DW_AT_low_pc
+.set Lset7, Lfunc_end1-Lfunc_begin0     ## DW_AT_high_pc
+	.long	Lset7
+	.byte	2                       ## Abbrev [2] 0x2a:0x25 DW_TAG_subprogram
+	.quad	Lfunc_begin0            ## DW_AT_low_pc
+.set Lset8, Lfunc_end0-Lfunc_begin0     ## DW_AT_high_pc
+	.long	Lset8
+	.byte	1                       ## DW_AT_frame_base
+	.byte	86
+                                        ## DW_AT_call_all_calls
+	.long	73                      ## DW_AT_name
+	.byte	1                       ## DW_AT_decl_file
+	.byte	18                      ## DW_AT_decl_line
+                                        ## DW_AT_prototyped
+                                        ## DW_AT_external
+                                        ## DW_AT_APPLE_optimized
+	.byte	3                       ## Abbrev [3] 0x3f:0xf DW_TAG_formal_parameter
+.set Lset9, Ldebug_loc0-Lsection_debug_loc ## DW_AT_location
+	.long	Lset9
+	.long	84                      ## DW_AT_name
+	.byte	1                       ## DW_AT_decl_file
+	.byte	18                      ## DW_AT_decl_line
+	.long	141                     ## DW_AT_type
+	.byte	0                       ## End Of Children Mark
+	.byte	4                       ## Abbrev [4] 0x4f:0x37 DW_TAG_subprogram
+	.quad	Lfunc_begin1            ## DW_AT_low_pc
+.set Lset10, Lfunc_end1-Lfunc_begin1    ## DW_AT_high_pc
+	.long	Lset10
+	.byte	1                       ## DW_AT_frame_base
+	.byte	86
+                                        ## DW_AT_call_all_calls
+	.long	75                      ## DW_AT_name
+	.byte	1                       ## DW_AT_decl_file
+	.byte	23                      ## DW_AT_decl_line
+	.long	134                     ## DW_AT_type
+                                        ## DW_AT_external
+                                        ## DW_AT_APPLE_optimized
+	.byte	5                       ## Abbrev [5] 0x68:0x10 DW_TAG_variable
+	.ascii	"\201\202\220\245\006"  ## DW_AT_const_value
+	.long	84                      ## DW_AT_name
+	.byte	1                       ## DW_AT_decl_file
+	.byte	24                      ## DW_AT_decl_line
+	.long	141                     ## DW_AT_type
+	.byte	6                       ## Abbrev [6] 0x78:0xd DW_TAG_call_site
+	.long	42                      ## DW_AT_call_origin
+	.quad	Ltmp3-Lfunc_begin1      ## DW_AT_call_return_pc
+	.byte	0                       ## End Of Children Mark
+	.byte	7                       ## Abbrev [7] 0x86:0x7 DW_TAG_base_type
+	.long	80                      ## DW_AT_name
+	.byte	5                       ## DW_AT_encoding
+	.byte	4                       ## DW_AT_byte_size
+	.byte	8                       ## Abbrev [8] 0x8d:0xb DW_TAG_typedef
+	.long	152                     ## DW_AT_type
+	.long	86                      ## DW_AT_name
+	.byte	1                       ## DW_AT_decl_file
+	.byte	16                      ## DW_AT_decl_line
+	.byte	9                       ## Abbrev [9] 0x98:0x6c DW_TAG_union_type
+	.byte	4                       ## DW_AT_byte_size
+	.byte	1                       ## DW_AT_decl_file
+	.byte	4                       ## DW_AT_decl_line
+	.byte	10                      ## Abbrev [10] 0x9c:0xc DW_TAG_member
+	.long	88                      ## DW_AT_name
+	.long	260                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	6                       ## DW_AT_decl_line
+	.byte	0                       ## DW_AT_data_member_location
+	.byte	11                      ## Abbrev [11] 0xa8:0x8 DW_TAG_member
+	.long	176                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	7                       ## DW_AT_decl_line
+	.byte	0                       ## DW_AT_data_member_location
+	.byte	12                      ## Abbrev [12] 0xb0:0x53 DW_TAG_structure_type
+	.byte	4                       ## DW_AT_byte_size
+	.byte	1                       ## DW_AT_decl_file
+	.byte	7                       ## DW_AT_decl_line
+	.byte	13                      ## Abbrev [13] 0xb4:0xd DW_TAG_member
+	.long	114                     ## DW_AT_name
+	.long	260                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	9                       ## DW_AT_decl_line
+	.byte	8                       ## DW_AT_bit_size
+	.byte	0                       ## DW_AT_data_bit_offset
+	.byte	13                      ## Abbrev [13] 0xc1:0xd DW_TAG_member
+	.long	116                     ## DW_AT_name
+	.long	260                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	10                      ## DW_AT_decl_line
+	.byte	8                       ## DW_AT_bit_size
+	.byte	8                       ## DW_AT_data_bit_offset
+	.byte	13                      ## Abbrev [13] 0xce:0xd DW_TAG_member
+	.long	118                     ## DW_AT_name
+	.long	260                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	11                      ## DW_AT_decl_line
+	.byte	6                       ## DW_AT_bit_size
+	.byte	16                      ## DW_AT_data_bit_offset
+	.byte	13                      ## Abbrev [13] 0xdb:0xd DW_TAG_member
+	.long	120                     ## DW_AT_name
+	.long	260                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	12                      ## DW_AT_decl_line
+	.byte	2                       ## DW_AT_bit_size
+	.byte	22                      ## DW_AT_data_bit_offset
+	.byte	13                      ## Abbrev [13] 0xe8:0xd DW_TAG_member
+	.long	122                     ## DW_AT_name
+	.long	260                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	13                      ## DW_AT_decl_line
+	.byte	6                       ## DW_AT_bit_size
+	.byte	24                      ## DW_AT_data_bit_offset
+	.byte	13                      ## Abbrev [13] 0xf5:0xd DW_TAG_member
+	.long	73                      ## DW_AT_name
+	.long	260                     ## DW_AT_type
+	.byte	1                       ## DW_AT_decl_file
+	.byte	14                      ## DW_AT_decl_line
+	.byte	2                       ## DW_AT_bit_size
+	.byte	30                      ## DW_AT_data_bit_offset
+	.byte	0                       ## End Of Children Mark
+	.byte	0                       ## End Of Children Mark
+	.byte	8                       ## Abbrev [8] 0x104:0xb DW_TAG_typedef
+	.long	271                     ## DW_AT_type
+	.long	92                      ## DW_AT_name
+	.byte	2                       ## DW_AT_decl_file
+	.byte	31                      ## DW_AT_decl_line
+	.byte	7                       ## Abbrev [7] 0x10f:0x7 DW_TAG_base_type
+	.long	101                     ## DW_AT_name
+	.byte	7                       ## DW_AT_encoding
+	.byte	4                       ## DW_AT_byte_size
+	.byte	0                       ## End Of Children Mark
+Ldebug_info_end0:
+	.section	__DWARF,__debug_macinfo,regular,debug
+Ldebug_macinfo:
+	.byte	0                       ## End Of Macro List Mark
+	.section	__DWARF,__apple_names,regular,debug
+Lnames_begin:
+	.long	1212240712              ## Header Magic
+	.short	1                       ## Header Version
+	.short	0                       ## Header Hash Function
+	.long	2                       ## Header Bucket Count
+	.long	2                       ## Header Hash Count
+	.long	12                      ## Header Data Length
+	.long	0                       ## HeaderData Die Offset Base
+	.long	1                       ## HeaderData Atom Count
+	.short	1                       ## DW_ATOM_die_offset
+	.short	6                       ## DW_FORM_data4
+	.long	0                       ## Bucket 0
+	.long	1                       ## Bucket 1
+	.long	2090499946              ## Hash in Bucket 0
+	.long	177675                  ## Hash in Bucket 1
+.set Lset11, LNames0-Lnames_begin       ## Offset in Bucket 0
+	.long	Lset11
+.set Lset12, LNames1-Lnames_begin       ## Offset in Bucket 1
+	.long	Lset12
+LNames0:
+	.long	75                      ## main
+	.long	1                       ## Num DIEs
+	.long	79
+	.long	0
+LNames1:
+	.long	73                      ## f
+	.long	1                       ## Num DIEs
+	.long	42
+	.long	0
+	.section	__DWARF,__apple_objc,regular,debug
+Lobjc_begin:
+	.long	1212240712              ## Header Magic
+	.short	1                       ## Header Version
+	.short	0                       ## Header Hash Function
+	.long	1                       ## Header Bucket Count
+	.long	0                       ## Header Hash Count
+	.long	12                      ## Header Data Length
+	.long	0                       ## HeaderData Die Offset Base
+	.long	1                       ## HeaderData Atom Count
+	.short	1                       ## DW_ATOM_die_offset
+	.short	6                       ## DW_FORM_data4
+	.long	-1                      ## Bucket 0
+	.section	__DWARF,__apple_namespac,regular,debug
+Lnamespac_begin:
+	.long	1212240712              ## Header Magic
+	.short	1                       ## Header Version
+	.short	0                       ## Header Hash Function
+	.long	1                       ## Header Bucket Count
+	.long	0                       ## Header Hash Count
+	.long	12                      ## Header Data Length
+	.long	0                       ## HeaderData Die Offset Base
+	.long	1                       ## HeaderData Atom Count
+	.short	1                       ## DW_ATOM_die_offset
+	.short	6                       ## DW_FORM_data4
+	.long	-1                      ## Bucket 0
+	.section	__DWARF,__apple_types,regular,debug
+Ltypes_begin:
+	.long	1212240712              ## Header Magic
+	.short	1                       ## Header Version
+	.short	0                       ## Header Hash Function
+	.long	4                       ## Header Bucket Count
+	.long	4                       ## Header Hash Count
+	.long	20                      ## Header Data Length
+	.long	0                       ## HeaderData Die Offset Base
+	.long	3                       ## HeaderData Atom Count
+	.short	1                       ## DW_ATOM_die_offset
+	.short	6                       ## DW_FORM_data4
+	.short	3                       ## DW_ATOM_die_tag
+	.short	5                       ## DW_FORM_data2
+	.short	4                       ## DW_ATOM_type_flags
+	.short	11                      ## DW_FORM_data1
+	.long	0                       ## Bucket 0
+	.long	1                       ## Bucket 1
+	.long	3                       ## Bucket 2
+	.long	-1                      ## Bucket 3
+	.long	193495088               ## Hash in Bucket 0
+	.long	290711645               ## Hash in Bucket 1
+	.long	-1304652851             ## Hash in Bucket 1
+	.long	177658                  ## Hash in Bucket 2
+.set Lset13, Ltypes3-Ltypes_begin       ## Offset in Bucket 0
+	.long	Lset13
+.set Lset14, Ltypes1-Ltypes_begin       ## Offset in Bucket 1
+	.long	Lset14
+.set Lset15, Ltypes2-Ltypes_begin       ## Offset in Bucket 1
+	.long	Lset15
+.set Lset16, Ltypes0-Ltypes_begin       ## Offset in Bucket 2
+	.long	Lset16
+Ltypes3:
+	.long	80                      ## int
+	.long	1                       ## Num DIEs
+	.long	134
+	.short	36
+	.byte	0
+	.long	0
+Ltypes1:
+	.long	92                      ## uint32_t
+	.long	1                       ## Num DIEs
+	.long	260
+	.short	22
+	.byte	0
+	.long	0
+Ltypes2:
+	.long	101                     ## unsigned int
+	.long	1                       ## Num DIEs
+	.long	271
+	.short	36
+	.byte	0
+	.long	0
+Ltypes0:
+	.long	86                      ## U
+	.long	1                       ## Num DIEs
+	.long	141
+	.short	22
+	.byte	0
+	.long	0
+	.section	__DWARF,__debug_gnu_pubn,regular,debug
+.set Lset17, LpubNames_end0-LpubNames_begin0 ## Length of Public Names Info
+	.long	Lset17
+LpubNames_begin0:
+	.short	2                       ## DWARF Version
+.set Lset18, Lcu_begin0-Lsection_info   ## Offset of Compilation Unit Info
+	.long	Lset18
+	.long	279                     ## Compilation Unit Length
+	.long	79                      ## DIE offset
+	.byte	48                      ## Attributes: FUNCTION, EXTERNAL
+	.asciz	"main"                  ## External Name
+	.long	42                      ## DIE offset
+	.byte	48                      ## Attributes: FUNCTION, EXTERNAL
+	.asciz	"f"                     ## External Name
+	.long	0                       ## End Mark
+LpubNames_end0:
+	.section	__DWARF,__debug_gnu_pubt,regular,debug
+.set Lset19, LpubTypes_end0-LpubTypes_begin0 ## Length of Public Types Info
+	.long	Lset19
+LpubTypes_begin0:
+	.short	2                       ## DWARF Version
+.set Lset20, Lcu_begin0-Lsection_info   ## Offset of Compilation Unit Info
+	.long	Lset20
+	.long	279                     ## Compilation Unit Length
+	.long	141                     ## DIE offset
+	.byte	144                     ## Attributes: TYPE, STATIC
+	.asciz	"U"                     ## External Name
+	.long	260                     ## DIE offset
+	.byte	144                     ## Attributes: TYPE, STATIC
+	.asciz	"uint32_t"              ## External Name
+	.long	271                     ## DIE offset
+	.byte	144                     ## Attributes: TYPE, STATIC
+	.asciz	"unsigned int"          ## External Name
+	.long	134                     ## DIE offset
+	.byte	144                     ## Attributes: TYPE, STATIC
+	.asciz	"int"                   ## External Name
+	.long	0                       ## End Mark
+LpubTypes_end0:
+
+.subsections_via_symbols
+	.section	__DWARF,__debug_line,regular,debug
+Lsection_line:
+Lline_table_start0:
Index: lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/TestValueObjPassByRef.py
===================================================================
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/TestValueObjPassByRef.py
@@ -0,0 +1,34 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestValueObjPassByRef(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    @skipIf(archs=no_match(['x86_64']))
+    @skipUnlessDarwin
+    def test(self):
+        self.build()
+        lldbutil.run_to_name_breakpoint(self, "f", exe_name="a.out")
+
+        self.expect("frame var -L", substrs = [ "rsi: (U) u = {",
+                      "scalar:   raw = 1688469761",
+                      "scalar:     a = 1",
+                      "scalar:     b = 1",
+                      "scalar:     c = 36",
+                      "scalar:     d = 2",
+                      "scalar:     e = 36",
+                      "scalar:     f = 1",
+                      "}",
+                      "}"])
+
+        u = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('u')
+        self.assertEqual(u.GetChildMemberWithName('raw').GetValueAsUnsigned(), 1688469761)
+        self.assertEqual(u.GetChildMemberWithName('a').GetValueAsUnsigned(), 1)
+        self.assertEqual(u.GetChildMemberWithName('b').GetValueAsUnsigned(), 1)
+        self.assertEqual(u.GetChildMemberWithName('c').GetValueAsUnsigned(), 36)
+        self.assertEqual(u.GetChildMemberWithName('d').GetValueAsUnsigned(), 2)
+        self.assertEqual(u.GetChildMemberWithName('e').GetValueAsUnsigned(), 36)
+        self.assertEqual(u.GetChildMemberWithName('f').GetValueAsUnsigned(), 1)
Index: lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/valueobj-pass-by-reg/Makefile
@@ -0,0 +1,5 @@
+# We are only supplying main.s but
+# Make has a built-in rule for going from main.c -> main.s and main.c to main.o
+# Make knows it needs $(EXE), for that it knows it needs main.o and it has a rule for building that from main.s
+C_SOURCES := main.c
+include Makefile.rules
Index: lldb/source/Core/ValueObjectChild.cpp
===================================================================
--- lldb/source/Core/ValueObjectChild.cpp
+++ lldb/source/Core/ValueObjectChild.cpp
@@ -199,11 +199,7 @@
           // try to extract the child value from the parent's scalar value
           {
             Scalar scalar(m_value.GetScalar());
-            if (m_bitfield_bit_size)
-              scalar.ExtractBitfield(m_bitfield_bit_size,
-                                     m_bitfield_bit_offset);
-            else
-              scalar.ExtractBitfield(8 * m_byte_size, 8 * m_byte_offset);
+            scalar.ExtractBitfield(8 * m_byte_size, 8 * m_byte_offset);
             m_value.GetScalar() = scalar;
           }
           break;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to