[LLVMbugs] [Bug 19922] New: Broken debugging info compiled with -g -O0 gives <variable not available> while debugging in lldb within functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 2 09:09:03 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19922

            Bug ID: 19922
           Summary: Broken debugging info compiled with -g -O0 gives
                    <variable not available> while debugging in lldb
                    within functions
           Product: clang
           Version: 3.4
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chris.schaf at verizon.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12592
  --> http://llvm.org/bugs/attachment.cgi?id=12592&action=edit
gzip'd version of executables.i

When I compile my source with -g -O0 I should have access to all of my
variables at all times within lldb but most of the time I do not.    When I use
"frame variable", many of the variables are shown as <variable not available>. 
 It looks like an optimized build but it is not.

I've attached the source file executables.i  - which is executables.cc after
running it through the preprocessor with the compilation command below after
inserting -E.


Here's my compiler version:
fry:lisp$ clang++ -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix


Here is the compilation command:  ------------------------
    "clang++" -x c++ -O0 -g -Warray-bounds -Wgnu-array-member-paren-init
-Wno-deprecated-register -mmacosx-version-min=10.7 -fvisibility=default
-std=c++11 -stdlib=libc++ -DCONFIG_VAR_COOL -DDEBUG_ASSERTS
-DDEBUG_MPS_AMS_POOL -DEXPAT -DINCLUDED_FROM_CLASP -DINHERITED_FROM_SRC
-DREADLINE -DUSE_BOEHM -D_ADDRESS_MODEL_64 -D_DEBUG_BUILD -D_TARGET_OS_DARWIN
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-I"../../src" -I"../../src/core"
-I"../../src/core/bin/boehm/clang-darwin-4.2.1/debug/link-static"
-I"/Library/Frameworks/EPD64.framework/Versions/7.2/include/python2.7"
-I"/Users/meister/Development/cando/clasp/build/cando.app/Contents/Resources/externals/common/include"
-I"/Users/meister/Development/cando/clasp/build/cando.app/Contents/Resources/externals/release/include"
-c -o
"../../src/core/bin/boehm/clang-darwin-4.2.1/debug/link-static/executables.o"
"../../src/core/executables.cc"

Here is a sample session with lldb.   
Notice, when I enter the function - all variables are available but when I step
in a few lines they become unavailable 
-------------------------------------------    

