| Summary: | sys-devel/gdb-7.7.1 - strange printing of a number in a string | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | georg |
| Component: | [OLD] Core system | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
| Status: | RESOLVED INVALID | ||
| Severity: | normal | ||
| Priority: | Normal | ||
| Version: | unspecified | ||
| Hardware: | AMD64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
test source code
gdb emerge info |
||
|
Description
georg
2014-12-15 19:46:28 UTC
Created attachment 391786 [details]
test source code
Created attachment 391788 [details]
gdb emerge info
I am uncertain if this is a bug which should be reported upstream or if it is related to some patch from gentoo ... I got aware of such issue as i debugged some c++ application. See this snippet.
[INFO ] mgr::impl::check_create_config: int_config exists
[DEBUG] set sql: INSERT INTO myStructType (id, val1, val2, number, name) values ('100', '3.3999999999999999', '5.5999999999999996', '42', 'Georg')
Breakpoint 2, base::entity::mgr::impl::set (this=0x628d60, id=100, name="myStructType", desc=std::vector of length 4, capacity 4 = {...}, fnames=std::vector of length 4, capacity 4 = {...},
values=std::vector of length 4, capacity 4 = {...}) at /home/georg/Dokumente/Entwicklung/misc/Comp/src/base/entity-mgr.cpp:201
201 char* err;
(gdb) print sql
$1 = "INSERT INTO myStructType (id, val1, val2, number, name) values ('100', '3.3", '9' <repeats 15 times>, "', '5.5", '9' <repeats 14 times>, "6', '42', 'Georg')"
I got
print sql
$1 = "INSERT INTO myStructType (id, val1, val2, number, name) values ('100', '3.3", '9' <repeats 15 times>, "', '5.5", '9' <repeats 14 times>, "6', '42', 'Georg')"
I expected
print sql
$1 = "INSERT INTO myStructType (id, val1, val2, number, name) values ('100', '3.3999999999999999', '5.5999999999999996', '42', 'Georg')"
it's a fixed size buffer, so gdb prints out the whole thing. if you cast it to a pointer w/out a size, it displays as you expect: (gdb) print (char *)buffer $4 = 0x7fffffffcb10 "5.40000000" there might be some option controlling this behavior, but i'd have to read the manual to find out |