1
0
Fork 0

Merge branch 'master' into patches

Conflicts:
	x64_dbg_gui/Project/Src/Gui/CPUDisassembly.cpp
	x64_dbg_gui/Project/Src/Gui/CPUDisassembly.h
	x64_dbg_gui/Project/Src/Gui/CPUDump.cpp
	x64_dbg_gui/Project/Src/Gui/CPUStack.cpp
	x64_dbg_gui/Project/Src/Gui/CPUStack.h
This commit is contained in:
Mr. eXoDia 2014-07-06 15:33:32 +02:00
commit 8abdc33bb4
13 changed files with 144 additions and 32 deletions

41
LICENSE
View File

@ -151,7 +151,16 @@ Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
2. Treatment of plugins
This license does not affect plugins, i.e., dynamically linked
libraries, that use the provided plugin interface mechanism of x64_dbg
for contibuting additional features to the x64_dbg project and can only
be run from x64dbg. In fact you are allowed to create and share
(non-)commercial, non-standalone closed-source plugins for x64dbg without
distributing the source of the specific plugin.
3. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
@ -176,7 +185,7 @@ your copyrighted material outside their relationship with you.
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
4. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
@ -192,7 +201,7 @@ modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
5. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
@ -205,7 +214,7 @@ recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
6. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
@ -242,7 +251,7 @@ beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
7. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
@ -340,7 +349,7 @@ documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
8. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
@ -404,7 +413,7 @@ where to find the applicable terms.
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
9. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
@ -432,7 +441,7 @@ this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
10. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
@ -443,7 +452,7 @@ modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
11. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
@ -468,7 +477,7 @@ rights granted under this License, and you may not initiate litigation
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
12. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
@ -537,7 +546,7 @@ or that patent license was granted, prior to 28 March 2007.
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
13. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
@ -549,7 +558,7 @@ to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
14. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
@ -560,7 +569,7 @@ but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
15. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
@ -586,7 +595,7 @@ permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
16. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
@ -597,7 +606,7 @@ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
17. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
@ -609,7 +618,7 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
18. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,

View File