Process 34384 launched:
'/Users/meister/Development/cando/clasp/build/cando.app/Contents/MacOS/clasp_boehm_d'
(x86_64)
1 location added to breakpoint 1
1 location added to breakpoint 2
1 location added to breakpoint 3
1 location added to breakpoint 4
1 location added to breakpoint 5
1 location added to breakpoint 6
Using CLASP_LISP_SOURCE_DIR --> /Users/meister/Development/cando/clasp/src/lisp
../../src/gctools/memoryManagement.h:107 Subclass must implement repr
../../src/gctools/memoryManagement.h:113 attachToGCRoot for StackRoot
../../src/clbind/derivable_class.h:720 Should I be adding a wrapper cast???
../../src/clbind/derivable_class.h:720 Should I be adding a wrapper cast???
../../src/clbind/derivable_class.h:720 Should I be adding a wrapper cast???
../../src/clbind/derivable_class.h:720 Should I be adding a wrapper cast???
../../src/clbind/derivable_class.h:720 Should I be adding a wrapper cast???
../../src/clbind/class.h:634 In
constructor_registration::registerDefaultConstructor
derivable_default_constructor<> ----- Make sure that I'm being called for
derivable classes
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newClangTool
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newReplacement
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newRefactoringTool
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newRewriter
../../src/clbind/class.h:634 In
constructor_registration::registerDefaultConstructor
derivable_default_constructor<> ----- Make sure that I'm being called for
derivable classes
../../src/clbind/class.h:634 In
constructor_registration::registerDefaultConstructor
derivable_default_constructor<> ----- Make sure that I'm being called for
derivable classes
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for makeClangSyntaxOnlyAdjuster
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for makeClangStripOutputAdjuster
../../src/clbind/class.h:634 In
constructor_registration::registerDefaultConstructor
derivable_default_constructor<> ----- Make sure that I'm being called for
derivable classes
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newParserValue
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newVariantValueUnsigned
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newVariantValueString
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newVariantValueMatcher
../../src/clbind/(lldb) class.h:551    constructor_registration_base::register_
called for newDiagnostics
../../src/clbind/class.h:551    constructor_registration_base::register_ called
for newMatchFinder
../../src/clbind/class.h:634 In
constructor_registration::registerDefaultConstructor
derivable_default_constructor<> ----- Make sure that I'm being called for
derivable classes
Process 34384 stopped
* thread #1: tid = 0x81e48, 0x0000000101557c26
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 22 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:227,
stop reason = breakpoint 6.2
    frame #0: 0x0000000101557c26
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 22 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:227
   224                                Environment_sp environ,
   225                                Symbol_sp kind)
   226         {_G();
-> 227         Interpreted_sp    proc;
   228         LOG(BF("Creating a function named: %s")% _rep_(name));
   229         proc = Interpreted_O::create();
   230         proc->_Name = name;
(lldb) frame variable
frame variable
(core::T_sp) name = {
  gctools::tagged_ptr<core::T_O> = (px = 0x0000000000000009)
}
(core::LambdaListHandler_sp) lambda_list_handler = {
  gctools::tagged_ptr<core::LambdaListHandler_O> = {
    px = 0x000000010bc479a8
  }
}
(core::Cons_sp) declares = {
  gctools::tagged_ptr<core::Cons_O> = {
    px = 0x0000000000000009
  }
}
(core::Str_sp) docString = {
  gctools::tagged_ptr<core::Str_O> = {
    px = 0x0000000000000009
  }
}
(core::Cons_sp) code = {
  gctools::tagged_ptr<core::Cons_O> = {
    px = 0x000000010bc70308
  }
}
(core::Environment_sp) environ = {
  gctools::tagged_ptr<core::Environment_O> = {
    px = 0x0000000000000009
  }
}
(core::Symbol_sp) kind = {
  gctools::tagged_ptr<core::Symbol_O> = {
    px = 0x0000000106e56d08
  }
}
(core::SourceFileInfo_mv) sfi = {
  gctools::smart_ptr<core::SourceFileInfo_O> = {
    gctools::tagged_ptr<core::SourceFileInfo_O> = {
      px = 0x00000001031a56f0
    }
  }
  _number_of_values = 1606396064
}
(core::Interpreted_sp) proc = {
  gctools::tagged_ptr<core::Interpreted_O> = {
    px = 0x00007fff5fbfaa38
  }
}
(lldb) n
n
Process 34384 stopped
* thread #1: tid = 0x81e48, 0x0000000101557c65
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 85 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:229,
stop reason = step over
    frame #0: 0x0000000101557c65
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 85 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:229
   226         {_G();
   227         Interpreted_sp    proc;
   228         LOG(BF("Creating a function named: %s")% _rep_(name));
-> 229         proc = Interpreted_O::create();
   230         proc->_Name = name;
   231         proc->_LambdaListHandler = lambda_list_handler;
   232         proc->_Declares = declares;
(lldb) frame variable
frame variable
(core::T_sp) name = {
  gctools::tagged_ptr<core::T_O> = (px = 0x0000000000000009)
}
(core::LambdaListHandler_sp) lambda_list_handler = {
  gctools::tagged_ptr<core::LambdaListHandler_O> = {
    px = 0x000000010bc479a8
  }
}
(core::Cons_sp) declares = {
  gctools::tagged_ptr<core::Cons_O> = {
    px = 0x0000000000000009
  }
}
(core::Str_sp) docString = {
  gctools::tagged_ptr<core::Str_O> = {
    px = 0x0000000000000009
  }
}
(core::Cons_sp) code = {
  gctools::tagged_ptr<core::Cons_O> = {
    px = 0x000000010bc70308
  }
}
(core::Environment_sp) environ = {
  gctools::tagged_ptr<core::Environment_O> = {
    px = 0x0000000000000009
  }
}
(core::Symbol_sp) kind = {
  gctools::tagged_ptr<core::Symbol_O> = {
    px = 0x0000000106e56d08
  }
}
(core::SourceFileInfo_mv) sfi = {
  gctools::smart_ptr<core::SourceFileInfo_O> = {
    gctools::tagged_ptr<core::SourceFileInfo_O> = {
      px = 0x00000001031a56f0
    }
  }
  _number_of_values = 1606396064
}
(core::Interpreted_sp) proc = {
  gctools::tagged_ptr<core::Interpreted_O> = {
    px = 0x0000000000000000
  }
}
(lldb) n
n
Process 34384 stopped
* thread #1: tid = 0x81e48, 0x0000000101557c95
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 133 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:230,
stop reason = step over
    frame #0: 0x0000000101557c95
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 133 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:230
   227         Interpreted_sp    proc;
   228         LOG(BF("Creating a function named: %s")% _rep_(name));
   229         proc = Interpreted_O::create();
-> 230         proc->_Name = name;
   231         proc->_LambdaListHandler = lambda_list_handler;
   232         proc->_Declares = declares;
   233         proc->_DocString = docString;
(lldb) n
n
Process 34384 stopped
* thread #1: tid = 0x81e48, 0x0000000101557cd0
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 192 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:231,
stop reason = step over
    frame #0: 0x0000000101557cd0
clasp_boehm_d`core::Interpreted_O::create(gctools::smart_ptr<core::T_O>,
gctools::smart_ptr<core::LambdaListHandler_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Str_O>,
gctools::smart_ptr<core::Cons_O>, gctools::smart_ptr<core::Environment_O>,
gctools::smart_ptr<core::Symbol_O>) + 192 at
/Users/meister/Development/cando/clasp/src/main/../../src/core/executables.cc:231
   228         LOG(BF("Creating a function named: %s")% _rep_(name));
   229         proc = Interpreted_O::create();
   230         proc->_Name = name;
-> 231         proc->_LambdaListHandler = lambda_list_handler;
   232         proc->_Declares = declares;
   233         proc->_DocString = docString;
   234         proc->_Declares = declares;
(lldb) frame variable
frame variable
(core::T_sp) name = <variable not available>

(core::LambdaListHandler_sp) lambda_list_handler = <variable not available>

(core::Cons_sp) declares = <variable not available>

(core::Str_sp) docString = <variable not available>

(core::Cons_sp) code = <variable not available>

(core::Environment_sp) environ = <variable not available>

(core::Symbol_sp) kind = <variable not available>

(core::SourceFileInfo_mv) sfi = {
  gctools::smart_ptr<core::SourceFileInfo_O> = {
    gctools::tagged_ptr<core::SourceFileInfo_O> = {
      px = 0x00000001031a56f0
    }
  }
  _number_of_values = 1606396064
}
(core::Interpreted_sp) proc = <variable not available>

(lldb) print code
print code
error: Couldn't materialize struct: size of variable code (8) disagrees with
the ValueObject's size (0)
Errored out in Execute, couldn't PrepareToExecuteJITExpression
(lldb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140602/ce7e3951/attachment.html>


More information about the llvm-bugs mailing list