[codegen][debug info][dwarf] (var) variable inspection in debugger support
- debug location metainformation attached to stack allcated slots. - python bindings to work such variables.
This commit is contained in:
committed by
Vasily Levchenko
parent
4931b2f05b
commit
db1a1b029a
@@ -33,6 +33,12 @@ internal enum class DwarfTypeKind(val value:Byte) {
|
||||
#undef HANDLE_DW_ATE
|
||||
}
|
||||
|
||||
internal enum class DwarfOp(val value:Long) {
|
||||
#define HANDLE_DW_OP(ID, NAME) DW_OP_##NAME(ID),
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#undef HANDLE_DW_OP
|
||||
}
|
||||
|
||||
internal enum class DwarfLanguage(val value:Int) {
|
||||
#define HANDLE_DW_LANG(ID, NAME) DW_LANG_##NAME(ID),
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
|
||||
@@ -178,6 +178,12 @@ DIDerivedTypeRef DICreateReferenceType(DIBuilderRef refBuilder, DITypeOpaqueRef
|
||||
llvm::unwrap(refType)));
|
||||
}
|
||||
|
||||
DIDerivedTypeRef DICreatePointerType(DIBuilderRef refBuilder, DITypeOpaqueRef refType) {
|
||||
return llvm::wrap(llvm::unwrap(refBuilder)->createReferenceType(
|
||||
llvm::dwarf::DW_TAG_pointer_type,
|
||||
llvm::unwrap(refType)));
|
||||
}
|
||||
|
||||
DISubroutineTypeRef DICreateSubroutineType(DIBuilderRef builder,
|
||||
DITypeOpaqueRef* types,
|
||||
unsigned typesCount) {
|
||||
@@ -212,11 +218,14 @@ DIExpressionRef DICreateEmptyExpression(DIBuilderRef builder) {
|
||||
return llvm::wrap(llvm::unwrap(builder)->createExpression());
|
||||
}
|
||||
|
||||
void DIInsertDeclarationWithEmptyExpression(DIBuilderRef builder, LLVMValueRef value, DILocalVariableRef localVariable, DILocationRef location, LLVMBasicBlockRef bb) {
|
||||
void DIInsertDeclaration(DIBuilderRef builder, LLVMValueRef value, DILocalVariableRef localVariable, DILocationRef location, LLVMBasicBlockRef bb, int64_t *expr, uint64_t exprCount) {
|
||||
auto di_builder = llvm::unwrap(builder);
|
||||
std::vector<int64_t> expression;
|
||||
for (uint64_t i = 0; i < exprCount; ++i)
|
||||
expression.push_back(expr[i]);
|
||||
di_builder->insertDeclare(llvm::unwrap(value),
|
||||
llvm::unwrap(localVariable),
|
||||
di_builder->createExpression(),
|
||||
di_builder->createExpression(expression),
|
||||
llvm::unwrap(location),
|
||||
llvm::unwrap(bb));
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ DICompositeTypeRef DICreateArrayType(DIBuilderRef refBuilder,
|
||||
uint64_t elementsCount);
|
||||
|
||||
DIDerivedTypeRef DICreateReferenceType(DIBuilderRef refBuilder, DITypeOpaqueRef refType);
|
||||
DIDerivedTypeRef DICreatePointerType(DIBuilderRef refBuilder, DITypeOpaqueRef refType);
|
||||
DICompositeTypeRef DICreateReplaceableCompositeType(DIBuilderRef refBuilder,
|
||||
int tag,
|
||||
const char *name,
|
||||
@@ -92,7 +93,7 @@ DISubroutineTypeRef DICreateSubroutineType(DIBuilderRef builder,
|
||||
unsigned typesCount);
|
||||
|
||||
DILocalVariableRef DICreateAutoVariable(DIBuilderRef builder, DIScopeOpaqueRef scope, const char *name, DIFileRef file, unsigned line, DITypeOpaqueRef type);
|
||||
void DIInsertDeclarationWithEmptyExpression(DIBuilderRef builder, LLVMValueRef value, DILocalVariableRef localVariable, DILocationRef location, LLVMBasicBlockRef bb);
|
||||
void DIInsertDeclaration(DIBuilderRef builder, LLVMValueRef value, DILocalVariableRef localVariable, DILocationRef location, LLVMBasicBlockRef bb, int64_t *expr, uint64_t exprCount);
|
||||
DIExpressionRef DICreateEmptyExpression(DIBuilderRef builder);
|
||||
void DIFunctionAddSubprogram(LLVMValueRef fn, DISubprogramRef sp);
|
||||
DILocationRef LLVMBuilderSetDebugLocation(LLVMBuilderRef builder, unsigned line, unsigned col, DIScopeOpaqueRef scope);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
##
|
||||
# Copyright 2010-2017 JetBrains s.r.o.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#
|
||||
# (lldb) command script import llvmDebugInfoC/src/scripts/konan_lldb.py
|
||||
# (lldb) show_variable
|
||||
#
|
||||
|
||||
import lldb
|
||||
import commands
|
||||
import optparse
|
||||
import shlex
|
||||
|
||||
def show_variable(debugger, command, result, internal_dict):
|
||||
debugger.GetCommandInterpreter().HandleCommand('expr -- Konan_DebugPrint(%s)' % command, result)
|
||||
return result
|
||||
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
debugger.HandleCommand('command script add -f konan_lldb.show_variable show_variable')
|
||||
|
||||
Reference in New Issue
Block a user