| 559 | } |
| 560 | |
| 561 | void BreakpointModel::loadBreakpointFromFieldList(QStringList fields) |
| 562 | { |
| 563 | std::string error; |
| 564 | |
| 565 | bool ok; |
| 566 | if (fields.size() != BreakpointColumns::COLUMN_COUNT) |
| 567 | { |
| 568 | Console.WriteLn("Debugger Breakpoint Model: Invalid number of columns, skipping"); |
| 569 | return; |
| 570 | } |
| 571 | |
| 572 | const int type = fields[BreakpointColumns::TYPE].toUInt(&ok); |
| 573 | if (!ok) |
| 574 | { |
| 575 | Console.WriteLn("Debugger Breakpoint Model: Failed to parse type '%s', skipping", |
| 576 | fields[BreakpointColumns::TYPE].toUtf8().constData()); |
| 577 | return; |
| 578 | } |
| 579 | |
| 580 | // This is how we differentiate between breakpoints and memchecks |
| 581 | if (type == MEMCHECK_INVALID) |
| 582 | { |
| 583 | BreakPoint bp; |
| 584 | |
| 585 | // Address |
| 586 | bp.addr = fields[BreakpointColumns::OFFSET].toUInt(&ok, 16); |
| 587 | if (!ok) |
| 588 | { |
| 589 | Console.WriteLn("Debugger Breakpoint Model: Failed to parse address '%s', skipping", |
| 590 | fields[BreakpointColumns::OFFSET].toUtf8().constData()); |
| 591 | return; |
| 592 | } |
| 593 | |
| 594 | // Condition |
| 595 | if (!fields[BreakpointColumns::CONDITION].isEmpty()) |
| 596 | { |
| 597 | PostfixExpression expr; |
| 598 | bp.hasCond = true; |
| 599 | bp.cond.debug = &m_cpu; |
| 600 | |
| 601 | if (!m_cpu.initExpression(fields[BreakpointColumns::CONDITION].toUtf8().constData(), expr, error)) |
| 602 | { |
| 603 | Console.WriteLn("Debugger Breakpoint Model: Failed to parse cond '%s', skipping", |
| 604 | fields[BreakpointModel::CONDITION].toUtf8().constData()); |
| 605 | return; |
| 606 | } |
| 607 | bp.cond.expression = expr; |
| 608 | bp.cond.expressionString = fields[BreakpointColumns::CONDITION].toStdString(); |
| 609 | } |
| 610 | |
| 611 | // Enabled |
| 612 | bp.enabled = fields[BreakpointColumns::ENABLED].toUInt(&ok); |
| 613 | if (!ok) |
| 614 | { |
| 615 | Console.WriteLn("Debugger Breakpoint Model: Failed to parse enable flag '%s', skipping", |
| 616 | fields[BreakpointColumns::ENABLED].toUtf8().constData()); |
| 617 | return; |
| 618 | } |
no test coverage detected