Two more problems:

4 views
Skip to first unread message

wm

unread,
Feb 23, 2008, 5:39:48 PM2/23/08
to zerobugs
(I'm debugging D program, not sure if the problem is the for C++
programs).

Two more problems:

1) On GUI, seg-fault line number is off by 1: when the debuggee seg
faults, the debugger arrow actually indicate the 'next' line of code
that will be executed, but not the current line, e.g.

example 1:

void doSomething() {
a1 = foo; // seg fault is on this line
a2 = bar; // <== but arrow is here
}

when navigate through the stack trace, the arrows in all the stack
frame is off-by-1. Especially:

example 2: in a loop, it is more confusing:

for (i = 0; i < n; i++) { // <== but arrow is on this line.
elt = getNext(i);
elt.doSomething(); // seg fault inside this function
}


2) On GUI, provide an easy way to set breakpoint in the fashion of
"source.d:1234".

on the command-line interface, one can set break point by specify
soure and line number: 'break source.d:1234'; on the GUI, F9 only
allows you to "Enter function name or address". I tried to enter
'source.d:1234', it doesn't work. I think this can be fixed.

Also I noticed when click on a line in the source code window, the
line number will become bold. I would suggest to add a right-click
context menu: to enable user to set breakpoint on that particular
line; other menu items can also be added like: "edit the condition of
that bp".

Thanks!

cristiv

unread,
Feb 24, 2008, 2:09:13 PM2/24/08
to zerobugs
Hi,

1) This behavior is the direct result of the fact that addresses saved
on the stack are the code locations where execution will continue upon
returning from the current function call.

Thus, the debugger will show the next line to be executed. The
debugger does a binary search internally and finds the nearest line
corresponding to the return address on the stack.

If instead you want to see the line immediately _before_ the current
address you may try setting
the environmental variable ZERO_LINE_NEAREST_MATCH to "false" or "0".
Let me know how that worked out for you.

2) In fact, the right-click contextual menu does allow you to set a
breakpoint at the current line.

I think that it is a good idea to add a menu item for editing the
breakpoint. I will look into your other suggestion as well, at a first
glance it seems a simple change, but I need to look at my notes and
see whether there was a particular reason for not implementing the
"source:line" feature.

Regards,
Cristian

wm

unread,
Feb 24, 2008, 5:31:58 PM2/24/08
to zerobugs
> the environmental variable ZERO_LINE_NEAREST_MATCH to "false" or "0".
> Let me know how that worked out for you.

Sometimes it's still off by 1 (pointing to the next line).

I think let it point to the "current line" by default is more natural.

> 2) In fact, the right-click contextual menu does allow you to set a
> breakpoint at the current line.

I see, it works when click on the code; what I have tried is to click
on the line number itself.
Maybe you can bring up the contextual menu there also.

Reply all
Reply to author
Forward
0 new messages