<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - problem with evaluation u16string"
href="http://llvm.org/bugs/show_bug.cgi?id=15879">15879</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>problem with evaluation u16string
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dmarkman@mac.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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>
<span class="quote">>::operator[](unsigned long)' that is not present in the target</span >
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>