Browse Source

Nice debugger.

cl-refactor
Gav Wood 11 years ago
parent
commit
8dc4ae87d3
  1. 68
      alethzero/Main.ui
  2. 43
      alethzero/MainWin.cpp
  3. 2
      alethzero/MainWin.h

68
alethzero/Main.ui

@ -130,9 +130,7 @@
<property name="title">
<string>Deb&amp;ug</string>
</property>
<addaction name="enableDebug"/>
<addaction name="debugStep"/>
<addaction name="debugContinue"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Network"/>
@ -502,19 +500,6 @@
<item row="3" column="3">
<widget class="QComboBox" name="gasPriceUnits"/>
</item>
<item row="6" column="0" colspan="3">
<widget class="QLabel" name="total">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="gasPrice">
<property name="prefix">
@ -541,13 +526,6 @@
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="send">
<property name="text">
<string>&amp;Execute</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QSpinBox" name="value">
<property name="suffix">
@ -599,6 +577,33 @@
</item>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="send">
<property name="text">
<string>&amp;Execute</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="total">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="debug">
<property name="text">
<string>De&amp;bug</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -966,14 +971,6 @@
<string>&amp;Preview</string>
</property>
</action>
<action name="enableDebug">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Debug EVM Execution</string>
</property>
</action>
<action name="debugStep">
<property name="enabled">
<bool>false</bool>
@ -985,17 +982,6 @@
<string>F10</string>
</property>
</action>
<action name="debugContinue">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Continue</string>
</property>
<property name="shortcut">
<string>F5</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

43
alethzero/MainWin.cpp

@ -1000,6 +1000,7 @@ void Main::on_mine_triggered()
void Main::on_send_clicked()
{
debugFinished();
u256 totalReq = value() + fee();
m_client->lock();
for (auto i: m_myKeys)
@ -1007,8 +1008,27 @@ void Main::on_send_clicked()
{
m_client->unlock();
Secret s = i.secret();
if (ui->enableDebug->isChecked())
if (isCreation())
m_client->transact(s, value(), m_data, m_init, ui->gas->value(), gasPrice());
else
m_client->transact(s, value(), fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice());
refresh();
return;
}
m_client->unlock();
statusBar()->showMessage("Couldn't make transaction: no single account contains at least the required amount.");
}
void Main::on_debug_clicked()
{
debugFinished();
u256 totalReq = value() + fee();
m_client->lock();
for (auto i: m_myKeys)
if (m_client->state().balance(i.address()) >= totalReq)
{
m_client->unlock();
Secret s = i.secret();
m_client->lock();
m_executiveState = state();
m_client->unlock();
@ -1044,15 +1064,6 @@ void Main::on_send_clicked()
initDebugger();
m_currentExecution.reset();
updateDebugger();
}
else
{
if (isCreation())
m_client->transact(s, value(), m_data, m_init, ui->gas->value(), gasPrice());
else
m_client->transact(s, value(), fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice());
refresh();
}
return;
}
m_client->unlock();
@ -1065,14 +1076,6 @@ void Main::on_create_triggered()
m_keysChanged = true;
}
void Main::on_enableDebug_triggered()
{
ui->debugPanel->setEnabled(ui->enableDebug->isChecked());
ui->send->setText(ui->enableDebug->isChecked() ? "D&ebug" : "&Execute");
if (!ui->enableDebug->isChecked())
debugFinished();
}
void Main::on_debugStep_triggered()
{
ui->debugTimeline->setValue(ui->debugTimeline->value() + 1);
@ -1088,18 +1091,14 @@ void Main::debugFinished()
ui->debugStorage->setHtml("");
ui->debugStateInfo->setText("");
ui->send->setEnabled(true);
ui->enableDebug->setEnabled(true);
ui->debugStep->setEnabled(false);
ui->debugContinue->setEnabled(false);
ui->debugPanel->setEnabled(false);
}
void Main::initDebugger()
{
ui->send->setEnabled(false);
ui->enableDebug->setEnabled(false);
ui->debugStep->setEnabled(true);
ui->debugContinue->setEnabled(true);
ui->debugPanel->setEnabled(true);
ui->debugCode->setEnabled(false);
ui->debugTimeline->setMinimum(0);

2
alethzero/MainWin.h

@ -298,7 +298,7 @@ private slots:
void on_quit_triggered() { close(); }
void on_urlEdit_editingFinished();
void on_debugStep_triggered();
void on_enableDebug_triggered();
void on_debug_clicked();
void on_debugTimeline_valueChanged();
void refresh(bool _override = false);

Loading…
Cancel
Save