Branch: refs/heads/master Author: Dominic Hopf dmaphy@googlemail.com Committer: Dominic Hopf dmaphy@googlemail.com Date: Thu, 15 Nov 2012 19:56:47 UTC Commit: 28e0432dbb75c6c4ad398049d88c1f480880b686 https://github.com/geany/geany-plugins/commit/28e0432dbb75c6c4ad398049d88c1f...
Log Message: ----------- Merge pull request #72 from frlan/Purging_geanyGDB
Removing geanyGDB from geany-plugins project
Modified Paths: -------------- MAINTAINERS Makefile.am build/geanygdb.m4 geanygdb/AUTHORS geanygdb/COPYING geanygdb/ChangeLog geanygdb/INSTALL geanygdb/Makefile.am geanygdb/NEWS geanygdb/README geanygdb/THANKS geanygdb/TODO geanygdb/doc/geany.css geanygdb/src/Makefile.am geanygdb/src/gdb-io-break.c geanygdb/src/gdb-io-envir.c geanygdb/src/gdb-io-frame.c geanygdb/src/gdb-io-priv.h geanygdb/src/gdb-io-read.c geanygdb/src/gdb-io-run.c geanygdb/src/gdb-io-stack.c geanygdb/src/gdb-io.h geanygdb/src/gdb-lex.c geanygdb/src/gdb-lex.h geanygdb/src/gdb-ui-break.c geanygdb/src/gdb-ui-envir.c geanygdb/src/gdb-ui-frame.c geanygdb/src/gdb-ui-locn.c geanygdb/src/gdb-ui-main.c geanygdb/src/gdb-ui.h geanygdb/src/geanygdb.c geanygdb/src/ttyhelper.c geanygdb/tests/Makefile.am geanygdb/tests/unittests.c geanygdb/wscript_build geanygdb/wscript_configure po/POTFILES.in
Modified: MAINTAINERS 6 files changed, 0 insertions(+), 6 deletions(-) =================================================================== @@ -54,12 +54,6 @@ M: Dimitar Zhekov dimitar.zhekov@gmail.com W: http://sheckley.users.sourceforge.net S: Maintained
-geanygdb -P: Dominic Hopf -M: Dominic Hopf dmaphy@googlemail.com -W: http://plugins.geany.org/geanygdb.html -S: Odd Fixes - geanygendoc P: Colomban Wendling ban@herbesfolles.org M: Colomban Wendling ban@herbesfolles.org
Modified: Makefile.am 4 files changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -30,10 +30,6 @@ if ENABLE_GEANYEXTRASEL SUBDIRS += geanyextrasel endif
-if ENABLE_GEANYGDB -SUBDIRS += geanygdb -endif - if ENABLE_GEANYGENDOC SUBDIRS += geanygendoc endif
Modified: build/geanygdb.m4 12 files changed, 0 insertions(+), 12 deletions(-) =================================================================== @@ -1,12 +0,0 @@ -AC_DEFUN([GP_CHECK_GEANYGDB], -[ - GP_ARG_DISABLE([GeanyGDB], [no]) - GP_STATUS_PLUGIN_ADD([GeanyGDB], [$enable_geanygdb]) - AC_CHECK_HEADERS([elf.h]) - AC_CHECK_HEADERS([elf_abi.h]) - AC_CONFIG_FILES([ - geanygdb/Makefile - geanygdb/src/Makefile - geanygdb/tests/Makefile - ]) -])
Modified: geanygdb/AUTHORS 3 files changed, 0 insertions(+), 3 deletions(-) =================================================================== @@ -1,3 +0,0 @@ -Jeff Pohlmeyer yetanothergeek@gmail.com -Dominic Hopf dmaphy@googlemail.com -Thomas Martitz thomas.martitz@student.htw-berlin.de
Modified: geanygdb/COPYING 340 files changed, 0 insertions(+), 340 deletions(-) =================================================================== @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR 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. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD 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. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License.
Modified: geanygdb/ChangeLog 94 files changed, 0 insertions(+), 94 deletions(-) =================================================================== @@ -1,94 +0,0 @@ -2010-03-22 Thomas Martitz thomas.martitz@student.htw-berlin.de - - * src/gdb-io-run.c: Fix the general geany slowness that geanygdb causes once a binary is loaded. - -2010-03-15 Thomas Martitz thomas.martitz@student.htw-berlin.de - - * src/gdb-io-run.c, src/gdb-ui-break.c: Run gdb with LANG=C to avoid - locale-related clashes when parsing the gdb output for the localized version - break- and watchpoints - -2010-03-01 Dominic Hopf dmaphy@googlemail.com - - * src/gdb-io-run.c, src/gdb-io-read.c: Improve the way a running process gets - killed (thanks Thomas Martitz) - - -2010-01-16 Dominic Hopf dmaphy@googlemail.com - - * src/gdb-ui-main.c, src/gdb-ui.h, src/geanygdb.c: - Add a menu entry for GeanyGDB, add possibility to set keyboard shortcuts, add - page in the bottom toolbar which in the future may be used to display the - stack and local variables or watches. This changes were all made by Radu - Stefan, thanks very much. - - -2010-01-04 Dominic Hopf dmaphy@googlemail.com - - * src/geanygdb.c, src/gdb-ui-frame.c, src/gdb-ui-locn.c, src/gdb-io-run.c, - src/gdb-io-stack.c, src/gdb-io-read.c, src/gdb-ui.h, src/gdb-io-envir.c, - src/gdb-io-break.c, src/gdb-ui-envir.c, src/gdb-ui-main.c, - src/gdb-ui-break.c, src/gdb-io-frame.c: Update sources to use more current - plugin API functions and fix a widget-not-found-warning. - - -2010-01-02 Dominic Hopf dmaphy@googlemail.com - * Any file: Update copyright information. - - -2009-12-13 Dominic Hopf dmaphy@googlemail.com - * geanydebug.c, geanygdb.c, Makefile.am: Finally fix any remaining naming - issues, GeanyGDB will show up as "GeanyGDB" now in the plugin manager. - * INSTALL, README: Remove installation instructions and add hint for - Geany-Plugins instead, update wording and notation for GeanyGDB. - - -2009-10-27 Dominic Hopf dmaphy@googlemail.com - * TODO: Add a TODO file, to note some things to get done for next releases. - - -2009-10-18 Dominic Hopf dmaphy@googlemail.com - * AUTHORS: Add Dominic Hopf to the AUTHORS. - - -2009-09-02 Dominic Hopf dmaphy@googlemail.com - * src/gdb-ui-main.c: Fix an issue with button labels, where some localizations - may caused a stack overflow, remember the last targetpath. - - -2009-05-07 Dominic Hopf dmaphy@googlemail.com - * Makefile.am: Install ttyhelper and geanydebug.so to /usr/lib/geany/, - patch by Chow Loong Jin, thanks! - - -2009-05-04 Dominic Hopf dmaphy@googlemail.com - * search for a globally installed tty helper in $PREFIX/$LIBDIR/geany/, - and fall back to the users config dir if not found. this fixes problems when - the plugin is installed to ~/.config/geany/plugins/. - * configure.in, README: Be consistent with naming issues, name of this plugin - is GeanyGDB, unix name is geanygdb. - * src/geanydebug.c, src/Makefile.am, INSTALL: Rename configuration directory - for this plugin from "debugger" to "geanygdb", GeanyGDB will try t - automatically rename ~/.config/geany/plugins/debugger/ to - ~/.config/geany/plugins/geanygdb/. You are recommended to backup this - directory. - - -2009-05-02 Dominic Hopf dmaphy@googlemail.com - * src/gdb-ui-break.c: Fix a crash when trying to delete breakpoints or - watchpoints without selecting one. (thanks to eht16) - - -2009-05-01 Dominic Hopf dmaphy@googlemail.com - * configure.in: Fix Geany version dependency - - -2009-04-18 Dominic Hopf dmaphy@googlemail.com - * INSTALL: Add installation instructions for GeanyGDB. - * README: Remove hint to conflicts with geanylua since there is geanylua 0.7.0 - (at least in svn) where this issue should have been fixed. - * src/geanydebug.c: Remove version definition since it is defined by autotools - or waf. - * configure.in: Version bump to 0.0.2. - * this maintenance release will be compatible with Geany 0.16 - * README, INSTALL: Rewrite Documentation in ReST.
Modified: geanygdb/INSTALL 11 files changed, 0 insertions(+), 11 deletions(-) =================================================================== @@ -1,11 +0,0 @@ -============ -Installation -============ - - -Please note that this plugin just should work with Geany 0.16 or higher. There -is no guarantee that it works with versions below 0.16. - -GeanyGDB is part of the Geany-Plugins project. Please consider compiling and/or -installing Geany-Plugins. A separate compilation of GeanyGDB is not supported -anymore.
Modified: geanygdb/Makefile.am 4 files changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -1,4 +0,0 @@ -include $(top_srcdir)/build/vars.auxfiles.mk - -SUBDIRS = src tests -plugin = geanygdb
Modified: geanygdb/NEWS 1 files changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -1 +0,0 @@ -See "ChangeLog"
Modified: geanygdb/README 140 files changed, 0 insertions(+), 140 deletions(-) =================================================================== @@ -1,140 +0,0 @@ -=============== -GeanyGDB Plugin -=============== - -.. contents:: - - -About -===== - -GeanyGDB is a plugin for Geany which provides integrated debugging support -within Geany via the GNU Debugger (GDB). - -Geany is a small and lightweight integrated development environment using the -GTK2 toolkit. - -The GNU Debugger is a source-level debugger for C, C++, Fortran, Modula 2 and -Java programs. - -It was developed and tested on openSUSE-10.3 with GDB-6.7.50 by Jeff Pohlmeyer. -Current maintainer is Dominic Hopf, he develops with current Git versions on -current Fedora systems. Other recent versions of GDB will probably work, but -operating systems other than Linux-PC will not work, at least not without some -considerable hacking. - - -Current Version -=============== - -GeanyGDB now is part of the Geany-Plugins project. The current version of -Geany-Plugins is 0.20. The last stable release of GeanyGDB is 0.0.2. You are -recommended to use the more current versions of GeanyGDB shipped with -Geany-Plugins. - - -Requirements -============ - -If you like to compile Geany-Plugins yourself, you will need the GTK (>= 2.8.0) -libraries and header files. You will also need its dependency libraries and header -files, such as Pango, Glib and ATK. All these files are available at -http://www.gtk.org or as package via your distributor. - -And obviously, you will need have Geany installed. If you have Geany installed -from the sources, you should be ready to go. If you are using a prepared package -e.g. from your distribution you probably need to install an additional package, -which might be called geany-dev or geany-devel. -Please note that in order to compile and use GeanyGDB, you will need Geany 0.16 -or later. - -Furthermore you need, of course, a C compiler and the Make tool. -The GNU versions of these tools are recommended. - -And last but not least: GDB. - - -Installation -============ - -Please consider to compile and/or install the Geany-Plugins project, as GeanyGDB -now is part of Geany-Plugins. - - -Documentation -============= - -There is no real documentation, but if you hover your mouse over the buttons -in the GeanyGDBs sidebar panel in Geany the tooltips should give you some idea -of what to do next. There are also a few "rough draft" notes below: - -Most of the console output from GDB is sent to the "Compiler" message window -in Geany, and you can send standard commands to GDB using the "Console" entry -on the debug sidebar. This should be used with caution, since GDB's machine -interface and console interface don't always play well together. - -Also note that the plugin sets its own internal breakpoint #1 to grab the -program's PID on startup, so any user-specified breakpoint numbers begin -at #2, and if you manually delete the #1 breakpoint it will likely cause -you some problems. - -Whenever the target program hits a breakpoint or encounters a segfault etc. -it will try to open the appropriate source file and jump to the correct line. - -To examine the state of the program's variables, you can click on the "Stack" -button in the debug sidebar. Note that the interaction between the plugin and -GDB can sometimes be quite slow, so please be patient when waiting -for the dialogs to open. - -The "Add breakpoint", "Add watchpoint", and "Run to" dialogs will try to -suggest some values based on your current position in whatever file you -have open in Geany, but if you don't like the choice, just click the "Clear" -button and type in whatever you please. - -GeanyGDB tries to enable only the buttons that are relevant to the current -state, but ocassionally it might end up getting things wrong. If this happens, -you should be able to click the "Unload" button and everything will be reset. - -If you try to unload the plugin using the plugin manager while it has a -program loaded, the plugin manager might appear to hang for a few seconds, -while GDB tries to shut down. Again, just be patient, but note that it is -much better use the "Unload" button in the debug sidebar before trying to -disable the plugin. - - -Download -======== - -Current Version ---------------- - -Current versions of Geany-Plugins can be found at http://plugins.geany.org/geany-plugins/. - -You can also check out more current sources of Geany-Plugins from Git, but note -that Git checkouts may not run stable. - - git clone git://github.com/geany/geany-plugins.git - - -Older Versions --------------- - -======================= ================ ========================================================= -Geany Version GeanyGDB Version Download -======================= ================ ========================================================= -known to work with 0.14 0.0.1 http://plugins.geany.org/geanygdb/geanydebug-0.0.1.tar.gz - 0.16 0.0.2 http://plugins.geany.org/geanygdb/geanygdb-0.0.2.tar.gz -======================= ================ ========================================================= - - - - -Contact -======= -Geanys official homepage is http://geany.org/ - -mailing list is geany@uvena.de - -eMail to dmaphy@googlemail.com - -meet us in IRC on channels #geany or #geany-de using chat.freenode.net
Modified: geanygdb/THANKS 20 files changed, 0 insertions(+), 20 deletions(-) =================================================================== @@ -1,20 +0,0 @@ -Thanks to: - -Salvador E. Tropea <set(at)users(dot)sf(dot)net> - Author of the libmigdb library. ( This project doesn't use any code from - libmigdb, but his project made me believe such a thing was even possible. ) - - -Enrico Troeger <enrico(dot)troeger(at)uvena(dot)de> - Geany IDE author. - - -Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> - Chief architect of the Geany plugin API. - - -Yura Siamashka yurand2(at)gmail(dot)com - Initial autotools scripts ( adapted from the geanyvc plugin. ) - and improvements to INSTALL instructions. - -
Modified: geanygdb/TODO 10 files changed, 0 insertions(+), 10 deletions(-) =================================================================== @@ -1,10 +0,0 @@ -==== -TODO -==== - -* Load the currently viewed source file. Or at least, have some quick way to - load the current file. (requested by mail) -* Make it possible to add parameters to the run command -* AVR (avr-gdb) support -* cris-gdb support -* maybe generic support for other gdb-compatible or gdb-based debuggers
Modified: geanygdb/doc/geany.css 114 files changed, 0 insertions(+), 114 deletions(-) =================================================================== @@ -1,114 +0,0 @@ -/* -:Author: Enrico Troeger -:Contact: enrico(dot)troeger(at)uvena(dot)de -:Copyright: This stylesheet has been placed in the public domain. - -Stylesheet for Geany's documentation based on a version of John Gabriele. -*/ - -@media screen { - - body { - background-color: #f2f2f2; - color: #404040; - margin-left: 0.4em; - width: 60em; - font-size: 90%; - } - - a { - color: #990000; - } - - a:visited { - color: #7E558E; - } - - a:hover { - text-decoration: none; - } - - h1 { - border-top: 1px dotted; - margin-top: 2em; - } - - h1, h2, h3 { - font-family: sans-serif; - color: #5D0606; - } - - h1.title { - text-align: left } - - h2 { - margin-top: 30px; - } - - h2.subtitle { - text-align: left } - - h3 { - padding-left: 3px; - } - - blockquote, pre { - border: 1px solid; - padding: 0.4em; - } - - blockquote { - font-family: sans-serif; - background-color: #DBEDD5; - border: 1px dotted; - border-left: 4px solid; - border-color: #9FD98C; - } - - pre { - background-color: #ECDFCE; - border: 1px dotted; - border-left: 4px solid; - border-color: #D9BE9A; - } - - tt, pre, code { - color: #6D4212; - } - - table { - border: 1px solid #D9BE9A; - } - - th { - background-color: #ECDFCE; - border: 1px dotted #D9BE9A; - } - - td { - border: 1px dotted #D9BE9A; - } - - .docinfo-name { - color: #5D0606; - } - - p.admonition-title { - color: #990000; - font-weight: bold; - } - - div.note { - margin: 1em 3em; - padding: 0em; - } - - dt { - font-style: italic; - } - -} - -@media print { - -}
Modified: geanygdb/src/Makefile.am 31 files changed, 0 insertions(+), 31 deletions(-) =================================================================== @@ -1,31 +0,0 @@ -include $(top_srcdir)/build/vars.build.mk - -geanygdbdir = $(libexecdir)/geany-plugins/geanygdb -geanyplugins_LTLIBRARIES = geanygdb.la -geanygdb_PROGRAMS = ttyhelper - -geanygdb_la_SOURCES = \ - gdb-io.h \ - gdb-io-priv.h \ - gdb-lex.h \ - gdb-ui.h \ - gdb-ui-envir.c \ - geanygdb.c \ - gdb-io-break.c \ - gdb-lex.c \ - gdb-ui-frame.c \ - gdb-ui-main.c \ - gdb-io-frame.c \ - gdb-io-run.c \ - gdb-io-read.c \ - gdb-ui-break.c \ - gdb-io-envir.c \ - gdb-io-stack.c \ - gdb-ui-locn.c - -geanygdb_la_CFLAGS = $(AM_CFLAGS) -DTTYHELPERDIR=""$(geanygdbdir)"" -geanygdb_la_LIBADD = $(COMMONLIBS) - -ttyhelper_SOURCES = ttyhelper.c - -include $(top_srcdir)/build/cppcheck.mk
Modified: geanygdb/src/gdb-io-break.c 334 files changed, 0 insertions(+), 334 deletions(-) =================================================================== @@ -1,334 +0,0 @@ -/* - * gdb-io-break.c - Breakpoint management functions for GDB wrapper library. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ - -#include <string.h> - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif -#include <geanyplugin.h> - -#include "gdb-io-priv.h" - - -static GdbListFunc gdbio_break_list_func = NULL; - -static GSList *breakpoint_list = NULL; - - -static void -free_breakpoint_list(void) -{ - GSList *p; - for (p = breakpoint_list; p; p = p->next) - { - GdbBreakPointInfo *bpi = p->data; - if (bpi) - { - g_free(bpi->addr); - g_free(bpi->disp); - g_free(bpi->enabled); - g_free(bpi->file); - g_free(bpi->fullname); - g_free(bpi->func); - g_free(bpi->line); - g_free(bpi->number); - g_free(bpi->times); - g_free(bpi->type); - g_free(bpi->what); - g_free(bpi->cond); - g_free(bpi->ignore); - g_free(bpi); - } - } - g_slist_free(breakpoint_list); - breakpoint_list = NULL; -} - - - -#define populate(rec, hash, key) \ - do \ - { \ - const gchar *populate_key = gdblx_lookup_string(hash, #key""); \ - if (populate_key) \ - { \ - rec->key = g_strdup(populate_key); \ - } \ - } \ - while (0) - - - -static void -breakpoint_cb(gpointer data, gpointer user_data) -{ - GdbLxValue *v = (GdbLxValue *) data; - if (v && (v->type == vt_HASH) && (v->hash)) - { - GHashTable *bkpt = v->hash; - if (bkpt) - { - GdbBreakPointInfo *bpi = g_new0(GdbBreakPointInfo, 1); - populate(bpi, bkpt, addr); - populate(bpi, bkpt, disp); - populate(bpi, bkpt, enabled); - populate(bpi, bkpt, file); - populate(bpi, bkpt, fullname); - populate(bpi, bkpt, func); - populate(bpi, bkpt, line); - populate(bpi, bkpt, number); - populate(bpi, bkpt, times); - populate(bpi, bkpt, type); - populate(bpi, bkpt, what); - populate(bpi, bkpt, cond); - populate(bpi, bkpt, ignore); - breakpoint_list = g_slist_append(breakpoint_list, bpi); - } - } -} - - -static void -parse_break_list(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HTAB(h, BreakpointTable); - gdbio_pop_seq(seq); - if (BreakpointTable && gdbio_break_list_func) - { - HLST(BreakpointTable, body); - if (body) - { - free_breakpoint_list(); - g_slist_foreach(body, breakpoint_cb, NULL); - gdbio_break_list_func(breakpoint_list); - free_breakpoint_list(); - } - else - { - gdbio_break_list_func(NULL); - } - } - if (h) - g_hash_table_destroy(h); -} - - - -void -gdbio_show_breaks(GdbListFunc func) -{ - gdbio_break_list_func = func; - if (func) - { - gdbio_send_seq_cmd(parse_break_list, "-break-list\n"); - } -} - - - -static void -added_break(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - HTAB(h, bkpt); - if (bkpt) - { - HSTR(bkpt, file); - HSTR(bkpt, line); - HSTR(bkpt, func); - HSTR(bkpt, number); - if (func) - { - gdbio_info_func(_("Added breakpoint #%s in %s() at %s:%s\n"), number, - func, file, line); - } - else - { - gdbio_info_func(_("Added breakpoint #%s at %s:%s\n"), number, file, - line); - } - - } - else - { - HTAB(h, wpt); - if (wpt) - { - HSTR(wpt, exp); - HSTR(wpt, number); - gdbio_info_func(_("Added write watchpoint #%s for %s\n"), number, exp); - } - else - { - HTAB(h, hw_awpt); - if (hw_awpt) - { - HSTR(hw_awpt, exp); - HSTR(hw_awpt, number); - gdbio_info_func(_("Added read/write watchpoint #%s for %s\n"), - number, exp); - } - else - { - HTAB(h, hw_rwpt); - if (hw_rwpt) - { - HSTR(hw_rwpt, exp); - HSTR(hw_rwpt, number); - gdbio_info_func - (_("Added read watchpoint #%s for %s\n"), - number, exp); - } - } - } - } - g_hash_table_destroy(h); - } - if (gdbio_break_list_func) - { - gdbio_show_breaks(gdbio_break_list_func); - } -} - -/* opt is "-r" (read) or "-a" (r/w) or NULL or empty (write) */ -void -gdbio_add_watch(GdbListFunc func, const gchar * option, const gchar * varname) -{ - gdbio_break_list_func = func; - gdbio_send_seq_cmd(added_break, "-break-watch %s %s\n", option ? option : "", varname); -} - - - -void -gdbio_add_break(GdbListFunc func, const gchar * filename, const gchar * locn) -{ - gdbio_break_list_func = func; - if (filename && *filename) - { - gdbio_send_seq_cmd(added_break, "-break-insert %s:%s\n", filename, locn); - } - else - { - gdbio_send_seq_cmd(added_break, "-break-insert %s\n", locn); - } -} - - -static void -deleted_break(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - g_hash_table_destroy(h); - gdbio_info_func(_("Watch/breakpoint deleted.\n")); - } - if (gdbio_break_list_func) - { - gdbio_show_breaks(gdbio_break_list_func); - } -} - - - -static void -toggled_break(gint seq, gchar ** list, gchar * resp) -{ - gdbio_pop_seq(seq); - if (strncmp(resp, "^error", 6) == 0) - { - if (resp[6] == ',') - { - GHashTable *h = gdblx_parse_results(resp + 7); - HSTR(h, msg); - - if (msg) - { - gchar *tmp = - g_strconcat(_("Failed to toggle breakpoint -\n"), msg, NULL); - gdbio_error_func(tmp); - if (tmp) - { - g_free(tmp); - } - } - else - { - } - if (h) - { - g_hash_table_destroy(h); - } - } - } - else - { - gdbio_info_func(_("Watch/breakpoint toggled.\n")); - } -} - - - -static void -edited_break(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - g_hash_table_destroy(h); - gdbio_info_func(_("Watch/breakpoint modified.\n")); - } -} - - -void -gdbio_delete_break(GdbListFunc func, const gchar * number) -{ - gdbio_break_list_func = func; - gdbio_send_seq_cmd(deleted_break, "-break-delete %s\n", number); -} - - -void -gdbio_enable_break(const gchar * number, gboolean enabled) -{ - gdbio_send_seq_cmd(toggled_break, "-break-%s %s\n", enabled ? "enable" : "disable", number); -} - - -void -gdbio_ignore_break(const gchar * number, const gchar * times) -{ - gdbio_send_seq_cmd(edited_break, "-break-after %s %s\n", number, times); -} - - -void -gdbio_break_cond(const gchar * number, const gchar * expr) -{ - gdbio_send_seq_cmd(edited_break, "-break-condition %s %s\n", number, expr); -}
Modified: geanygdb/src/gdb-io-envir.c 196 files changed, 0 insertions(+), 196 deletions(-) =================================================================== @@ -1,196 +0,0 @@ -/* - * gdb-io-envir.c - Environment settings for GDB wrapper library. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ - -#include <string.h> - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif -#include <geanyplugin.h> - -#include "gdb-io-priv.h" - - -static GdbEnvironFunc gdbio_environ_func = NULL; - -static GdbEnvironInfo env_info = { NULL, NULL, NULL, NULL }; - - -static void -free_env_info(void) -{ - g_free(env_info.cwd); - g_free(env_info.path); - g_free(env_info.args); - g_free(env_info.dirs); - memset(&env_info, '\0', sizeof(env_info)); -} - - - -static gchar * -unquote(gchar * quoted) -{ - gint len = quoted ? strlen(quoted) : 0; - if (len && (quoted[0] == '"') && (quoted[len - 1] == '"')) - { - gchar *tmp = g_strndup(quoted + 1, len - 2); - gchar *rv = g_strcompress(tmp); - g_free(tmp); - return rv; - } - else - return NULL; -} - - - -static void -get_env_args(gint seq, gchar ** list, gchar * resp) -{ - gchar *args; - gint i; - gdbio_pop_seq(seq); - for (i = 0; list[i]; i++) - { - if (strncmp(list[i], "~"", 2) == 0) - { - args = unquote(list[i] + 1); - if (args && *args) - { - gchar *quote = strchr(g_strstrip(args), '"'); - if (quote) - { - memmove(args, quote + 1, strlen(quote)); - quote = strrchr(args, '"'); - if (quote && g_str_equal(quote, "".")) - { - *quote = '\0'; - break; - } - } - } - g_free(args); - args = NULL; - } - } - env_info.args = args; - if (gdbio_environ_func) - { - gdbio_environ_func(&env_info); - } -} - - - -static void -get_env_dirs(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HSTR(h, source_path); - gdbio_pop_seq(seq); - if (source_path) - { - gchar *p; - env_info.dirs = g_strdup(source_path); - p = strstr(env_info.dirs, "$cdir:$cwd"); - if (p) - { - memmove(p, p + 10, strlen(p + 10) + 1); - } - p = strchr(env_info.dirs, '\0'); - if (p) - { - while (p > env_info.dirs) - { - p--; - if (*p == ':') - { - *p = '\0'; - } - else - { - break; - } - } - } - } - else - { - gdbio_info_func(_("Failed to retrieve source search path setting from GDB.")); -/* gdblx_dump_table(h);*/ - } - if (h) - g_hash_table_destroy(h); - gdbio_send_seq_cmd(get_env_args, "show args\n"); -} - - -static void -get_env_path(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HSTR(h, path); - gdbio_pop_seq(seq); - if (path) - { - env_info.path = g_strdup(path); - } - else - { - gdbio_info_func(_("Failed to retrieve executable search path setting from GDB.")); -/* gdblx_dump_table(h);*/ - } - if (h) - g_hash_table_destroy(h); - gdbio_send_seq_cmd(get_env_dirs, "-environment-directory\n"); -} - - -static void -get_env_cwd(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HSTR(h, cwd); - gdbio_pop_seq(seq); - free_env_info(); - if (cwd) - { - env_info.cwd = g_strdup(cwd); - } - else - { - gdbio_info_func(_("Failed to retrieve working directory setting from GDB.")); -/* gdblx_dump_table(h);*/ - } - if (h) - g_hash_table_destroy(h); - gdbio_send_seq_cmd(get_env_path, "-environment-path\n"); -} - - -void -gdbio_get_env(GdbEnvironFunc func) -{ - gdbio_environ_func = func; - if (func) - { - gdbio_send_seq_cmd(get_env_cwd, "-environment-pwd\n"); - } -}
Modified: geanygdb/src/gdb-io-frame.c 559 files changed, 0 insertions(+), 559 deletions(-) =================================================================== @@ -1,559 +0,0 @@ -/* - * gdb-io-frame.c - Stack frame information functions for GDB wrapper library. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ - - -#include <string.h> -#include <glib.h> - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif -#include <geanyplugin.h> - -#include "gdb-io-priv.h" - - -static GdbFrameFunc gdbio_locals_func = NULL; - -static GSList *locals_list = NULL; -static GSList **which_list = NULL; - -static gint locals_index = 0; -static gint args_index = 0; -static gint *which_index = NULL; - -static void var_created(gint seq, gchar ** list, gchar * resp); -static void got_varlist(gint seq, gchar ** list, gchar * resp); - -typedef enum _FrameProcState -{ - fpBegin, - fpGotLocals, - fpGotArgs -} FrameProcState; - - -static FrameProcState state = fpBegin; -static GdbFrameInfo current_frame; - - - -static void -gdbio_free_var(GdbVar * v) -{ - if (v) - { - g_free(v->type); - g_free(v->name); - g_free(v->value); - g_free(v->numchild); - g_free(v); - } -} - - -void -gdbio_free_var_list(GSList * args) -{ - GSList *p; - for (p = args; p; p = p->next) - { - gdbio_free_var((GdbVar *) p->data); - } - g_slist_free(args); -} - - - -static void -free_lists(void) -{ - gdbio_free_var_list(locals_list); - locals_list = NULL; - locals_index = 0; - args_index = 0; - which_list = &locals_list; - which_index = &locals_index; - state = fpBegin; - g_free(current_frame.func); - g_free(current_frame.filename); - gdbio_free_var_list(current_frame.args); - memset(¤t_frame, 0, sizeof(current_frame)); -} - -static void -get_arglist(void) -{ - which_list = ¤t_frame.args; - which_index = &args_index; - gdbio_send_seq_cmd(got_varlist, "-stack-list-arguments 1 %s %s\n", - current_frame.level, current_frame.level); -} - - -static void -create_var(gchar * varname) -{ - gdbio_send_seq_cmd(var_created, "-var-create x%s * %s\n", varname, varname); -} - - -static void -var_deleted(gint seq, gchar ** list, gchar * resp) -{ - GdbVar *lv; - gdbio_pop_seq(seq); - (*which_index)++; - lv = g_slist_nth_data(*which_list, *which_index); - if (lv) - { - create_var(lv->name); - } - else - { - if (state == fpBegin) - { - state = fpGotLocals; - get_arglist(); - } - else - { - if (gdbio_locals_func) - { - gdbio_locals_func(¤t_frame, locals_list); - } - free_lists(); - } - } -} - - - -static void -delete_var(gchar * varname) -{ - gdbio_send_seq_cmd(var_deleted, "-var-delete x%s\n", varname); -} - - - -static gchar * -fmt_val(const gchar * value) -{ - gchar buf[256]; - if (!value) - return g_strdup("0"); - if (strlen(value) < sizeof(buf)) - { - return g_strdup(value); - } - strncpy(buf, value, sizeof(buf) - 1); - buf[sizeof(buf) - 1] = '\0'; - return g_strdup_printf("%s...%s", buf, strchr(buf, '"') ? """ : ""); -} - - - -static void -var_created(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HSTR(h, type); - HSTR(h, value); - HSTR(h, numchild); - gdbio_pop_seq(seq); - if (type) - { - GdbVar *lv = g_slist_nth_data(*which_list, *which_index); - if (lv) - { - lv->type = g_strdup(type ? type : "int"); - lv->value = fmt_val(value); - lv->numchild = g_strdup(numchild ? numchild : "0"); - delete_var(lv->name); - } - } - if (h) - g_hash_table_destroy(h); -} - - - -void -got_varlist(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - GSList *hlist = NULL; - HLST(h, locals); - HLST(h, stack_args); - gdbio_pop_seq(seq); - if (state == fpBegin) - { - hlist = locals; - } - else - { - GdbLxValue *v = stack_args->data; - if (v && (v->type == vt_HASH)) - { - HLST(v->hash, args); - if (args) - { - hlist = args; - } - } - } - if (hlist) - { - GSList *p; - GdbVar *lv; - for (p = hlist; p; p = p->next) - { - GdbLxValue *v = p->data; - if (v && (v->type == vt_HASH) && v->hash) - { - HSTR(v->hash, name); - if (name) - { - lv = g_new0(GdbVar, 1); - lv->name = g_strdup(name); - *which_list = g_slist_append(*which_list, lv); - } - } - } - lv = g_slist_nth_data(*which_list, *which_index); - if (lv) - { - create_var(lv->name); - } - } - else - { - if (state == fpBegin) - { - state = fpGotLocals; - get_arglist(); - } - else - { - if (gdbio_locals_func) - { - gdbio_locals_func(¤t_frame, locals_list); - } - } - } - if (h) - g_hash_table_destroy(h); -} - - - - - -static void -got_current_level(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HTAB(h, frame); - gdbio_pop_seq(seq); - if (frame) - { - HSTR(frame, level); - if (level) - { - HSTR(frame, addr); - HSTR(frame, func); - HSTR(frame, file); - HSTR(frame, fullname); - HSTR(frame, line); - strncpy(current_frame.level, level, sizeof(current_frame.level) - 1); - strncpy(current_frame.addr, addr ? addr : "", - sizeof(current_frame.addr) - 1); - strncpy(current_frame.line, line ? line : "", - sizeof(current_frame.line) - 1); - current_frame.filename = g_strdup(fullname ? fullname : file ? file : ""); - current_frame.func = g_strdup(func ? func : ""); - } - } - if (h) - g_hash_table_destroy(h); - gdbio_send_seq_cmd(got_varlist, "-stack-list-locals 1\n"); -} - - -static void -set_current_level(gint seq, gchar ** list, gchar * resp) -{ - gdbio_pop_seq(seq); - gdbio_send_seq_cmd(got_current_level, "-stack-info-frame\n"); -} - -void -gdbio_show_locals(GdbFrameFunc func, const gchar * level) -{ - free_lists(); - gdbio_locals_func = func; - gdbio_send_seq_cmd(set_current_level, "-stack-select-frame %s\n", level); -} - - - - -static gpointer -qpop(GQueue ** q) -{ - gpointer p = NULL; - if (*q) - { - p = g_queue_pop_head(*q); - if (g_queue_get_length(*q) == 0) - { - g_queue_free(*q); - *q = NULL; - } - } - return p; -} - -static void -qpush(GQueue ** q, gpointer p) -{ - if (p) - { - if (!*q) - { - *q = g_queue_new(); - } - g_queue_push_head(*q, p); - } -} - -static gpointer -qtop(GQueue * q) -{ - return q ? g_queue_peek_head(q) : NULL; -} - - - -/* -static gpointer qnth(GQueue*q, gint n) -{ - return q?g_queue_peek_nth(q, n):NULL; -} - -static gint qlen(GQueue*q) -{ - return q?g_queue_get_length(q):0; -} -*/ - - -static GQueue *obj_list_queue = NULL; -static void -push_list(GSList * p) -{ - qpush(&obj_list_queue, p); -} -static void -pop_list(void) -{ - gdbio_free_var_list(qpop(&obj_list_queue)); -} -static GSList * -top_list(void) -{ - return qtop(obj_list_queue); -} - - -static GQueue *obj_var_queue = NULL; -static void -push_var(GdbVar * p) -{ - qpush(&obj_var_queue, p); -} -static void -pop_var(void) -{ - gdbio_free_var(qpop(&obj_var_queue)); -} -static GdbVar * -top_var(void) -{ - return qtop(obj_var_queue); -} - - - - -/*static GdbObjectFunc gdbio_object_list_func=NULL;*/ - -static GQueue *obj_func_queue = NULL; -static void -push_func(GdbObjectFunc p) -{ - qpush(&obj_func_queue, p); -} -static void -pop_func(void) -{ - qpop(&obj_func_queue); -} -static GdbObjectFunc -top_func(void) -{ - return qtop(obj_func_queue); -} - - - - -static void -done_top(void) -{ - pop_var(); - pop_list(); -/* pop_name();*/ - pop_func(); -} - - - -static void -object_deleted(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - if (top_func() && top_var() && top_list()) - { - top_func()(top_var(), top_list()); - } - done_top(); - g_hash_table_destroy(h); - } -} - - - -static GdbVar * -hash_val_to_var(GHashTable * h) -{ - HSTR(h, name); - if (name) - { - GdbVar *var = g_new0(GdbVar, 1); - HSTR(h, type); - HSTR(h, value); - HSTR(h, numchild); - var->name = g_strdup(name + 1); - var->type = g_strdup(type ? type : "int"); - var->value = fmt_val(value); - var->numchild = g_strdup(numchild ? numchild : "0"); - return var; - } - return NULL; -} - - -#define MAX_ITEMS 1024 - -static GSList * -hash_list_to_var_list(GSList * hlist) -{ - GSList *vlist = NULL; - GSList *p; - gint i; - for (p = hlist, i = 0; p; p = p->next, i++) - { - GdbLxValue *hv = p->data; - if (hv && (hv->type == vt_HASH) && hv->hash) - { - GdbVar *var = hash_val_to_var(hv->hash); - if (var) - { - vlist = g_slist_append(vlist, var); - } - } - if (i >= MAX_ITEMS) - { - GdbVar *var = g_new0(GdbVar, 1); - var->type = g_strdup(" "); - var->name = g_strdup_printf("* LIST TRUNCATED AT ITEM #%d *", i + 1); - var->value = g_strdup(" "); - var->numchild = g_strdup("0"); - vlist = g_slist_append(vlist, var); - gdbio_error_func(_("Field list too long, not all items can be displayed.\n")); - break; - } - } - return vlist; -} - - - -static void -object_listed(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - HLST(h, children); - if (children) - { - push_list(hash_list_to_var_list(children)); - } - gdbio_send_seq_cmd(object_deleted, "-var-delete x%s\n", top_var()->name); - g_hash_table_destroy(h); - } -} - - - -static void -object_created(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - HSTR(h, name); - if (name) - { - push_var(hash_val_to_var(h)); - gdbio_send_seq_cmd(object_listed, "-var-list-children 1 %s\n", name); - } - g_hash_table_destroy(h); - } -} - - -void -gdbio_show_object(GdbObjectFunc func, const gchar * varname) -{ - - if (func) - { - push_func(func); - gdbio_send_seq_cmd(object_created, "-var-create x%s * %s\n", varname, varname); - } -}
Modified: geanygdb/src/gdb-io-priv.h 107 files changed, 0 insertions(+), 107 deletions(-) =================================================================== @@ -1,107 +0,0 @@ -/* - * gdb-io-priv.h - private header for GDB wrapper library. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ - -#include "gdb-lex.h" -#include "gdb-io.h" - - -void gdbio_free_var_list(GSList * args); - - -typedef void (*ResponseHandler) (gint seq, gchar ** lines, gchar * resp); - - -/* - Sends a command to GDB, and returns the results to the specified - ResponseHandler function. -*/ -gint gdbio_send_seq_cmd(ResponseHandler func, const gchar * fmt, ...); - - -/* Look up a handler function */ -ResponseHandler gdbio_seq_lookup(gint seq); - - -/* - gdbio_pop_seq() removes a handler function from the sequencer. - This should (almost) always be called from the associated - ResponseHandler function, to avoid filling up the sequencer - with stale commands. -*/ -void gdbio_pop_seq(gint seq); - - -/* - Parses the output of GDB and returns it as a hash table, - unless the response is an error message, it calls the - error handler function and then returns NULL. -*/ -GHashTable *gdbio_get_results(gchar * resp, gchar ** list); - -void gdbio_parse_file_list(gint seq, gchar ** list, gchar * resp); - -/* -Preprocessor sugar for declaring C variables from hash key names, e.g. - HSTR(myhash,somevar) -expands to: - gchar *somevar = gdblx_lookup_string ( myhash, "somevar" ); -*/ -#define HSTR(hash,token) const gchar* token = gdblx_lookup_string(hash, #token"") -#define HTAB(hash,token) GHashTable* token = gdblx_lookup_hash(hash, #token"") -#define HLST(hash,token) GSList* token = gdblx_lookup_list(hash, #token"") - - -#if 0 -#define do_loop() \ - while (g_main_context_pending(NULL)) \ - g_main_context_iteration(NULL,FALSE); -#else -#define do_loop() g_main_context_iteration(NULL,FALSE); -#endif - - - - -void gdbio_info_func(const gchar * fmt, ...); -void gdbio_error_func(const gchar * fmt, ...); -void gdbio_do_status(GdbStatus s); - - -void gdbio_target_exited(const gchar * reason); -void gdbio_set_target_pid(GPid pid); -GPid gdbio_get_target_pid(void); -void gdbio_set_running(gboolean running); - -/* - Max/Min values for sequencer tokens. -The current values of 100000-999999 allow for 899999 pending commands. -I can't imagine why you would need more, but if you change this,keep in mind -that the number of digits for any possible value *must* be exactly SEQ_LEN. -*/ - -#define SEQ_MIN 100000 -#define SEQ_MAX 999999 -#define SEQ_LEN 6 - - - -void gdbio_consume_response(GString * recv_buf); - -void gdbio_set_starting(gboolean s); -void gdbio_target_started(gint seq, gchar ** list, gchar * resp);
Modified: geanygdb/src/gdb-io-read.c 818 files changed, 0 insertions(+), 818 deletions(-) =================================================================== @@ -1,818 +0,0 @@ -/* - * gdb-io-read.c - Output reading functions for GDB wrapper library. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ - -#include <stdlib.h> -#include <sys/time.h> - -#include <string.h> -#include <unistd.h> -#include <stdarg.h> - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif -#include <geanyplugin.h> - -#include "gdb-io-priv.h" - -static GSList *source_files = NULL; -static gboolean starting = FALSE; - -static void handle_response_line(gchar * str, gchar ** list); - - - -static void -free_string_list(GSList ** list) -{ - GSList *p; - for (p = *list; p; p = p->next) - { - if (p->data) - { - g_free(p->data); - } - } - *list = NULL; -} - - - -static void -free_source_list(void) -{ - free_string_list(&source_files); -} - - - -static gint -find_file_and_fullname(gconstpointer data, gconstpointer user_data) -{ - GdbLxValue *v = (GdbLxValue *) data; - gchar *ref = (gchar *) user_data; - HSTR(v->hash, fullname); - HSTR(v->hash, file); - return (fullname && file - && (g_str_equal(ref, file) || g_str_equal(ref, fullname))) ? 0 : -1; -} - - - -static void -parse_file_list_cb(gpointer data, gpointer user_data) -{ - GdbLxValue *v = (GdbLxValue *) data; - if (v && (v->type == vt_HASH)) - { - HSTR(v->hash, fullname); - HSTR(v->hash, file); - if (file && !fullname) - { - if (g_slist_find_custom((GSList *) user_data, file, find_file_and_fullname)) - { - return; - } - } - if (fullname) - { - file = fullname; - } - if (file) - { - if (!g_slist_find_custom(source_files, file, (GCompareFunc) strcmp)) - { - source_files = g_slist_append(source_files, g_strdup(file)); - } - } - } -} - - - -static void -handle_response_lines(gchar ** list) -{ - if (list) - { - gint i; - for (i = 0; list[i]; i++) - { - handle_response_line(list[i], list); - } - } -} - - - -static gboolean -response_is_error(gchar * resp, gchar ** list) -{ - if (strncmp(resp, "^error", 6) == 0) - { - handle_response_line(resp, list); - return TRUE; - } - else - { - return FALSE; - } -} - -#define CHK_RESP_ERR(resp, list) if (response_is_error(resp,list)) { return; } - -#define IsDigit g_ascii_isdigit - -static void -parse_process_info(gint seq, gchar ** list, gchar * resp) -{ - CHK_RESP_ERR(resp, list); - gdbio_pop_seq(seq); - if (g_str_equal(resp, "^done")) - { - gchar *pidstr = strchr(list[0], ' '); - if (pidstr) - { - GPid pid = -1; - while (g_ascii_isspace(*pidstr)) - { - pidstr++; - } - if (IsDigit(*pidstr)) - { - gchar *end = pidstr; - while (IsDigit(*end)) - { - end++; - } - *end = '\0'; - pid = gdbio_atoi(pidstr); - if ((pid > 0) && (!gdbio_get_target_pid())) - { - gdbio_set_target_pid(pid); - gdbio_send_cmd("-exec-continue\n"); - } - } - } - } -} - - -GHashTable * -gdbio_get_results(gchar * resp, gchar ** list) -{ - if (strncmp(resp, "^error", 6) == 0) - { - if (resp[6] == ',') - { - GHashTable *h = gdblx_parse_results(resp + 7); - HSTR(h, msg); - gchar *tmp = NULL; - if (msg) - { - if (g_str_equal(msg, "unknown error")) - { - gint len = g_strv_length(list); - if ((len > 1) && list[len - 2] && *list[len - 2]) - { - tmp = list[len - 2]; - if (tmp[0] == '&') - { - tmp++; - } - tmp = g_strcompress(tmp); - g_strstrip(tmp); - msg = tmp; - } - } - gdbio_error_func(msg); - if (tmp) - { - g_free(tmp); - } - } - if (h) - { - g_hash_table_destroy(h); - } - } - return NULL; - } - if (strncmp(resp, "^done,", 6) == 0) - return gdblx_parse_results(resp + 6); - if (strncmp(resp, "*stopped,", 9) == 0) - { - gdbio_do_status(GdbStopped); - return gdblx_parse_results(resp + 9); - } - return NULL; -} - - - -void -gdbio_set_starting(gboolean s) -{ - starting = s; -} - -void -gdbio_target_started(gint seq, gchar ** list, gchar * resp) -{ - if ((strncmp(resp, "^error", 6) == 0) && (!gdbio_get_target_pid())) - { - gdbio_error_func(_("Error starting target process!\n")); - gdbio_do_status(GdbFinished); - } - else - { - handle_response_lines(list); - } -} - - - -static void -set_main_break(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HTAB(h, bkpt); - gdbio_pop_seq(seq); - if (bkpt) - { - if (gdblx_check_keyval(bkpt, "number", "1")) - { - gdbio_do_status(GdbLoaded); - } - } - if (h) - g_hash_table_destroy(h); -} - - -void -gdbio_parse_file_list(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HLST(h, files); - gdbio_pop_seq(seq); - if (files) - { - free_source_list(); - g_slist_foreach(files, parse_file_list_cb, files); - free_source_list(); - gdbio_send_seq_cmd(set_main_break, "-break-insert _start\n"); - } - else - { - gdbio_error_func - (_("This executable does not appear to contain the required debugging information.")); - } - if (h) - g_hash_table_destroy(h); -} - - - - - -static gboolean -do_step_func(GHashTable * h, const gchar * reason_) -{ - HTAB(h, frame); - HSTR(frame, fullname); - HSTR(frame, line); - if (fullname && line) - { - if (gdbio_setup.step_func) - { - gchar *reason = g_strdup(reason_); - gchar *p; - for (p = reason; *p; p++) - { - if (*p == '-') - { - *p = ' '; - } - } - gdbio_setup.step_func(fullname, line, reason); - g_free(reason); - } - else - { - gdbio_info_func("%s:%s", fullname, line); - } - return TRUE; - } - else - { - HSTR(frame, func); - if (func) - { - return TRUE; - } - } - return FALSE; -} - - - -#define reason_is(r) (r && reason && g_str_equal(reason, r)) - -static void -finish_function(gint seq, gchar ** list, gchar * resp) -{ - if (strncmp(resp, "^running", 8) == 0) - { - gdbio_set_running(TRUE); - gdbio_do_status(GdbRunning); - } - else - { - GHashTable *h = gdbio_get_results(resp, list); - HSTR(h, reason); - gdbio_pop_seq(seq); - if (reason_is("function-finished")) - { - gdbio_do_status(GdbStopped); - do_step_func(h, reason); - } - else - { - handle_response_lines(list); - } - if (h) - g_hash_table_destroy(h); - } -} - - -static void -return_function(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - do_step_func(h, "returned"); - } - else - { - handle_response_lines(list); - } -} - - - - -static void -watchpoint_trigger(GHashTable * h, GHashTable * wp, const gchar * reason) -{ - HTAB(h, value); - HSTR(wp, exp); - HSTR(wp, number); - HSTR(value, new); - HSTR(value, old); - const gchar *readval = gdblx_lookup_string(value, "value"); - if (new && old) - { - gdbio_info_func("%s #%s expression:%s old-value:%s new-value:%s\n", - reason, number ? number : "?", exp ? exp : "?", old, new); - } - else - { - if (old) - { - gdbio_info_func("%s #%s expression:%s value:%s", reason, - number ? number : "?", exp ? exp : "?", old); - } - else - { - if (new) - { - gdbio_info_func("%s #%s expression:%s value:%s", reason, - number ? number : "?", exp ? exp : "?", new); - } - else - { - if (readval) - { - gdbio_info_func("%s #%s expression:%s value:%s", reason, - number ? number : "?", exp ? exp : "?", - readval); - } - else - { - gdbio_info_func("%s #%s expression:%s", reason, - number ? number : "?", exp ? exp : "?"); - } - } - } - } -} - -static gboolean -handle_results_hash(GHashTable * h, gchar * rectype, gchar ** list) -{ - if (g_str_equal(rectype, "^error")) - { - HSTR(h, msg); - gchar *tmp = NULL; - if (msg) - { - if (g_str_equal(msg, "unknown error")) - { - gint len = g_strv_length(list); - if ((len > 1) && list[len - 2] && *list[len - 2]) - { - tmp = list[len - 2]; - if (tmp[0] == '&') - { - tmp++; - } - tmp = g_strcompress(tmp); - g_strstrip(tmp); - msg = tmp; - } - } - gdbio_error_func(msg); - if (tmp) - { - g_free(tmp); - } - return TRUE; - } - else - return FALSE; - } - if (g_str_equal(rectype, "^done")) - { - - HTAB(h, frame); - if (frame) - { - HSTR(frame, fullname); - HSTR(frame, line); - if (fullname && line) - { - return do_step_func(h, "done"); - } - } - return FALSE; - } - if (g_str_equal(rectype, "*stopped")) - { - HSTR(h, reason); - if (!reason) - { - return FALSE; - } - if (reason_is("breakpoint-hit")) - { - if (gdblx_check_keyval(h, "bkptno", "1")) - { - gdbio_send_seq_cmd(parse_process_info, - "-interpreter-exec console "info proc"\n"); - return TRUE; - } - else - { - return (do_step_func(h, reason)); - } - return FALSE; - } - gdbio_set_running(FALSE); - if (reason_is("signal-received")) - { - HSTR(h, signal_name); - HSTR(h, signal_meaning); - HSTR(h, thread_id); - HTAB(h, frame); - HSTR(frame, func); - HSTR(frame, file); - HSTR(frame, fullname); - HSTR(frame, line); - HSTR(frame, addr); - HSTR(frame, from); - HLST(frame, args); - if (!fullname) - { - fullname = "??"; - } - if (!file) - { - file = "??"; - } - if (!line) - { - line = "??"; - } - if (!args) - { - args = NULL; - } - if (signal_name && signal_meaning && thread_id && frame && - addr && func && file && fullname) - { - if (gdbio_setup.signal_func) - { - GdbSignalInfo si; - si.signal_name = signal_name; - si.signal_meaning = signal_meaning; - si.addr = addr; - si.func = func; - si.file = file; - si.fullname = fullname; - si.line = line; - si.from = from; - gdbio_setup.signal_func(&si); - } - else - { - gdbio_info_func - (_("Program received signal %s (%s) at %s in function %s() at %s:%s"), - signal_name, signal_meaning, addr, func, file, - line); - } - return TRUE; - } - } - - - if (reason_is("end-stepping-range")) - { - return do_step_func(h, reason); - } - if (reason_is("function-finished")) - { - return do_step_func(h, reason); - } - if (reason_is("location-reached")) - { - return do_step_func(h, reason); - } - if (reason_is("watchpoint-trigger")) - { - HTAB(h, wpt); - if (wpt) - { - watchpoint_trigger(h, wpt, reason); - } - return do_step_func(h, reason); - } - if (reason_is("access-watchpoint-trigger")) - { - HTAB(h, hw_awpt); - if (hw_awpt) - { - watchpoint_trigger(h, hw_awpt, reason); - } - return do_step_func(h, reason); - } - if (reason_is("read-watchpoint-trigger")) - { - HTAB(h, hw_rwpt); - if (hw_rwpt) - { - watchpoint_trigger(h, hw_rwpt, reason); - } - return do_step_func(h, reason); - } - if (reason_is("watchpoint-scope")) - { - HSTR(h, wpnum); - gdbio_info_func(_("Watchpoint #%s out of scope"), wpnum ? wpnum : "?"); - gdbio_send_cmd("-exec-continue\n"); - return do_step_func(h, reason); - } - - if (reason_is("exited-signalled")) - { - HSTR(h, signal_name); - HSTR(h, signal_meaning); - gdbio_info_func(_("Program exited on signal %s (%s).\n"), - signal_name ? signal_name : "UNKNOWN", - signal_meaning ? signal_meaning : _("Unknown signal")); - gdbio_target_exited(signal_name); - return TRUE; - } - if (reason_is("exited")) - { - HSTR(h, exit_code); - gchar *tail = NULL; - gint ec = -1; - if (exit_code) - { - ec = strtoul(exit_code, &tail, 8); - if ((!tail) || (*tail)) - { - ec = -1; - } - } - gdbio_info_func(_("Program exited with code %d [%s]\n"), ec, - exit_code ? exit_code : _("(unknown)")); - gdbio_target_exited(exit_code); - return TRUE; - } - if (g_str_equal(reason, "exited-normally")) - { - gdbio_info_func(_("Program exited normally.\n")); - gdbio_target_exited("0"); - return TRUE; - } - } - return FALSE; -} - - - -static void -handle_response_line(gchar * str, gchar ** list) -{ - gchar *rv = str; - if (!rv) - { - return; - } - switch (rv[0]) - { - case '~': - case '@': - case '&': - { - rv++; - if (rv[0] == '"') - { - gint len = strlen(rv); - memmove(rv, rv + 1, len); - if (rv[len - 2] == '"') - { - rv[len - 2] = '\0'; - } - } - rv = g_strcompress(rv); - gdbio_info_func(rv); - g_free(rv); - break; - } - case '^': - case '*': - { - gchar *comma = strchr(rv, ','); - if (comma) - { - GHashTable *h = gdblx_parse_results(comma + 1); - *comma = '\0'; - if (g_str_equal(rv, "*stopped")) - { - gdbio_do_status(GdbStopped); - } - if (!handle_results_hash(h, rv, list)) - { - gdblx_dump_table(h); - } - g_hash_table_destroy(h); - } - else - { - if (g_str_equal(rv, "^running")) - { - if (starting) - { - starting = FALSE; - } - gdbio_do_status(GdbRunning); - gdbio_set_running(TRUE); - } - } - break; - } - default: - { - break; - } - } -} - - - - -#define prompt "\n(gdb) \n" -#define prlen 8 - - -#define starts_with_token(resp) \ - ( IsDigit(resp[0]) && IsDigit(resp[1]) && \ - IsDigit(resp[2]) && IsDigit(resp[3]) && \ - IsDigit(resp[4]) && IsDigit(resp[5]) && \ - strchr("^*=+", resp[6]) ) - - -void -gdbio_consume_response(GString * recv_buf) -{ - gchar *eos = NULL; - do - { - if (recv_buf->len) - { - eos = strstr(recv_buf->str, prompt); - } - else - { - eos = NULL; - } - if (eos) - { - gint seq = -1; - gchar seqbuf[SEQ_LEN + 2]; - ResponseHandler handler = NULL; - gchar **lines; - gint len; - *eos = '\0'; - lines = g_strsplit(recv_buf->str, "\n", 0); - *eos = '\n'; - len = g_strv_length(lines); - g_string_erase(recv_buf, 0, (eos - recv_buf->str) + 8); - if (len) - { - gchar *resp = lines[len - 1]; - if (starts_with_token(resp)) - { - strncpy(seqbuf, resp, SEQ_LEN); - seqbuf[SEQ_LEN] = '\0'; - seq = gdbio_atoi(seqbuf); - if (seq >= 0) - { - handler = gdbio_seq_lookup(seq); - if (handler) - { - memmove(resp, resp + SEQ_LEN, - strlen(resp + SEQ_LEN) + 1); - g_strstrip(resp); - handler(seq, lines, resp); - g_strfreev(lines); - do_loop(); - continue; - } - else - { - g_printerr - ("***Error: Could not find handler for token #%s\n", - seqbuf); - } - } - } - } - if (lines) - { - handle_response_lines(lines); - g_strfreev(lines); - } - } - do_loop(); - } - while (eos); -} - - - - - -void -gdbio_continue(void) -{ - gdbio_send_cmd("-exec-continue\n"); -} - - - - -void -gdbio_return(void) -{ - gdbio_send_seq_cmd(return_function, "-exec-return\n"); -} - - -void -gdbio_finish(void) -{ - gdbio_send_seq_cmd(finish_function, "-exec-finish\n"); -}
Modified: geanygdb/src/gdb-io-run.c 866 files changed, 0 insertions(+), 866 deletions(-) =================================================================== @@ -1,866 +0,0 @@ -/* - * gdb-io-run.c - Process execution and input functions for GDB wrapper library. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ - -#include <unistd.h> -#include <signal.h> -#include <string.h> - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif -#include <geanyplugin.h> - -extern GeanyFunctions *geany_functions; -#include "gdb-io-priv.h" - - -extern gint g_unlink(const gchar * filename); - - -GdbIoSetup gdbio_setup; - - -static const gchar *gdbio_args[] = { "gdb", "--interpreter=mi", "-nx", NULL }; - -static GPid gdbio_pid = 0; -static GPid target_pid = 0; -static GPid xterm_pid = 0; - -static GSource *gdbio_src; -static gint gdbio_in; -static gint gdbio_out; -static GIOChannel *gdbio_ch_in; -static GIOChannel *gdbio_ch_out; -static guint gdbio_id_in; -static guint gdbio_id_out; - -static GString send_buf = { NULL, 0, 0 }; -static GString recv_buf = { NULL, 0, 0 }; - -static gchar *xterm_tty_file = NULL; - - -static gint sequence = SEQ_MIN; -static gboolean is_running = FALSE; -static gint process_token = 0; - - -static void send_to_gdb(const gchar *data); - - -/* - Hash table to associate a "tokenized" GDB command with a function call. - This stores a list of key-value pairs where the unique sequence-number - (GDB token) is the key, and a ResponseHandler function pointer is the value. -*/ -static GHashTable *sequencer; - - - -#if !GLIB_CHECK_VERSION(2, 14, 0) -static void -g_string_append_vprintf(GString *str, const gchar *fmt, va_list args) -{ - gchar *tmp = g_strdup_vprintf(fmt, args); - g_string_append(str, tmp); - g_free(tmp); -} -#endif - - -/* Add a handler function to the sequencer */ -gint -gdbio_send_seq_cmd(ResponseHandler func, const gchar * fmt, ...) -{ - va_list args; - GString *data; - if (!gdbio_pid) - { - return 0; - } - if (sequence >= SEQ_MAX) - { - sequence = SEQ_MIN; - } - else - { - sequence++; - } - if (!sequencer) - { - sequencer = g_hash_table_new(g_direct_hash, g_direct_equal); - } - g_hash_table_insert(sequencer, GINT_TO_POINTER(sequence), func); - data = g_string_sized_new(128); - g_string_append_printf(data, "%d", sequence); - va_start(args, fmt); - g_string_append_vprintf(data, fmt, args); - va_end(args); - send_to_gdb(data->str); - g_string_free(data, TRUE); - return sequence; -} - - -ResponseHandler -gdbio_seq_lookup(gint seq) -{ - return g_hash_table_lookup(sequencer, GINT_TO_POINTER(seq)); -} - - -void -gdbio_pop_seq(gint seq) -{ - g_hash_table_remove(sequencer, GINT_TO_POINTER(seq)); -} - -static gboolean -gerror(const gchar * msg, GError ** err) -{ - if (*err) - { - if (msg) - { - gdbio_error_func("%s\n%s\n", msg, (*err)->message); - } - else - { - gdbio_error_func("%s\n", (*err)->message); - } - g_error_free(*err); - *err = NULL; - return TRUE; - } - else - { - return FALSE; - } -} - - -gint -gdbio_atoi(const gchar * str) -{ - gchar *tail = NULL; - gint rv = strtol(str, &tail, 10); - return (tail && !*tail) ? rv : -1; -} - - -void -gdbio_error_func(const gchar * fmt, ...) -{ - va_list args; - gchar *msg; - va_start(args, fmt); - msg = g_strdup_vprintf(fmt, args); - if (gdbio_setup.error_func) - { - gdbio_setup.error_func(g_strstrip(msg)); - } - else - { - g_printerr("%s", msg); - } - g_free(msg); - va_end(args); -} - - -void -gdbio_info_func(const gchar * fmt, ...) -{ - va_list args; - gchar *msg; - va_start(args, fmt); - msg = g_strdup_vprintf(fmt, args); - if (gdbio_setup.info_func) - { - gdbio_setup.info_func(g_strstrip(msg)); - } - else - { - g_printerr("%s", msg); - } - g_free(msg); - va_end(args); -} - - -gint -gdbio_wait(gint ms) -{ - struct timespec req = { 0, 0 }, rem = - { - 0, 0}; - gint rms = ms; - if (ms >= 1000) - { - req.tv_sec = ms / 1000; - rms = ms % 1000; - } - req.tv_nsec = rms * 1000000; /* 1 millisecond = 1,000,000 nanoseconds */ - do - { - nanosleep(&req, &rem); - if ((rem.tv_sec || rem.tv_nsec)) - { - memcpy(&req, &rem, sizeof(req)); - memset(&rem, 0, sizeof(rem)); - } - else - { - break; - } - - } - while (1); - return ms; -} - - - -void -gdbio_send_cmd(const gchar * fmt, ...) -{ - va_list args; - gchar *data; - if (!gdbio_pid) - { - return; - } - va_start(args, fmt); - data = g_strdup_vprintf(fmt, args); - va_end(args); - - send_to_gdb(data); - g_free(data); -} - - - -void -gdbio_set_running(gboolean running) -{ - is_running = running; -} - - - -static void -kill_xterm(void) -{ - if (xterm_pid) - { - kill(xterm_pid, SIGKILL); - xterm_pid = 0; - } -} - - - -static gchar * -start_xterm(const gchar * term_cmd) -{ - const gchar *term_args[] = { "xterm", "-title", "Debug terminal", "-e", NULL, NULL, NULL }; - GError *err = NULL; - gint i = 0; - gchar *tty_name = NULL; - const gchar *exe_name = basename(term_cmd); - gchar *all; - if (!gdbio_setup.temp_dir) - { - gdbio_error_func(_("tty temporary directory not specified!\n")); - return NULL; - } - if (!g_file_test(gdbio_setup.temp_dir, G_FILE_TEST_IS_DIR)) - { - gdbio_error_func(_("tty temporary directory not found!\n")); - return NULL; - } - if (!xterm_tty_file) - { - xterm_tty_file = g_strdup_printf("%s/%d.tty", gdbio_setup.temp_dir, getpid()); - } - if (g_file_set_contents(xterm_tty_file, "", -1, &err)) - { - g_unlink(xterm_tty_file); - } - else - { - gerror("writing ttyname logfile", &err); - g_unlink(xterm_tty_file); - return FALSE; - } - if (!gdbio_setup.tty_helper) - { - gdbio_error_func(_("tty helper program not specified!\n")); - return NULL; - } - if (! - (g_file_test(gdbio_setup.tty_helper, G_FILE_TEST_IS_EXECUTABLE) && - g_file_test(gdbio_setup.tty_helper, G_FILE_TEST_IS_REGULAR))) - { - gdbio_error_func(_("tty helper program not found!\n")); - return NULL; - } - term_args[0] = term_cmd; - if (g_str_equal(exe_name, "xterm") || g_str_equal(exe_name, "konsole")) - { - term_args[1] = "-T"; - } - else - { - if (g_str_equal(exe_name, "gnome-terminal")) - { - term_args[1] = "--title"; - term_args[3] = "-x"; - } - else - { - if (g_str_equal(exe_name, "rxvt") || g_str_equal(exe_name, "urxvt")) - { - term_args[1] = "-title"; - } - else - { - term_args[1] = "-e"; - term_args[2] = NULL; - } - } - } - i = 0; - while (term_args[i]) - { - i++; - } - term_args[i] = gdbio_setup.tty_helper; - term_args[i + 1] = xterm_tty_file; - all = g_strjoinv("" "", (gchar **) term_args); - gdbio_info_func(""%s"\n", all); - g_free(all); - if (g_spawn_async(NULL, (gchar **) term_args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &xterm_pid, &err)) - { - gchar *contents = NULL; - gsize len; - gint ms = 0; - do - { - if (g_file_test(xterm_tty_file, G_FILE_TEST_EXISTS)) - { - if (g_file_get_contents(xterm_tty_file, &contents, &len, &err)) - { - g_strstrip(contents); - if (strlen(contents)) - { - tty_name = g_strdup(contents); - gdbio_info_func(_("Attaching to terminal %s\n"), - tty_name); - } - break; - } - else - { - gerror("Error getting tty name:", &err); - } - } - ms += gdbio_wait(250); - } - while (ms <= 10000); - if (ms > 10000) - { - gdbio_error_func(_("Timeout waiting for TTY name.\n")); - kill_xterm(); - } - } - else - { - gerror("Error starting terminal: ", &err); - } - g_unlink(xterm_tty_file); - return tty_name; -} - - - -static void -free_buf(GString * buf) -{ - if (buf->str) - { - g_free(buf->str); - buf->str = NULL; - buf->len = 0; - buf->allocated_len = 0; - } -} - -static void -shutdown_channel(GIOChannel ** ch) -{ - if (*ch) - { - GError *err = NULL; - gint fd = g_io_channel_unix_get_fd(*ch); - g_io_channel_shutdown(*ch, TRUE, &err); - gerror("Shutting down channel", &err); - g_io_channel_unref(*ch); - *ch = NULL; - if (fd >= 0) - { - close(fd); - } - } -} - - -static void -on_gdb_exit(GPid pid, gint status, gpointer data) -{ - gdbio_pid = 0; - gdbio_info_func(_("GDB exited (pid=%d)\n"), pid); - g_spawn_close_pid(pid); - - - shutdown_channel(&gdbio_ch_in); - - g_source_remove(gdbio_id_out); - shutdown_channel(&gdbio_ch_out); - - free_buf(&send_buf); - if (recv_buf.len) - { - gdbio_info_func("%s\n", recv_buf.str); - } - free_buf(&recv_buf); - - if (target_pid) - { - kill(target_pid, SIGKILL); - target_pid = 0; - } - gdbio_set_running(FALSE); - gdblx_scanner_done(); - gdbio_do_status(GdbDead); -} - - - -static gboolean -on_send_to_gdb(gpointer data) -{ - GIOStatus st; - GError *err = NULL; - gsize count; - GIOChannel *src = gdbio_ch_in; - - if (send_buf.len) - { - while (send_buf.len) - { - st = g_io_channel_write_chars(src, send_buf.str, send_buf.len, &count, - &err); - g_string_erase(&send_buf, 0, count); - if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF)) - { - gerror("Error sending command", &err); - break; - } - } - st = g_io_channel_flush(src, &err); - gerror("Error pushing command", &err); - gdbio_wait(10); - } - return (send_buf.len > 0); -} - - - -static void -delay_send_to_gdb(const gchar *data) -{ - g_string_append(&send_buf, data); - g_idle_add(on_send_to_gdb, NULL); -} - - - -static void -send_to_gdb(const gchar *data) -{ - GIOStatus st; - GError *err = NULL; - gsize count; - GIOChannel *src = gdbio_ch_in; - GString *text = g_string_new(data); - - if (text->len) - { - while (text->len) - { - st = g_io_channel_write_chars(src, text->str, text->len, &count, - &err); - g_string_erase(text, 0, count); - if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF)) - { - gerror("Error sending command", &err); - /* puffer string for later retry */ - delay_send_to_gdb(text->str); - break; - } - } - st = g_io_channel_flush(src, &err); - gerror("Error pushing command", &err); - } - g_string_free(text, TRUE); -} - - - -void -gdbio_target_exited(const gchar * reason) -{ - gdbio_info_func(_("Target process exited. (pid=%d; %s%s)\n"), target_pid, - reason - && g_ascii_isdigit(reason[0]) ? _("code=") : _("reason:"), - reason ? reason : "unknown"); - target_pid = 0; - kill_xterm(); - gdbio_set_running(FALSE); - gdbio_do_status(GdbFinished); - if (process_token) - { - gdbio_pop_seq(process_token); - process_token = 0; - } -} - -static GdbStatus gdbio_status = GdbDead; - -void -gdbio_do_status(GdbStatus s) -{ - gdbio_status = s; - if (gdbio_setup.status_func) - { - gdbio_setup.status_func(s); - } -} - - - -void -gdbio_pause_target(void) -{ - if (target_pid) - { - kill(target_pid, SIGINT); - } -} - - - -static void -target_killed(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - gdbio_pop_seq(seq); - if (h) - { - g_hash_table_destroy(h); - } - if (strncmp(resp, "^done", 5) == 0) - { - gdbio_target_exited("killed by GDB"); - } -} - - - -void -gdbio_kill_target(gboolean force) -{ - if (target_pid) - { - gchar pidstr[64]; - GPid this_pid = target_pid; - gint ms = 0; - snprintf(pidstr, sizeof(pidstr) - 1, "/proc/%d", target_pid); - if (!g_file_test(pidstr, G_FILE_TEST_IS_DIR)) - { - gdbio_info_func(_("Directory %s not found!\n"), pidstr); - pidstr[0] = '\0'; - } - if (!force) - { - gdbio_info_func(_("Shutting down target program.\n")); - gdbio_send_seq_cmd(target_killed, "kill\n"); - gdbio_wait(250); - do_loop(); - } - else - { - gdbio_info_func(_("Killing target program.\n")); - kill(this_pid, SIGKILL); - } - while (1) - { - do_loop(); - if (ms >= 2000) - { - gdbio_info_func(_("Timeout waiting for target process.\n")); - if (!force) - { - gdbio_info_func(_("Using a bigger hammer!\n")); - gdbio_kill_target(TRUE); - } - break; - } - if (target_pid != this_pid) - { - break; - } - if ((pidstr[0]) && !g_file_test(pidstr, G_FILE_TEST_EXISTS)) - { - break; - } - if (!(ms % 1000)) - gdbio_info_func(_("Waiting for target process to exit.\n")); - ms += gdbio_wait(250); - } - } - kill_xterm(); -} - -static gboolean -have_console(void) -{ - return (gdbio_status == GdbLoaded) || (gdbio_status == GdbStopped) - || (gdbio_status == GdbFinished); -} - -void -gdbio_exit(void) -{ - gdbio_kill_target(!have_console()); - if (gdbio_pid) - { - GPid this_gdb = gdbio_pid; - gint ms = 0; - gchar pidstr[64]; - snprintf(pidstr, sizeof(pidstr) - 1, "/proc/%d", this_gdb); - if (is_running) - { - if (!g_file_test(pidstr, G_FILE_TEST_IS_DIR)) - { - gdbio_info_func(_("Directory %s not found!\n"), pidstr); - pidstr[0] = '\0'; - } - do - { - do_loop(); - if (gdbio_pid == this_gdb) - { - gdbio_info_func(_("Killing GDB (pid=%d)\n"), this_gdb); - } - else - { - break; - } - kill(this_gdb, SIGKILL); - ms += gdbio_wait(500); - if (pidstr[0] && !g_file_test(pidstr, G_FILE_TEST_EXISTS)) - { - break; - } - if (ms > 2000) - { - gdbio_error_func(_("Timeout trying to kill GDB.\n")); - break; - } - } - while (1); - free_buf(&send_buf); - gdbio_wait(500); - } - else - { - gdbio_info_func(_("Shutting down GDB\n")); - gdbio_send_cmd("-gdb-exit\n"); - while (1) - { - do_loop(); - ms += gdbio_wait(250); - if (pidstr[0] && !g_file_test(pidstr, G_FILE_TEST_EXISTS)) - { - break; - } - if (gdbio_pid == this_gdb) - { - if (!(ms % 1000)) - gdbio_info_func(_("Waiting for GDB to exit.\n")); - } - else - { - break; - } - if (ms > 2000) - { - gdbio_info_func(_("Timeout waiting for GDB to exit.\n")); - gdbio_set_running(TRUE); - gdbio_exit(); - break; - } - } - } - } - if (sequencer) - { - g_hash_table_destroy(sequencer); - sequencer = NULL; - } - g_free(xterm_tty_file); - xterm_tty_file = NULL; -} - - - -static void -load_target(const gchar * exe_name) -{ - gdbio_set_running(FALSE); - gdbio_send_cmd("-file-exec-and-symbols %s\n", exe_name); - gdbio_send_seq_cmd(gdbio_parse_file_list, "-file-list-exec-source-files\n"); - -} - - - -static gboolean -on_read_from_gdb(GIOChannel * src, GIOCondition cond, gpointer data) -{ - gchar buf[1024]; - GIOStatus st; - GError *err = NULL; - gsize count; - st = g_io_channel_read_chars(src, buf, sizeof(buf) - 1, &count, &err); - buf[count] = '\0'; - g_string_append_len(&recv_buf, buf, count); - gerror("Error reading response", &err); - gdbio_consume_response(&recv_buf); - gdbio_wait(10); - return TRUE; -} - - -#define GDB_SPAWN_FLAGS \ -G_SPAWN_SEARCH_PATH | \ -G_SPAWN_DO_NOT_REAP_CHILD - - -void -gdbio_load(const gchar * exe_name) -{ - GError *err = NULL; - /* need to execute gdb with LANG=C because we parse the output - * for break and watch points - * however, the debugged applications ought to run under the - * systems locale (i.e. the current LANG) */ - const gchar *exclude[] = { "LANG", NULL }; - gchar **gdbio_env = utils_copy_environment(exclude, "LANG", "C", NULL); - const gchar *env_lang = g_getenv("LANG"); - gdbio_exit(); - if (g_spawn_async_with_pipes(NULL, (gchar **) gdbio_args, gdbio_env, - GDB_SPAWN_FLAGS, NULL, - NULL, &gdbio_pid, &gdbio_in, &gdbio_out, NULL, &err)) - { - gdbio_info_func(_("Starting gdb (pid=%d)\n"), gdbio_pid); - - g_child_watch_add(gdbio_pid, on_gdb_exit, NULL); - gdbio_src = g_child_watch_source_new(gdbio_pid); - - gdbio_ch_in = g_io_channel_unix_new(gdbio_in); - g_io_channel_set_encoding(gdbio_ch_in, NULL, &err); - gerror("Error setting encoding", &err); - g_io_channel_set_buffered(gdbio_ch_in, FALSE); - - gdbio_ch_out = g_io_channel_unix_new(gdbio_out); - g_io_channel_set_encoding(gdbio_ch_out, NULL, &err); - gerror("Error setting encoding", &err); - g_io_channel_set_buffered(gdbio_ch_out, FALSE); - - gdbio_id_out = g_io_add_watch(gdbio_ch_out, G_IO_IN, on_read_from_gdb, NULL); - - gdbio_send_cmd("-gdb-set width 0\n-gdb-set height 0\n"); - /* restore LANG for apps here, gdb is under LANG=C */ - gdbio_send_cmd("-gdb-set environment LANG=%s\n", env_lang); - if (exe_name) - { - load_target(exe_name); - } - } - else - { - gerror("Error starting debugger.", &err); - } - g_strfreev(gdbio_env); -} - - - -void -gdbio_exec_target(const gchar * terminal_command) -{ - if (terminal_command) - { - gchar *tty_name = start_xterm(terminal_command); - if (tty_name) - { - gdbio_send_cmd("-inferior-tty-set %s\n", tty_name); - g_free(tty_name); - } - else - return; - } - if (process_token) - { - gdbio_pop_seq(process_token); - } - gdbio_set_starting(TRUE); - gdbio_do_status(GdbStartup); - process_token = gdbio_send_seq_cmd(gdbio_target_started, "-exec-run\n"); -} - - - -void -gdbio_set_target_pid(GPid pid) -{ - gdbio_info_func(_("Started target process. (pid=%d)\n"), pid); - target_pid = pid; -} - - - -GPid -gdbio_get_target_pid(void) -{ - return target_pid; -}
Modified: geanygdb/src/gdb-io-stack.c 216 files changed, 0 insertions(+), 216 deletions(-) =================================================================== @@ -1,216 +0,0 @@ -/* - * gdb-io-stack.c - Stack information functions for GDB wrapper library. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <string.h> -#include <glib.h> - -#include "geanyplugin.h" -#include "gdb-io-priv.h" - -static GdbListFunc gdbio_stack_list_func = NULL; -static GSList *frame_list = NULL; - -/* - Max number of frames to return in stack list - - you can increase if you want, but too large - value can be *very* slow! -*/ -#define MAX_STACK_RETURN 1024 - - - -static void -free_frame_list(void) -{ - GSList *p; - for (p = frame_list; p; p = p->next) - { - if (p->data) - { - GdbFrameInfo *f = p->data; - if (f->func) - { - g_free(f->func); - } - if (f->filename) - { - g_free(f->filename); - } - if (f->args) - { - gdbio_free_var_list(f->args); - } - g_free(f); - p->data = NULL; - } - } - g_slist_free(frame_list); - frame_list = NULL; -} - - - -static void -stack_cb(gpointer data, gpointer user_data) -{ - GdbLxValue *v = (GdbLxValue *) data; - if (v && (v->type == vt_HASH)) - { - GHashTable *frame = v->hash; - HSTR(frame, level); - HSTR(frame, addr); - HSTR(frame, func); - HSTR(frame, file); - HSTR(frame, fullname); - HSTR(frame, line); - if (!fullname) - fullname = file; - if (level && addr && func && fullname && line) - { - GdbFrameInfo *frame_info = g_new0(GdbFrameInfo, 1); - strncpy(frame_info->level, level, sizeof(frame_info->level) - 1); - strncpy(frame_info->addr, addr, sizeof(frame_info->addr) - 1); - strncpy(frame_info->line, line, sizeof(frame_info->line) - 1); - frame_info->func = g_strdup(func); - frame_info->filename = g_strdup(fullname); - frame_list = g_slist_append(frame_list, frame_info); - } - } -} - - - -static void -merge_stack_args_cb(gpointer data, gpointer user_data) -{ - GdbLxValue *v = (GdbLxValue *) data; - if (v && (v->type = vt_HASH)) - { - GHashTable *hash = v->hash; - HSTR(hash, level); - HLST(hash, args); - if (level && args) - { - gchar *tail; - gint n = strtoul(level, &tail, 10); - GdbFrameInfo *frame = NULL; - GSList *p; - for (p = frame_list; p; p = p->next) - { - if (p->data) - { - GdbFrameInfo *f = p->data; - if (gdbio_atoi(f->level) == n) - { - frame = f; - break; - } - } - } - if (frame) - { - for (p = args; p; p = p->next) - { - v = p->data; - if (v && (v->type = vt_HASH)) - { - HSTR(v->hash, name); - HSTR(v->hash, value); - if (name && value) - { - GdbVar *arg = g_new0(GdbVar, 1); - arg->name = g_strdup(name); - arg->value = g_strdup(value); - frame->args = - g_slist_append(frame->args, arg); - } - } - } - } - } - } -} - - - -static void -parse_stack_args(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HLST(h, stack_args); - gdbio_pop_seq(seq); - if (stack_args) - { - if (frame_list) - { - g_slist_foreach(stack_args, merge_stack_args_cb, NULL); - gdbio_stack_list_func(frame_list); - free_frame_list(); - } - } - if (h) - g_hash_table_destroy(h); -} - - - -static void -parse_stack_list(gint seq, gchar ** list, gchar * resp) -{ - GHashTable *h = gdbio_get_results(resp, list); - HLST(h, stack); - gdbio_pop_seq(seq); - if (stack) - { - g_slist_foreach(stack, stack_cb, h); - if (frame_list) - { - gint len = g_slist_length(frame_list); - if (len >= MAX_STACK_RETURN) - { - gdbio_error_func - (ngettext( - "Stack too deep to display!\n(Showing only %d frame)", - "Stack too deep to display!\n(Showing only %d frames)", - len), len); - } - gdbio_send_seq_cmd(parse_stack_args, "-stack-list-arguments 1 0 %d\n", - len - 1); - } - } - if (h) - g_hash_table_destroy(h); -} - - - -void -gdbio_show_stack(GdbListFunc func) -{ - gdbio_stack_list_func = func; - if (func) - { - gdbio_send_seq_cmd(parse_stack_list, "-stack-list-frames 0 %d\n", - MAX_STACK_RETURN - 1); - } -}
Modified: geanygdb/src/gdb-io.h 228 files changed, 0 insertions(+), 228 deletions(-) =================================================================== @@ -1,228 +0,0 @@ -/* - * gdb-io.h - A GLib-based library wrapper for the GNU debugger. - * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> - - -extern ssize_t getline(char **lineptr, size_t * n, FILE * stream); -extern const gchar *basename(const gchar * path); - -gint gdbio_atoi(const gchar * str); -gint gdbio_wait(gint ms); - - -typedef enum -{ - GdbDead, - GdbLoaded, - GdbStartup, - GdbRunning, - GdbStopped, - GdbFinished -} GdbStatus; - - -typedef struct -{ - gchar *type; - gchar *name; - gchar *value; - gchar *numchild; -} GdbVar; - - -typedef struct -{ - gchar level[12]; - gchar addr[12]; - gchar line[12]; - gchar *func; - gchar *filename; - GSList *args; -} GdbFrameInfo; - - -typedef struct -{ - const gchar *signal_name; - const gchar *signal_meaning; - const gchar *addr; - const gchar *func; - const gchar *file; - const gchar *fullname; - const gchar *line; - const gchar *from; -} GdbSignalInfo; - - -typedef struct -{ - gchar *addr; - gchar *disp; - gchar *enabled; - gchar *file; - gchar *fullname; - gchar *func; - gchar *line; - gchar *number; - gchar *times; @@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).