<div dir="ltr"><div class="">PS: Reported on bug tracker: <a href="https://bugs.kde.org/show_bug.cgi?id=384368">https://bugs.kde.org/show_bug.cgi?id=384368</a></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 4, 2017 at 5:55 PM Aetf <<a href="mailto:7437103@gmail.com">7437103@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I can see a few issues here.</div><div><br></div><div>1. BreakpointModel gets updated when user creating watch points directly using command. The location reported by GDB includes the "-location " part, but since we are quoting the entire string, GDB interprets the entire string as an option, rather than only the "-location" part.</div><div>2. Even though we recognize the location and only quote remaining expression, GDB/MI which is the protocol we use to communicate with GDB actually doesn't support "-l/-location" option. see [1]</div><div><span style="color:rgb(33,33,33)">3. When starts new session, KDevelop tries to automatically reapply all break/watch points saved in BreakpointModel. But the command fails due to above reason. </span><span style="color:rgb(33,33,33)">However there shouldn't be an endless loop. Once the command fails, it should set the error message in the Breakpoint toolview and continue. But maybe I'm just missing something.</span></div><div><span style="color:rgb(33,33,33)"><br></span></div><div><span style="color:rgb(33,33,33)">The fix would be</span></div><div><span style="color:rgb(33,33,33)">1. In mibreakpointcontroller.cpp:358, detect and quote only the expression part, this is easy.</span></div><div><span style="color:rgb(33,33,33)">2. Find a way to emulate the "-location" option. Possible solutions:</span></div><div><span style="color:rgb(33,33,33)">    2.1 Take the address of the expression when watch point got set and save that in BreakpointModel. But addresses are likely to change between runs</span></div><div><span style="color:rgb(33,33,33)">    2.2 Simply remove "-location" part and set it as a normal watch point. But likely at the very begining of the program, the expression is out of scope.</span></div><div><span style="color:rgb(33,33,33)">    2.3 Skip it. IMHO even normal watchpoints should be skipped. As they rely on expressions that are hardly valid at this time.</span></div><div><span style="color:rgb(33,33,33)">3. Desired behavior should be display the error in Breakpoint toolview, rather than entering an endless loop. However I didn't find which part of the code is causing the loop after a quick of the codebase. And the desired behavior is already implemented. This will need more investigate.</span></div><div><br></div><div>[1] <a href="https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Breakpoint-Commands.html#GDB_002fMI-Breakpoint-Commands" target="_blank">https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Breakpoint-Commands.html#GDB_002fMI-Breakpoint-Commands</a></div><div><br></div></div>Cheers,<div>Aetf</div><div><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 4, 2017 at 7:48 AM Aleix Pol <<a href="mailto:aleixpol@kde.org" target="_blank">aleixpol@kde.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Sep 1, 2017 at 6:32 PM, Aetf <<a href="mailto:7437103@gmail.com" target="_blank">7437103@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I'm afraid I don't have much time for this at the moment. Actually this has<br>
> been on my todo list for a while... I'll take a look at it soon.<br>
><br>
> Cheers,<br>
> Aetf<br>
><br>
> On Fri, Sep 1, 2017 at 7:55 AM Aleix Pol <<a href="mailto:aleixpol@kde.org" target="_blank">aleixpol@kde.org</a>> wrote:<br>
>><br>
>> On Mon, Aug 21, 2017 at 1:54 PM, Aleksey Midenkov <<a href="mailto:midenok@gmail.com" target="_blank">midenok@gmail.com</a>><br>
>> wrote:<br>
>> > I've set watchpoint with command `watch -l` and it was saved in<br>
>> > KDevelop session. Now it doesn't start debug session because it ends<br>
>> > up in endless loop:<br>
>> ><br>
>> > (gdb) 2106-break-watch "-location m_part_spec.start_part"<br>
>> > 2106^error,msg="-break-watch: Unknown option ``location<br>
>> > m_part_spec.start_part''"<br>
>> > (gdb) 2107-break-watch "-location m_part_spec.start_part"<br>
>> > 2107^error,msg="-break-watch: Unknown option ``location<br>
>> > m_part_spec.start_part''"<br>
>> > (gdb) 2108-break-watch "-location m_part_spec.start_part"<br>
>> > 2108^error,msg="-break-watch: Unknown option ``location<br>
>> > m_part_spec.start_part''"<br>
>> > (gdb) 2109-break-watch "-location m_part_spec.start_part"<br>
>> > 2109^error,msg="-break-watch: Unknown option ``location<br>
>> > m_part_spec.start_part''"<br>
>> > (gdb) 2110-break-watch "-location m_part_spec.start_part"<br>
>> > 2110^error,msg="-break-watch: Unknown option ``location<br>
>> > m_part_spec.start_part''"<br>
>> > ...<br>
>> ><br>
>> > Though I've managed to delete breakpoint from Breakpoints tab and start<br>
>> > again.<br>
>><br>
>> Hey Aetf,<br>
>> Any idea why that could be?<br>
>><br>
>> Aleix<br>
>><br>
>> PS: Aleksey, can you make sure this is reported in <a href="http://bugs.kde.org" rel="noreferrer" target="_blank">bugs.kde.org</a>?<br>
<br>
Hi Aetf,<br>
Maybe you can give us some pointers in case someone else can/wants to fix it?<br>
<br>
Aleix<br>
</blockquote></div></div></blockquote></div></div>