[lldb-dev] [Bug 15879] New: problem with evaluation u16string

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 30 19:22:10 PDT 2013


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

            Bug ID: 15879
           Summary: problem with evaluation u16string
           Product: lldb
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at cs.uiuc.edu
          Reporter: dmarkman at mac.com
    Classification: Unclassified

Hi, consider the following program (unstring.cpp)

#include <iostream>
#include <string>

int main() {    
    std::u16string ustr = u"Hello World";
    std::cout << ustr.length() <<std::endl;
    for(int i = 0; i < ustr.length(); i++) {
        std::cout << ustr[i] << " ";
    }
    std::cout << std::endl;
    return 0;
}

compile it with the clang (clang version 3.3 (trunk 180663 Target:
x86_64-apple-darwin12.3.0)

clang++ -o ustring -std=c++11 -stdlib=libc++ -nostdinc++
-I/Users/dima/Development/C++/clang/libcxx/include
-L/Users/dima/Development/C++/clang/libcxx/lib -g -O0 ustring.cpp

where livcxx was build from latest libcxx

I built lldb as well (lldb-300.99.0)

I set breakpoint at line 18 (b ustring.cpp:18)

when I stopped

I tried 
expression -- ustr
(std::__1::u16string) $0 = {
  __r_ = {
    std::__1::__libcpp_compressed_pair_imp<std::__1::basic_string<char16_t,
std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__rep,
std::__1::allocator<char16_t> > = {
      __first_ = {
         = {
          __l = {
            __cap_ = 17
            __size_ = 11
            __data_ = 0x0000000100203bd0 u"Hello World"
          }
          __s = {
             = {
              __size_ = '\x11'
              __lx = U+0011 u''
            }
            __data_ = {
              [0] = U+0000 u''
              [1] = U+0000 u''
              [2] = U+0000 u''
              [3] = U+000b u'
                             '
              [4] = U+0000 u''
              [5] = U+0000 u''
              [6] = U+0000 u''
              [7] = U+3bd0 u''
              [8] = U+0020 u' '
              [9] = U+0001 u''
              [10] = U+0000 u''
            }
          }
          __r = {
            __words = {
              [0] = 17
              [1] = 11
              [2] = 4297079760
            }
          }
        }
      }
    }
  }
}

but when I tried
expression -- ustr[0]
I got
error: call to a function 'std::__1::basic_string<char16_t,
std::__1::char_traits<char16_t>, std::__1::allocator<char16_t>
>::operator[](unsigned long)' that is not present in the target
error: The expression could not be prepared to run in the target


or 
expression -- ustr.c_str()

error: call to a function 'std::__1::basic_string<char16_t,
std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::c_str()
const' that is not present in the target
error: The expression could not be prepared to run in the target


gdb is working fine

thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130501/bc496b70/attachment.html>


More information about the lldb-dev mailing list