1. Sid Price
  2. Valentina Database ADK
  3. Четверг, Сентябрь 22 2016, 05:43 PM
  4.  Подписаться через email
In my C++ application I am using the String class to pass to some Valentina methods. I am debugging the application using the VisualGDB plugin for Visual Studio 2015. The problem I have is that unlike the string class of the C++ Standard Library it does not appear possible to view the contents of these String variables with the debugger. This makes some debug operations very hard. Does anyone have a method for inspecting String object contents in a debugger?
Thanks,
Sid
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Hi Sid,

* std::string is char* based
* String -> I_String -> String_ICU use UChar*, 2 bytes UTF16 strings.

Does Visual debugger is able show UChar* strings?
Lets assume we have just
UChar* ps = str.c_str();

What Visual Debugger will show for ps?


2) XCODE do have some feature to setup description of user-types, and in theory this should help show better this or that type. I never used this btw.

May be Visual have something like this?
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
May be this can help

https://msdn.microsoft.com/en-us/library/jj620914.aspx?f=255&;MSPPError=-2147217396
Комментарий
There are no comments made yet.
Sid Price Ответ принят
I made a small test:

		String aTest = "Test String";
const UChar * ps = aTest.c_str();


Note that the UChar must be defined "const" or a cast used. The debugger shows the value of the pointer, this may be expanded and it shows the first character of the string.

		ps	0x00038b28 {0x54}	const fbl::UChar *
*ps 0x54 const fbl::UChar


However if I examine aTest" I see:

		aTest	{}	fbl::String


And no expansion is possible.
Sid
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
UChar* I am used to watch in the MEMORY window.
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
String - yes it not expands, because you have release dlls, and without debug info.
Комментарий
There are no comments made yet.
Sid Price Ответ принят
Using the Memory view is a poor solution to have to use in a really good debugger that provides facilities to read a variable by simply placing the mouse cursor over a variable. No one has to open the Memory view and drag the variable to it. In this way only one variable can be seen.

This makes the String class one I will probably avoid unless I need to send parameters to the Valentina API. This is a great pity because any extra overhead, such as converting from string to String, is to be avoided in embedded systems.

Sid
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Good debugger can show UTF16 directly?

As far as I see, this is common problem

http://stackoverflow.com/questions/20960182/displaying-utf-16-strings-in-vs-debugger
Комментарий
There are no comments made yet.
Sid Price Ответ принят
Quoting from the link you posted:

When I hover the mouse over strings while debugging, Visual Studio displays the contents of the string.


The OP who posted the question went on to say it didn't work for non-English language. A comment pointed out that it in fact does work and later the OP admitted the mistake was theirs.

What is the benefit of forcing users to use a new class (String) that has such limited features when compared to "string"? I understand the benefits of smart pointers, however, those benefits need to out-way the down side of limited debug access and lack of a full set of features in the String class.

I also realize that this is a design decision taken some time ago and that it is unlikely to change. My original question was to ask for help in improving the debugger experience. As I said earlier I am going to limkit my use of the String class to only the calls into the Valentina API that require its use.
Sid
Комментарий
There are no comments made yet.
  • Страница :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories