Add variables to debug info
This commit is contained in:
		
							parent
							
								
									e75c38ad85
								
							
						
					
					
						commit
						7c8a123945
					
				
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @ -10,7 +10,7 @@ clean: | ||||
| 	rm -f $(BIN) $(SRC:.reid=.o) $(SRC:.reid=.asm) $(SRC:.reid=.ll) | ||||
| 
 | ||||
| $(BIN): $(SRC:.reid=.o) | ||||
| 	$(LD) -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/crt1.o -lc $(LDFLAGS) $< -o$@ | ||||
| 	$(LD) -O0 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/crt1.o -lc $(LDFLAGS) $< -o$@ | ||||
| 
 | ||||
| .SUFFIXES: .o .reid | ||||
| .reid.o: | ||||
|  | ||||
| @ -432,7 +432,18 @@ impl DebugMetadataHolder { | ||||
|                     param.always_preserve as i32, | ||||
|                     param.flags.as_llvm(), | ||||
|                 ), | ||||
|                 DebugMetadata::LocalVar(debug_local_variable) => todo!(), | ||||
|                 DebugMetadata::LocalVar(var) => LLVMDIBuilderCreateAutoVariable( | ||||
|                     debug.builder, | ||||
|                     *debug.programs.get(&self.program).unwrap(), | ||||
|                     into_cstring(var.name.clone()).as_ptr(), | ||||
|                     var.name.len(), | ||||
|                     debug.file_ref, | ||||
|                     var.location.line, | ||||
|                     *debug.types.get(&var.ty).unwrap(), | ||||
|                     var.always_preserve as i32, | ||||
|                     var.flags.as_llvm(), | ||||
|                     var.alignment, | ||||
|                 ), | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -229,9 +229,10 @@ pub struct DebugParamVariable { | ||||
| pub struct DebugLocalVariable { | ||||
|     pub name: String, | ||||
|     pub location: DebugLocation, | ||||
|     pub ty: DebugMetadataValue, | ||||
|     pub ty: DebugTypeValue, | ||||
|     pub always_preserve: bool, | ||||
|     pub alignment: u32, | ||||
|     pub flags: DwarfFlags, | ||||
| } | ||||
| 
 | ||||
| impl Default for DebugSubprogramOptionals { | ||||
|  | ||||
| @ -4,8 +4,8 @@ use reid_lib::{ | ||||
|     builder::{InstructionValue, TypeValue}, | ||||
|     compile::CompiledModule, | ||||
|     debug_information::{ | ||||
|         DebugBasicType, DebugFileData, DebugInformation, DebugLocation, DebugMetadata, | ||||
|         DebugMetadataValue, DebugParamVariable, DebugProgramValue, DebugScopeValue, | ||||
|         DebugBasicType, DebugFileData, DebugInformation, DebugLocalVariable, DebugLocation, | ||||
|         DebugMetadata, DebugMetadataValue, DebugParamVariable, DebugProgramValue, DebugScopeValue, | ||||
|         DebugSubprogramData, DebugSubprogramOptionals, DebugSubprogramTypeData, DebugTypeData, | ||||
|         DebugTypeValue, DwarfEncoding, DwarfFlags, | ||||
|     }, | ||||
| @ -440,6 +440,20 @@ impl mir::Statement { | ||||
|                         ty.get_type(scope.type_values, scope.types), | ||||
|                     ), | ||||
|                 ); | ||||
|                 if let Some(debug) = &scope.debug { | ||||
|                     let location = self.1.into_debug(scope.tokens).unwrap(); | ||||
|                     debug.info.metadata( | ||||
|                         &debug.scope, | ||||
|                         DebugMetadata::LocalVar(DebugLocalVariable { | ||||
|                             name: name.clone(), | ||||
|                             location, | ||||
|                             ty: scope.debug_const_tys.get(&TypeKind::U32).unwrap().clone(), | ||||
|                             always_preserve: true, | ||||
|                             alignment: 32, | ||||
|                             flags: DwarfFlags, | ||||
|                         }), | ||||
|                     ); | ||||
|                 } | ||||
|                 None | ||||
|             } | ||||
|             mir::StmtKind::Set(lhs, rhs) => { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user