🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1090

find command fix

#1090
From: Balogh, Ray
Date: Thu, 07 Jun 2012 22:07
193 lines
9894 bytes
--_000_55E352C95790B84FA0ACDB59FE48F13F75F12385chsys232sycamor_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi all,

I'm using an older version of a cross-platform GDB build (7.0.1 based).  Ha=
ving to use the "find" command a lot, as I do, is a pain because it seem to=
 always have been broken and never fixed (?).  The problem is that "find" s=
ometimes works, but often returns bogus matches.  I came across an old dorm=
ant problem report, Bugzilla - Bug 11158 "find command returns bogus result=
s", but I've never seen any fixes for this.

So I took it upon myself to fix this, and after looking at the source code,=
 doing some debugging, and identifying multiple issues, I came to the concl=
usion that it's best to rewrite the function simple_search_memory() in gdb/=
target.c.  I did that and I believe it's now works properly.

I did look at the latest version, 7.4, and there is one minor change in tha=
t function which looks to be an attempt at a fix. I didn't try this out, bu=
t I have my doubts that this is a correct fix, nor does it address other is=
sues I noticed in the function.

Anyone interested in the getting my update?  I'd be happy to forward it.

BTW, I also would like to enhance "find" so that it doesn't just stop when =
it encounters an invalid region of memory, but skips past it (with a warnin=
g) if there is valid memory at a higher address within the specified range.=
  This would be really useful for scanning all of the heap memory in a proc=
ess, which is often disjoint with numerous gaps in between memory segments.=
  The current need to repeat the "find" many times with different ranges is=
 very awkward.  Any thoughts on this?

Best regards,
Ray

--_000_55E352C95790B84FA0ACDB59FE48F13F75F12385chsys232sycamor_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Helvetica;
	panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
	{font-family:Batang;
	panose-1:2 3 6 0 0 1 1 1 1 1;}
@font-face
	{font-family:"\@Batang";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in .5in 1.0in .5in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>Hi all,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>I&#8217;m using an older version of a cross-platform GDB=
 build
(7.0.1 based). &nbsp;Having to use the &#8220;find&#8221; command a lot, as=
 I do, is
a pain because it seem to always have been broken and never fixed (?). &nbs=
p;The
problem is that &#8220;find&#8221; sometimes works, but often returns bogus
matches. &nbsp;I came across an old dormant problem report, Bugzilla &#8211=
;
Bug&nbsp;11158 &#8220;</span></font><font size=3D2 color=3Dblack face=3DHel=
vetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'>find command r=
eturns
bogus results</span>&#8221;, but I&#8217;ve never seen any fixes for this.<=
o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o=
:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'>So I took it u=
pon
myself to fix this, and after looking at the source code, doing some debugg=
ing,
and identifying multiple issues, I came to the conclusion that it&#8217;s b=
est
to rewrite the function simple_search_memory() in gdb/target.c. &nbsp;I did=
 that and
I believe it&#8217;s now works properly.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o=
:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'>I did look at =
the
latest version, 7.4, and there is one minor change in that function which l=
ooks
to be an attempt at a fix. I didn&#8217;t try this out, but I have my doubt=
s that
this is a correct fix, nor does it address other issues I noticed in the
function.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o=
:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'>Anyone interes=
ted in
the getting my update? &nbsp;I&#8217;d be happy to forward it. <o:p></o:p><=
/span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o=
:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'>BTW, I also wo=
uld
like to enhance &#8220;find&#8221; so that it doesn&#8217;t just stop when =
it
encounters an invalid region of memory, but skips past it (with a warning) =
if
there is valid memory at a higher address within the specified range.&nbsp;=
 This
would be really useful for scanning all of the heap memory in a process, wh=
ich
is often disjoint with numerous gaps in between memory segments. &nbsp;The =
current need
to repeat the &#8220;find&#8221; many times with different ranges is very
awkward.&nbsp; Any thoughts on this?<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'><o:p>&nbsp;</o=
:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'>Best regards,<=
o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DHelvetica><span
style=3D'font-size:10.0pt;font-family:Helvetica;color:black'>Ray<o:p></o:p>=
</span></font></p>

</div>

</body>

</html>

--_000_55E352C95790B84FA0ACDB59FE48F13F75F12385chsys232sycamor_--
Technical Details
Message-ID: <mailman.2410.1339106884.855.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!l9ni23085pbj.0!nntp.google.com!news2.google.com!news1.google.com!news.glorb.com!usenet.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f5053,5801db8d256f6b57,start
X-Google-NewGroupId: yes
X-Google-Attributes: gidf0ead4270c,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.68.190.104 with SMTP id gp8mr4084227pbc.4.1339106885077;
        Thu, 07 Jun 2012 15:08:05 -0700 (PDT)
Path: arc1-ca.pugleaf.net!l9ni23085pbj.0!nntp.google.com!news2.google.com!news1.google.com!news.glorb.com!usenet.stanford.edu!not-for-mail
From: "Balogh, Ray" <Ray.Balogh@sycamorenet.com>
Newsgroups: gnu.gdb.bug
Subject: find command fix
Date: Thu, 7 Jun 2012 18:07:53 -0400
Lines: 194
Approved: bug-gdb@gnu.org
Message-ID: <mailman.2410.1339106884.855.bug-gdb@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
X-Trace: usenet.stanford.edu 1339106884 24954 208.118.235.17 (7 Jun 2012 22:08:04 GMT)
X-Complaints-To: action@cs.stanford.edu
To: "bug-gdb@gnu.org" <bug-gdb@gnu.org>
Envelope-to: bug-gdb@gnu.org
X-MXL-Hash: 4fd1263c5f0bdeeb-9fc1a8c449a59fb5495de007a498e862aa37b1b0
Thread-Topic: find command fix
Thread-Index: Ac1E+fwSAYM14V5DR+up+0F/cH0rCg==
Accept-Language: en-US
acceptlanguage: en-US
X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2010122901)]
X-MAIL-FROM: <ray.balogh@sycamorenet.com>
X-SOURCE-IP: [208.25.111.155]
X-AnalysisOut: [v=2.0 cv=LvQlPAhc c=1 sm=0 a=EcvxM2a+1x4cPqO+RoA41g==:17 a]
X-AnalysisOut: [=Ss0NDO9ifBYA:10 a=BLceEmwcHowA:10 a=SYEJgJscAAAA:8 a=Fl2T]
X-AnalysisOut: [EvA_y7VyLvR4OQwA:9 a=CjuIK1q_8ugA:10 a=iMZFJ8JekU3nUEGd:21]
X-AnalysisOut: [ a=UrZDB3wLhAZhFHM4:21 a=SSmOFEACAAAA:8 a=3-L_DYz5iNMywt2e]
X-AnalysisOut: [35IA:9 a=gKO2Hq4RSVkA:10 a=UiCQ7L4-1S4A:10 a=hTZeC7Yk6K0A:]
X-AnalysisOut: [10]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.65.144.78
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>
Content-Type: multipart/alternative;
 boundary="_000_55E352C95790B84FA0ACDB59FE48F13F75F12385chsys232sycamor_"
Content-Language: en-US