@ -36,7 +36,7 @@ Releases of *x64_dbg* can be found on [here](http://download.x64dbg.com).
- Memory breakpoints sometimes fail (TitanEngine bug)
## License
*x64_dbg* is licensed under GLPv3, which means you can freely distribute and modify the source of *x64_dbg*, as long as you share your changes with us. The only exception of is that plugins you write do not have to comply with the original GLPv3 license (they do not have to be open-source), except if you directly use code from inside *x64_dbg*. In that case you would still have to share the changes with us.
*x64_dbg* is licensed under GLPv3, which means you can freely distribute and/or modify the source of *x64_dbg*, as long as you share your changes with us. The only exception is that plugins you write do not have to comply with the GLPv3 license. They do not have to be open-source and they can be commercial and/or private. The only exception to this is when your plugin uses code copied from *x64_dbg*. In that case you would still have to share the changes to *x64_dbg* with us.
## Credits
- Debugger core by TitanEngine Community Edition

View File

@ -9,7 +9,7 @@
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>

View File

@ -113,6 +113,9 @@ void BeaTokenizer::StringInstruction(QString mnemonic, BeaInstructionToken* inst
void BeaTokenizer::Mnemonic(BeaInstructionToken* instr, const DISASM* disasm)
{
QString mnemonic=QString(disasm->Instruction.Mnemonic).trimmed().toLower();
bool farMnemonic = mnemonic.contains(" far");
if(farMnemonic)
mnemonic.truncate(mnemonic.indexOf(" far"));
QString completeInstr=QString(disasm->CompleteInstr).trimmed().toLower();
BeaTokenType type=TokenMnemonicNormal;
int brtype=disasm->Instruction.BranchType;
@ -148,6 +151,11 @@ void BeaTokenizer::Mnemonic(BeaInstructionToken* instr, const DISASM* disasm)
return;
}
AddToken(instr, type, mnemonic, 0);
if(farMnemonic)
{
AddToken(instr, TokenSpace, " ", 0);
AddToken(instr, TokenMnemonicFar, "far", 0);
}
}
QString BeaTokenizer::PrintValue(const BeaTokenValue* value, bool module)
@ -269,7 +277,7 @@ void BeaTokenizer::Argument(BeaInstructionToken* instr, const DISASM* disasm, co
}
AddToken(instr, bracketsType, "]", 0);
}
else if(disasm->Instruction.BranchType != 0 && disasm->Instruction.AddrValue) //jump/call
else if(disasm->Instruction.BranchType != 0 && disasm->Instruction.BranchType != RetType) //jump/call
{
BeaTokenValue value;
value.size=arg->ArgSize/8;
@ -423,6 +431,7 @@ void BeaTokenizer::Init()
memSizeNames.insert(8, "byte");
memSizeNames.insert(16, "word");
memSizeNames.insert(32, "dword");
memSizeNames.insert(48, "fword");
memSizeNames.insert(64, "qword");
memSizeNames.insert(80, "tword");
memSizeNames.insert(128, "dqword");
@ -451,6 +460,7 @@ void BeaTokenizer::Init()
AddColorName(TokenMnemonicCondJump, "InstructionConditionalJumpColor", "InstructionConditionalJumpBackgroundColor");
AddColorName(TokenMnemonicUncondJump, "InstructionUnconditionalJumpColor", "InstructionUnconditionalJumpBackgroundColor");
AddColorName(TokenMnemonicNop, "InstructionNopColor", "InstructionNopBackgroundColor");
AddColorName(TokenMnemonicFar, "InstructionFarColor", "InstructionFarBackgroundColor");
//memory
AddColorName(TokenMemorySize, "InstructionMemorySizeColor", "InstructionMemorySizeBackgroundColor");
AddColorName(TokenMemorySegment, "InstructionMemorySegmentColor", "InstructionMemorySegmentBackgroundColor");
@ -507,10 +517,29 @@ void BeaTokenizer::TokenizeInstruction(BeaInstructionToken* instr, const DISASM*
Mnemonic(instr, disasm);
//arguments
bool hadarg=false;
Argument(instr, disasm, &disasm->Argument1, &hadarg);
Argument(instr, disasm, &disasm->Argument2, &hadarg);
Argument(instr, disasm, &disasm->Argument3, &hadarg);
QString mnemonic = QString(disasm->Instruction.Mnemonic).trimmed();
if(mnemonic.contains("far") && !QString(disasm->CompleteInstr).contains("[")) //far jumps / calls (not the memory ones)
{
unsigned int segment=0;
unsigned int address=0;
sscanf(disasm->Argument1.ArgMnemonic, "%X : %X", &segment, &address);
AddToken(instr, TokenSpace, QString(" "), 0);
BeaTokenValue val;
val.size=2;
val.value=segment;
AddToken(instr, TokenValue, PrintValue(&val, true), &val);
AddToken(instr, TokenUncategorized, ":", 0);
val.size=4;
val.value=address;
AddToken(instr, TokenAddress, PrintValue(&val, true), &val);
}
else
{
bool hadarg=false;
Argument(instr, disasm, &disasm->Argument1, &hadarg);
Argument(instr, disasm, &disasm->Argument2, &hadarg);
Argument(instr, disasm, &disasm->Argument3, &hadarg);
}
//remove spaces when needed
bool bArgumentSpaces=ConfigBool("Disassembler", "ArgumentSpaces");

View File

@ -35,6 +35,7 @@ public:
TokenMnemonicCondJump,
TokenMnemonicUncondJump,
TokenMnemonicNop,
TokenMnemonicFar,
//memory
TokenMemorySize,
TokenMemorySegment,

View File

@ -474,6 +474,7 @@ void AppearanceDialog::colorInfoListInit()
colorInfoListAppend("Conditional Jumps", "InstructionConditionalJumpColor", "InstructionConditionalJumpBackgroundColor");
colorInfoListAppend("Unconditional Jumps", "InstructionUnconditionalJumpColor", "InstructionUnconditionalJumpBackgroundColor");
colorInfoListAppend("NOPs", "InstructionNopColor", "InstructionNopBackgroundColor");
colorInfoListAppend("FAR", "InstructionFarColor", "InstructionFarBackgroundColor");
colorInfoListAppend("General Registers", "InstructionGeneralRegisterColor", "InstructionGeneralRegisterBackgroundColor");
colorInfoListAppend("FPU Registers", "InstructionFpuRegisterColor", "InstructionFpuRegisterBackgroundColor");
colorInfoListAppend("SSE Registers", "InstructionSseRegisterColor", "InstructionSseRegisterBackgroundColor");

View File

@ -265,6 +265,11 @@ void CPUDisassembly::setupRightClickContextMenu()
mUndoSelection->setShortcut(QKeySequence("alt+backspace"));
this->addAction(mUndoSelection);
connect(mUndoSelection, SIGNAL(triggered()), this, SLOT(undoSelectionSlot()));
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
// Labels
mSetLabel = new QAction("Label", this);
@ -855,7 +860,7 @@ void CPUDisassembly::binaryEditSlot()
mMemPage->read(data, selStart, newSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, newSize));
mMemPage->write(patched.constData(), selStart, patched.size());
reloadData();
GuiUpdateAllViews();
}
void CPUDisassembly::binaryFillSlot()
@ -875,7 +880,7 @@ void CPUDisassembly::binaryFillSlot()
hexEdit.mHexEdit->fill(0, QString(pattern));
QByteArray patched(hexEdit.mHexEdit->data());
mMemPage->write(patched, selStart, patched.size());
reloadData();
GuiUpdateAllViews();
}
void CPUDisassembly::binaryCopySlot()
@ -904,7 +909,7 @@ void CPUDisassembly::binaryPasteSlot()
if(patched.size() < selSize)
selSize = patched.size();
mMemPage->write(patched.constData(), selStart, selSize);
reloadData();
GuiUpdateAllViews();
}
void CPUDisassembly::undoSelectionSlot()
@ -916,3 +921,20 @@ void CPUDisassembly::undoSelectionSlot()
DbgFunctions()->PatchRestoreRange(start, end);
reloadData();
}
void CPUDisassembly::binaryPasteIgnoreSizeSlot()
{
HexEditDialog hexEdit(this);
int_t selStart = getSelectionStart();
int_t selSize = getSelectionEnd() - selStart + 1;
QClipboard *clipboard = QApplication::clipboard();
hexEdit.mHexEdit->setData(clipboard->text());
byte_t* data = new byte_t[selSize];
mMemPage->read(data, selStart, selSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, selSize));
delete [] data;
mMemPage->write(patched.constData(), selStart, patched.size());
GuiUpdateAllViews();
}

