Break on line number
After hacking the compiler quite a bit, let's take a break. We can now implement setting a breakpoint on line number. This should be a simple task, simply setting a breakpoint on address found by the line number!
Interface
class debugger
{
public:
breakpoint* create_source_location_breakpoint(int line, int column);
};
Interface explained
Set a breakpoint on or after the given source location.
Implementation
This one is intended to be a simple exercise, just find it from the statements and set an address breakpoint there.
Practice notes
Some debuggers allow you to specify the column number when setting breakpoint, some don't. Always stopping at the beginning of the line can be annoying sometimes. It is really a trade off between user interface simplicity and functionality.
Similarly, some symbols just doesn't have the full source location information, they only have source line, not column, or they don't have the ends, that's how things happen in practice.