How to set a double variable in gdb with german locale?

I am debugging my c ++ program using gdb. I am having difficulty setting a simple double variable due to the German locale.

gdb will not accept decimal point values. Written with a German decimal point (comma), gdb ignores everything after the decimal point.

 (gdb) p this->foodSupply $1 = 1 (gdb) set this->foodSupply = 4.3 Ungültige Nummer »4.3«. (gdb) p this->foodSupply $1 = 1 (gdb) set this->foodSupply = 4,3 (gdb) p this->foodSupply $3 = 4 

I decided that I could avoid the problem by running gdb with LC_ALL=EN gdb ... But since it’s not so easy when developing my IDE, I want to know if there is another way.

How can a German user enter a decimal point in gdb?

+5
source share
1 answer

Look at this error:
https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1341125
It may explain why this does not work, how you want it.

You can try a workaround like

 (gdb) set this->foodSupply = (double) 43/10 

if your numbers are simple like 4.3.

+2
source

Source: https://habr.com/ru/post/1239215/


All Articles