public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value.
@ 2014-12-25 9:20 liuyefenglin at gmail dot com
2014-12-25 9:32 ` [Bug gdb/17756] " liuyefenglin at gmail dot com
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: liuyefenglin at gmail dot com @ 2014-12-25 9:20 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
Bug ID: 17756
Summary: gdb find command returns bogus results and can't find
the matched value.
Product: gdb
Version: 6.8
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: liuyefenglin at gmail dot com
Version info:
GNU gdb (Wind River Linux Sourcery G++ 4.3a-335) 6.8.50.20080821-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
(gdb) info target
0x08048000 - 0x08048000 is load1
0x080b2000 - 0x080b3000 is load2
0x080b3000 - 0x09c9e000 is load3 //Should be heap region.
(gdb) show mem inaccessible-by-default
Unknown memory addresses will be treated as RAM.
//find command returns bogus results
(gdb) find/w 0x080b3000,0x09c9e000,0x8988b90
0x837f948
1 pattern found.
(gdb) x 0x837f948
0x837f948: 0xb6976c0a
//find command can't find the matched value
(gdb) find/w 0x0837ba00,0x0837bb00,0x8988b90
0x837bac8
1 pattern found.
(gdb) x 0x837bac8
0x837bac8: 0x08988b90
(gdb) find/w 0x08370000,0x0837bb00,0x8988b90
Pattern not found.
It seems that the find command doesn't works well when the search region is
large. This command is very important to debug core dump of memory corruptions.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
@ 2014-12-25 9:32 ` liuyefenglin at gmail dot com
2014-12-27 8:44 ` dje at google dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: liuyefenglin at gmail dot com @ 2014-12-25 9:32 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
Rody Liu <liuyefenglin at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |liuyefenglin at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
2014-12-25 9:32 ` [Bug gdb/17756] " liuyefenglin at gmail dot com
@ 2014-12-27 8:44 ` dje at google dot com
2015-08-07 17:35 ` matt.street at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: dje at google dot com @ 2014-12-27 8:44 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
dje at google dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dje at google dot com
--- Comment #1 from dje at google dot com ---
6.8 is ancient.
It would be good to first verify the problem still exists in current gdb.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
2014-12-25 9:32 ` [Bug gdb/17756] " liuyefenglin at gmail dot com
2014-12-27 8:44 ` dje at google dot com
@ 2015-08-07 17:35 ` matt.street at gmail dot com
2015-08-07 17:57 ` palves at redhat dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: matt.street at gmail dot com @ 2015-08-07 17:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
Matthew Street <matt.street at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matt.street at gmail dot com
--- Comment #2 from Matthew Street <matt.street at gmail dot com> ---
I just confirmed this with 7.9 from Ubuntu Precise 32. I also have confirmed it
with 7.4 installed on my mac with homebrew.
Short example, I can give my data if need be:
(gdb) info proc mapping
-snip-
0xbffdf000 0xc0000000 0x21000 0x0 [stack]
find.gdb:
break test
run
find /b 0xbffdf000, 0xc0000000, 0x00
$> gdb -x find.gdb ./a.out > find.log
warning: Unable to access target memory at 0xbfffc181, halting search
But 0xbfffc181 is accessible:
(gdb) x /b 0xbfffc181
0xbfffc181: 0
And a smaller search range works fine:
(gdb) find /b 0xbfffc181, 0xbfffc191, 0x00
0xbfffc181
0xbfffc182
0xbfffc183
0xbfffc184
0xbfffc185
0xbfffc186
0xbfffc187
0xbfffc188
0xbfffc189
0xbfffc18a
0xbfffc18b
0xbfffc18c
0xbfffc18d
0xbfffc18e
0xbfffc18f
0xbfffc190
0xbfffc191
17 patterns found.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
` (2 preceding siblings ...)
2015-08-07 17:35 ` matt.street at gmail dot com
@ 2015-08-07 17:57 ` palves at redhat dot com
2020-07-23 17:33 ` tromey at sourceware dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: palves at redhat dot com @ 2015-08-07 17:57 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
Pedro Alves <palves at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |palves at redhat dot com
--- Comment #3 from Pedro Alves <palves at redhat dot com> ---
Looks like an off-by-one -- GDB requests one byte-too-much?
(gdb) info proc mappings
process 8283
Mapped address spaces:
0x7ffffffdd000 0x7ffffffff000 0x22000 0x0 [stack]
(gdb) find /b 0x7ffffffdd000, 0x7ffffffff000, 0xa5
warning: Unable to access 11265 bytes of target memory at 0x7fffffffc400,
halting search.
Pattern not found.
(gdb) p /x 0x7fffffffc400 + 11265
$1 = 0x7ffffffff001
(gdb)
The problem is probably in gdb/target.c:simple_search_memory.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
` (3 preceding siblings ...)
2015-08-07 17:57 ` palves at redhat dot com
@ 2020-07-23 17:33 ` tromey at sourceware dot org
2020-07-23 19:00 ` tromey at sourceware dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2020-07-23 17:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
Bug 11158 also is about find returning incorrect results.
I wonder if there's an easy way to reproduce this.
At least at first glance, find.exp seems pretty complete.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
` (4 preceding siblings ...)
2020-07-23 17:33 ` tromey at sourceware dot org
@ 2020-07-23 19:00 ` tromey at sourceware dot org
2020-07-23 19:07 ` tromey at sourceware dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2020-07-23 19:00 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Pedro Alves from comment #3)
> Looks like an off-by-one -- GDB requests one byte-too-much?
I think it's just findcmd.c:
search_space_len = end_addr - start_addr + 1;
0x7ffffffff000 - 0x7ffffffdd000 + 1 == 0x22001
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
` (5 preceding siblings ...)
2020-07-23 19:00 ` tromey at sourceware dot org
@ 2020-07-23 19:07 ` tromey at sourceware dot org
2020-07-23 19:35 ` tromey at sourceware dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2020-07-23 19:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Pedro Alves from comment #3)
Off by one makes my head hurt.
> Mapped address spaces:
>
> 0x7ffffffdd000 0x7ffffffff000 0x22000 0x0 [stack]
I think this range is exclusive on the high end?
That is 0x7ffffffff000 is not included.
> (gdb) find /b 0x7ffffffdd000, 0x7ffffffff000, 0xa5
However "find" is inclusive on the high end.
Probably a bad choice (IMO) but on the other hand,
maybe more confusing to change it at this point.
So, I don't think there's a bug here.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
` (6 preceding siblings ...)
2020-07-23 19:07 ` tromey at sourceware dot org
@ 2020-07-23 19:35 ` tromey at sourceware dot org
2020-10-07 18:13 ` cvs-commit at gcc dot gnu.org
2020-10-07 18:23 ` tromey at sourceware dot org
9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2020-07-23 19:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Rody Liu from comment #0)
> (gdb) info target
> 0x08048000 - 0x08048000 is load1
> 0x080b2000 - 0x080b3000 is load2
> 0x080b3000 - 0x09c9e000 is load3 //Should be heap region.
> (gdb) show mem inaccessible-by-default
> Unknown memory addresses will be treated as RAM.
>
>
> //find command returns bogus results
> (gdb) find/w 0x080b3000,0x09c9e000,0x8988b90
> 0x837f948
This one could well be something weird about the target, I guess.
Without more information though it is hard to know.
> //find command can't find the matched value
> (gdb) find/w 0x0837ba00,0x0837bb00,0x8988b90
> 0x837bac8
> 1 pattern found.
> (gdb) x 0x837bac8
> 0x837bac8: 0x08988b90
> (gdb) find/w 0x08370000,0x0837bb00,0x8988b90
> Pattern not found.
I duplicated this as a unit test and couldn't reproduce
the failure.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
` (7 preceding siblings ...)
2020-07-23 19:35 ` tromey at sourceware dot org
@ 2020-10-07 18:13 ` cvs-commit at gcc dot gnu.org
2020-10-07 18:23 ` tromey at sourceware dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-07 18:13 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
--- Comment #8 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=485c47e523571c1053ec4cf04d4a6b2adb7b350f
commit 485c47e523571c1053ec4cf04d4a6b2adb7b350f
Author: Tom Tromey <tromey@adacore.com>
Date: Wed Oct 7 12:07:55 2020 -0600
Add simple_search_memory unit tests
This adds some unit tests for simple_search_memory. I tried here to
reproduce some bugs (PR gdb/11158 and PR gdb/17756), but was unable
to.
gdb/ChangeLog
2020-10-07 Tom Tromey <tromey@adacore.com>
* unittests/search-memory-selftests.c: New file.
* Makefile.in (SELFTESTS_SRCS): Add
unittests/search-memory-selftests.c.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug gdb/17756] gdb find command returns bogus results and can't find the matched value.
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
` (8 preceding siblings ...)
2020-10-07 18:13 ` cvs-commit at gcc dot gnu.org
@ 2020-10-07 18:23 ` tromey at sourceware dot org
9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2020-10-07 18:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17756
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #9 from Tom Tromey <tromey at sourceware dot org> ---
Couldn't reproduce.
There's a unit-test now, so if it can still be reproduced,
it would be good to modify the test to demonstrate the failure.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-10-07 18:23 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-25 9:20 [Bug gdb/17756] New: gdb find command returns bogus results and can't find the matched value liuyefenglin at gmail dot com
2014-12-25 9:32 ` [Bug gdb/17756] " liuyefenglin at gmail dot com
2014-12-27 8:44 ` dje at google dot com
2015-08-07 17:35 ` matt.street at gmail dot com
2015-08-07 17:57 ` palves at redhat dot com
2020-07-23 17:33 ` tromey at sourceware dot org
2020-07-23 19:00 ` tromey at sourceware dot org
2020-07-23 19:07 ` tromey at sourceware dot org
2020-07-23 19:35 ` tromey at sourceware dot org
2020-10-07 18:13 ` cvs-commit at gcc dot gnu.org
2020-10-07 18:23 ` tromey at sourceware dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).