View File

@ -63,6 +63,7 @@ public slots:
void binaryFillSlot();
void binaryCopySlot();
void binaryPasteSlot();
void binaryPasteIgnoreSizeSlot();
void undoSelectionSlot();
private:
@ -80,6 +81,7 @@ private:
QAction* mBinaryFillAction;
QAction* mBinaryCopyAction;
QAction* mBinaryPasteAction;
QAction* mBinaryPasteIgnoreSizeAction;
QAction* mUndoSelection;
QAction* mToggleInt3BpAction;
QAction* mSetHwBpAction;

View File

@ -108,6 +108,11 @@ void CPUDump::setupContextMenu()
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
// Restore Selection
mUndoSelection = new QAction("&Restore selection", this);
mUndoSelection->setShortcutContext(Qt::WidgetShortcut);
@ -1027,7 +1032,7 @@ void CPUDump::binaryEditSlot()
mMemPage->read(data, selStart, newSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, newSize));
mMemPage->write(patched.constData(), selStart, patched.size());
reloadData();
GuiUpdateAllViews();
}
void CPUDump::binaryFillSlot()
@ -1047,7 +1052,7 @@ void CPUDump::binaryFillSlot()
hexEdit.mHexEdit->fill(0, QString(pattern));
QByteArray patched(hexEdit.mHexEdit->data());
mMemPage->write(patched, selStart, patched.size());
reloadData();
GuiUpdateAllViews();
}
void CPUDump::binaryCopySlot()
@ -1076,7 +1081,23 @@ void CPUDump::binaryPasteSlot()
if(patched.size() < selSize)
selSize = patched.size();
mMemPage->write(patched.constData(), selStart, selSize);
reloadData();
GuiUpdateAllViews();
}
void CPUDump::binaryPasteIgnoreSizeSlot()
{
HexEditDialog hexEdit(this);
int_t selStart = getSelectionStart();
int_t selSize = getSelectionEnd() - selStart + 1;
QClipboard *clipboard = QApplication::clipboard();
hexEdit.mHexEdit->setData(clipboard->text());
byte_t* data = new byte_t[selSize];
mMemPage->read(data, selStart, selSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, selSize));
delete [] data;
mMemPage->write(patched.constData(), selStart, patched.size());
GuiUpdateAllViews();
}
void CPUDump::findPattern()

