KDevelop API Documentation

languages/cpp/debugger/memviewdlg.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 begin : Tue Oct 5 1999 00003 copyright : (C) 1999 by John Birch 00004 email : jbb@kdevelop.org 00005 ***************************************************************************/ 00006 00007 /*************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #include "memviewdlg.h" 00017 00018 #include <kbuttonbox.h> 00019 #include <klineedit.h> 00020 #include <kglobalsettings.h> 00021 #include <klocale.h> 00022 #include <kstdguiitem.h> 00023 00024 #include <qlabel.h> 00025 #include <qlayout.h> 00026 #include <qmultilineedit.h> 00027 #include <qpushbutton.h> 00028 00029 // ************************************************************************** 00030 // 00031 // Dialog allows the user to enter 00032 // - A starting address 00033 // - An ending address 00034 // 00035 // this can be in the form 00036 // functiom/method name 00037 // variable address (ie &Var, str) 00038 // Memory address 0x8040abc 00039 // 00040 // When disassembling and you enter a method name without an 00041 // ending address then the whole method is disassembled. 00042 // No data means disassemble the method we're curently in.(from the 00043 // start of the method) 00044 // 00045 // click ok buton to send the request to gdb 00046 // the output is returned (some time later) in the raw data slot 00047 // and displayed as is, so it's rather crude, but it works! 00048 // ************************************************************************** 00049 00050 namespace GDBDebugger 00051 { 00052 00053 MemoryViewDialog::MemoryViewDialog(QWidget *parent, const char *name) 00054 : KDialog(parent, name, true), // modal 00055 start_(new KLineEdit(this)), 00056 end_(new KLineEdit(this)), 00057 output_(new QMultiLineEdit(this)) 00058 { 00059 setCaption(i18n("Memory/Misc Viewer")); 00060 // Make the top-level layout; a vertical box to contain all widgets 00061 // and sub-layouts. 00062 QBoxLayout *topLayout = new QVBoxLayout(this, 5); 00063 00064 QGridLayout *grid = new QGridLayout(2, 2, 5); 00065 topLayout->addLayout(grid); 00066 00067 QLabel *label = new QLabel(start_, i18n("&Start:"), this); 00068 label->setBuddy(start_); 00069 grid->addWidget(label, 0, 0); 00070 grid->setRowStretch(0, 0); 00071 grid->addWidget(start_, 1, 0); 00072 grid->setRowStretch(1, 0); 00073 00074 label = new QLabel(end_, i18n("Amount/&End address (memory/disassemble):"), this); 00075 label->setBuddy(end_); 00076 grid->addWidget(label, 0, 1); 00077 grid->addWidget(end_, 1, 1); 00078 00079 label = new QLabel(i18n("Memory&View:"), this); 00080 label->setBuddy(output_); 00081 topLayout->addWidget(label, 0); 00082 topLayout->addWidget(output_, 5); 00083 output_->setFont(KGlobalSettings::fixedFont()); 00084 00085 KButtonBox *buttonbox = new KButtonBox(this, Horizontal, 5); 00086 QPushButton *memoryDump = buttonbox->addButton(i18n("&Memory")); 00087 QPushButton *disassemble = buttonbox->addButton(i18n("&Disassemble")); 00088 QPushButton *registers = buttonbox->addButton(i18n("&Registers")); 00089 QPushButton *libraries = buttonbox->addButton(i18n("&Libraries")); 00090 QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel().text()); 00091 memoryDump->setDefault(true); 00092 buttonbox->layout(); 00093 topLayout->addWidget(buttonbox); 00094 00095 start_->setFocus(); 00096 00097 connect(memoryDump, SIGNAL(clicked()), SLOT(slotMemoryDump())); 00098 connect(disassemble, SIGNAL(clicked()), SLOT(slotDisassemble())); 00099 connect(registers, SIGNAL(clicked()), SIGNAL(registers())); 00100 connect(libraries, SIGNAL(clicked()), SIGNAL(libraries())); 00101 connect(cancel, SIGNAL(clicked()), SLOT(reject())); 00102 } 00103 00104 // ************************************************************************** 00105 00106 MemoryViewDialog::~MemoryViewDialog() 00107 { 00108 } 00109 00110 // ************************************************************************** 00111 00112 void MemoryViewDialog::slotRawGDBMemoryView(char *buf) 00113 { 00114 // just display the resultant output from GDB in the edit box 00115 output_->clear(); 00116 output_->insertLine(buf); 00117 output_->setCursorPosition(0,0); 00118 } 00119 00120 // ************************************************************************** 00121 00122 // get gdb to supply the disassembled data. 00123 void MemoryViewDialog::slotDisassemble() 00124 { 00125 QString start(start_->text()); 00126 QString end(end_->text()); 00127 emit disassemble(start, end); 00128 } 00129 00130 // ************************************************************************** 00131 00132 void MemoryViewDialog::slotMemoryDump() 00133 { 00134 QString start(start_->text()); 00135 QString size(end_->text()); 00136 emit memoryDump(start, size); 00137 } 00138 00139 // ************************************************************************** 00140 // ************************************************************************** 00141 // ************************************************************************** 00142 00143 } 00144 00145 #include "memviewdlg.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:43 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003