/** * toggle a breakpoint * * \param sview * The source view * * \param t * The action to take * * \return * 0 on success, -1 on error. */ static int toggle_breakpoint(struct sviewer *sview, enum tgdb_breakpoint_action t) { char *path; int line; tgdb_request_ptr request_ptr; if (!sview || !sview->cur || !sview->cur->path) return 0; line = sview->cur->sel_line; /* Get filename (strip path off -- GDB is dumb) */ path = strrchr(sview->cur->path, '/') + 1; if (path == NULL + 1) path = sview->cur->path; /* delete an existing breakpoint */ if (sview->cur->buf.breakpts[line]) t = TGDB_BREAKPOINT_DELETE; request_ptr = tgdb_request_modify_breakpoint(tgdb, path, line + 1, t); if (!request_ptr) return -1; handle_request(tgdb, request_ptr); return 0; }
/** * toggle a breakpoint * * \param sview * The source view * * \param t * The action to take * * \return * 0 on success, -1 on error. */ static int toggle_breakpoint(struct sviewer *sview, enum tgdb_breakpoint_action t) { int line; uint64_t addr = 0; char *path = NULL; if (!sview || !sview->cur || !sview->cur->path) return -1; line = sview->cur->sel_line; if (sview->cur->path[0] == '*') { addr = sview->cur->file_buf.addrs[line]; if (!addr) return -1; } else { /* Get filename (strip path off -- GDB is dumb) */ path = strrchr(sview->cur->path, '/') + 1; if (path == (char *)NULL + 1) path = sview->cur->path; } /* delete an existing breakpoint */ if (sview->cur->lflags[line].breakpt) t = TGDB_BREAKPOINT_DELETE; tgdb_request_modify_breakpoint(tgdb, path, line + 1, addr, t); return 0; }