View File

@ -76,6 +76,7 @@ public slots:
void binaryFillSlot();
void binaryCopySlot();
void binaryPasteSlot();
void binaryPasteIgnoreSizeSlot();
void findPattern();
void undoSelectionSlot();
@ -152,6 +153,7 @@ private:
QAction* mBinaryFillAction;
QAction* mBinaryCopyAction;
QAction* mBinaryPasteAction;
QAction* mBinaryPasteIgnoreSizeAction;
QAction* mFindPatternAction;
QAction* mUndoSelection;

View File

@ -79,6 +79,11 @@ void CPUStack::setupContextMenu()
connect(mBinaryPasteAction, SIGNAL(triggered()), this, SLOT(binaryPasteSlot()));
mBinaryMenu->addAction(mBinaryPasteAction);
//Binary->Paste (Ignore Size)
mBinaryPasteIgnoreSizeAction = new QAction("Paste (&Ignore Size)", this);
connect(mBinaryPasteIgnoreSizeAction, SIGNAL(triggered()), this, SLOT(binaryPasteIgnoreSizeSlot()));
mBinaryMenu->addAction(mBinaryPasteIgnoreSizeAction);
// Restore Selection
mUndoSelection = new QAction("&Restore selection", this);
mUndoSelection->setShortcutContext(Qt::WidgetShortcut);
@ -376,7 +381,7 @@ void CPUStack::binaryEditSlot()
mMemPage->read(data, selStart, newSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, newSize));
mMemPage->write(patched.constData(), selStart, patched.size());
reloadData();
GuiUpdateAllViews();
}
void CPUStack::binaryFillSlot()
@ -396,7 +401,7 @@ void CPUStack::binaryFillSlot()
hexEdit.mHexEdit->fill(0, QString(pattern));
QByteArray patched(hexEdit.mHexEdit->data());
mMemPage->write(patched, selStart, patched.size());
reloadData();
GuiUpdateAllViews();
}
void CPUStack::binaryCopySlot()
@ -425,7 +430,23 @@ void CPUStack::binaryPasteSlot()
if(patched.size() < selSize)
selSize = patched.size();
mMemPage->write(patched.constData(), selStart, selSize);
reloadData();
GuiUpdateAllViews();
}
void CPUStack::binaryPasteIgnoreSizeSlot()
{
HexEditDialog hexEdit(this);
int_t selStart = getSelectionStart();
int_t selSize = getSelectionEnd() - selStart + 1;
QClipboard *clipboard = QApplication::clipboard();
hexEdit.mHexEdit->setData(clipboard->text());
byte_t* data = new byte_t[selSize];
mMemPage->read(data, selStart, selSize);
QByteArray patched = hexEdit.mHexEdit->applyMaskedData(QByteArray((const char*)data, selSize));
delete [] data;
mMemPage->write(patched.constData(), selStart, patched.size());
GuiUpdateAllViews();
}
void CPUStack::findPattern()

View File

@ -39,6 +39,7 @@ public slots:
void binaryCopySlot();
void binaryPasteSlot();
void findPattern();
void binaryPasteIgnoreSizeSlot();
void undoSelectionSlot();
private:
@ -49,6 +50,7 @@ private:
QAction* mBinaryFillAction;
QAction* mBinaryCopyAction;
QAction* mBinaryPasteAction;
QAction* mBinaryPasteIgnoreSizeAction;
QAction* mUndoSelection;
QAction* mGotoSp;
QAction* mGotoBp;

View File

@ -82,6 +82,8 @@ Configuration::Configuration() : QObject()
defaultColors.insert("InstructionUnconditionalJumpBackgroundColor", QColor("#FFFF00"));
defaultColors.insert("InstructionNopColor", QColor("#808080"));
defaultColors.insert("InstructionNopBackgroundColor", Qt::transparent);
defaultColors.insert("InstructionFarColor", QColor("#000000"));
defaultColors.insert("InstructionFarBackgroundColor", Qt::transparent);
defaultColors.insert("InstructionMemorySizeColor", QColor("#000080"));
defaultColors.insert("InstructionMemorySizeBackgroundColor", Qt::transparent);
defaultColors.insert("InstructionMemorySegmentColor", QColor("#FF00FF"));