+
+ breakpoints.clear();
+ for(ToolList::iterator i=tools.begin(); i!=tools.end(); ++i)
+ (*i)->process_started();
+}
+
+void GlDbg::send(GlPacket *pkt)
+{
+ packet_send(pkt, sock_fd);
+}
+
+void GlDbg::hold()
+{
+ GlPacket *pkt = packet_begin(FUNC_GLDHOLD);
+ send(pkt);
+}
+
+void GlDbg::set_breakpoint(unsigned short func, unsigned char flag, Tool *owner)
+{
+ Breakpoint *bp = (func ? get_breakpoint(func, flag) : 0);
+ if(bp)
+ bp->add_owner(owner);
+ else
+ {
+ if(func)
+ {
+ breakpoints.push_back(Breakpoint(func, flag));
+ breakpoints.back().add_owner(owner);
+ }
+
+ GlPacket *pkt = packet_begin(FUNC_GLDBREAK);
+ packet_write_short(pkt, func);
+ packet_write_char(pkt, flag);
+ packet_write_char(pkt, 0);
+ send(pkt);
+ }
+}
+
+void GlDbg::clear_breakpoint(unsigned short func, unsigned char flag, Tool *owner)
+{
+ Breakpoint *bp = get_breakpoint(func, flag);
+ if(bp)
+ {
+ bp->remove_owner(owner);
+ if(bp->owners.empty())
+ {
+ if(current_break==bp)
+ current_break = 0;
+
+ // XXX Inefficient. Should get_breakpoint() return an iterator?
+ for(BreakList::iterator i=breakpoints.begin(); i!=breakpoints.end(); ++i)
+ if(i->function==func && i->flag==flag)
+ {
+ breakpoints.erase(i);
+ break;
+ }
+
+ GlPacket *pkt = packet_begin(FUNC_GLDBREAK);
+ packet_write_short(pkt, func);
+ packet_write_char(pkt, 0);
+ packet_write_char(pkt, flag);
+ send(pkt);
+ }
+ }