KDevelop API Documentation

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 #include <kdeversion.h>
00024 
00025 #include <qlabel.h>
00026 #include <qlayout.h>
00027 #include <qmultilineedit.h>
00028 #include <qpushbutton.h>
00029 
00030 // **************************************************************************
00031 //
00032 // Dialog allows the user to enter
00033 //  - A starting address
00034 //  - An ending address
00035 //
00036 //  this can be in the form
00037 //            functiom/method name
00038 //            variable address (ie &Var, str)
00039 //            Memory address 0x8040abc
00040 //
00041 //  When disassembling and you enter a method name without an
00042 //  ending address then the whole method is disassembled.
00043 //  No data means disassemble the method we're curently in.(from the
00044 //  start of the method)
00045 //
00046 // click ok buton to send the request to gdb
00047 // the output is returned (some time later) in the raw data slot
00048 // and displayed as is, so it's rather crude, but it works!
00049 // **************************************************************************
00050 
00051 namespace GDBDebugger
00052 {
00053 
00054 MemoryViewDialog::MemoryViewDialog(QWidget *parent, const char *name)
00055     : KDialog(parent, name, true),      // modal
00056       start_(new KLineEdit(this)),
00057       end_(new KLineEdit(this)),
00058       output_(new QMultiLineEdit(this))
00059 {
00060     setCaption(i18n("Memory/Misc Viewer"));
00061     // Make the top-level layout; a vertical box to contain all widgets
00062     // and sub-layouts.
00063     QBoxLayout *topLayout = new QVBoxLayout(this, 5);
00064 
00065     QGridLayout *grid = new QGridLayout(2, 2, 5);
00066     topLayout->addLayout(grid);
00067 
00068     QLabel *label = new QLabel(start_, i18n("&Start:"), this);
00069     label->setBuddy(start_);
00070     grid->addWidget(label, 0, 0);
00071     grid->setRowStretch(0, 0);
00072     grid->addWidget(start_, 1, 0);
00073     grid->setRowStretch(1, 0);
00074 
00075     label = new QLabel(end_, i18n("Amount/&End address (memory/disassemble):"), this);
00076     label->setBuddy(end_);
00077     grid->addWidget(label, 0, 1);
00078     grid->addWidget(end_, 1, 1);
00079 
00080     label = new QLabel(i18n("Memory&View:"), this);
00081     label->setBuddy(output_);
00082     topLayout->addWidget(label, 0);
00083     topLayout->addWidget(output_, 5);
00084     output_->setFont(KGlobalSettings::fixedFont());
00085 
00086     KButtonBox *buttonbox = new KButtonBox(this, Horizontal, 5);
00087     QPushButton *memoryDump = buttonbox->addButton(i18n("&Memory"));
00088     QPushButton *disassemble = buttonbox->addButton(i18n("&Disassemble"));
00089     QPushButton *registers = buttonbox->addButton(i18n("&Registers"));
00090     QPushButton *libraries = buttonbox->addButton(i18n("&Libraries"));
00091 #if KDE_IS_VERSION( 3, 2, 90 )
00092     QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
00093 #else
00094     QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel().text());
00095 #endif
00096     memoryDump->setDefault(true);
00097     buttonbox->layout();
00098     topLayout->addWidget(buttonbox);
00099 
00100     start_->setFocus();
00101 
00102     connect(memoryDump, SIGNAL(clicked()), SLOT(slotMemoryDump()));
00103     connect(disassemble, SIGNAL(clicked()), SLOT(slotDisassemble()));
00104     connect(registers, SIGNAL(clicked()), SIGNAL(registers()));
00105     connect(libraries, SIGNAL(clicked()), SIGNAL(libraries()));
00106     connect(cancel, SIGNAL(clicked()), SLOT(reject()));
00107 }
00108 
00109 // **************************************************************************
00110 
00111 MemoryViewDialog::~MemoryViewDialog()
00112 {
00113 }
00114 
00115 // **************************************************************************
00116 
00117 void MemoryViewDialog::slotRawGDBMemoryView(char *buf)
00118 {
00119     // just display the resultant output from GDB in the edit box
00120     output_->clear();
00121     output_->insertLine(buf);
00122     output_->setCursorPosition(0,0);
00123 }
00124 
00125 // **************************************************************************
00126 
00127 // get gdb to supply the disassembled data.
00128 void MemoryViewDialog::slotDisassemble()
00129 {
00130     QString start(start_->text());
00131     QString end(end_->text());
00132     emit disassemble(start, end);
00133 }
00134 
00135 // **************************************************************************
00136 
00137 void MemoryViewDialog::slotMemoryDump()
00138 {
00139     QString start(start_->text());
00140     QString size(end_->text());
00141     emit memoryDump(start, size);
00142 }
00143 
00144 // **************************************************************************
00145 // **************************************************************************
00146 // **************************************************************************
00147 
00148 }
00149 
00150 #include "memviewdlg.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:46 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003