DDD bug regarding temporary breakpoints

Matheus Ribeiro <[email protected]> Wed, 27 Apr 2011 13:45:15 -0300
Newsgroups gmane.comp.debugging.ddd.bugs
Message-ID <[email protected]>
--===============8950961361017391661==
Content-Type: multipart/alternative; boundary=000e0cd257de42ed3804a1e92ad8

--000e0cd257de42ed3804a1e92ad8
Content-Type: text/plain; charset=ISO-8859-1

There is a bug in DDD when setting temporary breakpoints (which is also used
by other commands, like set execution point). The answer received from GDB
is something like

Breakpoint X at ADDRESS: file FILENAME, line LINE. << for breakpoints
Temporary breakpoint X at ADDRESS: file FILENAME, line LINE. << for tbreaks

In PosBuffer.C, there is a function which parses gdb answers and acquires
information from it: gdb_filter. This function tries several cases, one of
them is the UP and DOWN command outputs, with this if statement:

        int at_index = answer.index(" at ");
        int br_index = answer.index("Break");
        if ( (at_index > 0) && (br_index < 0) )

As can be see, it looks for an "at" string at sentence not started by Break.
But his comparison is bugged for temporary breakpoints, the correct code is:

        int at_index = answer.index(" at ");
        int br_index = answer.index("Break");
        int tbr_index = answer.index("Temporary break");
        if ( (at_index > 0) && (br_index < 0) && (tbr_index < 0) )

This will avoid many weird messages like: cannot find file
/usr/local/src/0x12345 for example. Also it will avoid many unecessary info
sources by ddd trying to find this weird file. If anyone wants a patch, let
me know.

Thanks
Matheus

--000e0cd257de42ed3804a1e92ad8
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

There is a bug in DDD when setting temporary breakpoints (which is also use=
d by other commands, like set execution point). The answer received from GD=
B is something like=A0<div><br></div><div><meta http-equiv=3D"content-type"=
 content=3D"text/html; charset=3Dutf-8">Breakpoint X at ADDRESS: file FILEN=
AME, line LINE. &lt;&lt; for breakpoints</div>
<div>Temporary breakpoint X at ADDRESS: file FILENAME, line LINE. &lt;&lt; =
for tbreaks</div><div><br></div><div>In PosBuffer.C, there is a function wh=
ich parses gdb answers and acquires information from it: gdb_filter. This f=
unction tries several cases, one of them is the UP and DOWN command outputs=
, with this if statement:</div>
<div><br></div><div><div>=A0 =A0 =A0 =A0 int at_index =3D answer.index(&quo=
t; at &quot;);</div><div>=A0 =A0 =A0 =A0 int br_index =3D answer.index(&quo=
t;Break&quot;);</div><div>=A0 =A0 =A0 =A0 if ( (at_index &gt; 0) &amp;&amp;=
 (br_index &lt; 0) )</div>
</div><div><br></div><div>As can be see, it looks for an &quot;at&quot; str=
ing at sentence not started by Break. But his comparison is bugged for temp=
orary breakpoints, the correct code is:</div><div><br></div><div><div>=A0 =
=A0 =A0 =A0 int at_index =3D answer.index(&quot; at &quot;);</div>
<div>=A0 =A0 =A0 =A0 int br_index =3D answer.index(&quot;Break&quot;);</div=
><div>=A0 =A0 =A0 =A0 int tbr_index =3D answer.index(&quot;Temporary break&=
quot;);</div><div>=A0 =A0 =A0 =A0 if ( (at_index &gt; 0) &amp;&amp; (br_ind=
ex &lt; 0) &amp;&amp; (tbr_index &lt; 0) )</div>
</div><div><br></div><div>This will avoid many weird messages like: cannot =
find file /usr/local/src/0x12345 for example. Also it will avoid many unece=
ssary info sources by ddd trying to find this weird file. If anyone wants a=
 patch, let me know.</div>
<div><br></div><div>Thanks</div><div>Matheus</div><div><br></div>

--000e0cd257de42ed3804a1e92ad8--


--===============8950961361017391661==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
bug-ddd mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-ddd

--===============8950961361017391661==--