Revision: 1901
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1901&view=rev
Author: frlan
Date: 2011-02-06 15:06:22 +0000 (Sun, 06 Feb 2011)
Log Message:
-----------
GeanyLaTeX: Fix a memory leak
Modified Paths:
--------------
trunk/geanylatex/ChangeLog
trunk/geanylatex/src/templates.c
Modified: trunk/geanylatex/ChangeLog
===================================================================
--- trunk/geanylatex/ChangeLog 2011-02-05 11:33:17 UTC (rev 1900)
+++ trunk/geanylatex/ChangeLog 2011-02-06 15:06:22 UTC (rev 1901)
@@ -1,3 +1,8 @@
+2011-02-06 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * src/templace.c: Fix a little memory leak.
+
+
2011-01-30 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
* Move convert to table function to new Tableconvert plugin of Geany-Plugins.
Modified: trunk/geanylatex/src/templates.c
===================================================================
--- trunk/geanylatex/src/templates.c 2011-02-05 11:33:17 UTC (rev 1900)
+++ trunk/geanylatex/src/templates.c 2011-02-06 15:06:22 UTC (rev 1901)
@@ -44,7 +44,10 @@
/* Return if its not a searched file */
if (g_str_has_suffix(file,".gtl") == FALSE)
+ {
+ g_free(template);
return;
+ }
template->filepath = g_strdup(file);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1900
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1900&view=rev
Author: cesspit
Date: 2011-02-05 11:33:17 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
includes debugger in the common build system
Modified Paths:
--------------
trunk/geany-plugins/Makefile.am
Modified: trunk/geany-plugins/Makefile.am
===================================================================
--- trunk/geany-plugins/Makefile.am 2011-02-05 11:24:39 UTC (rev 1899)
+++ trunk/geany-plugins/Makefile.am 2011-02-05 11:33:17 UTC (rev 1900)
@@ -1,6 +1,7 @@
plugins = \
addons \
codenav \
+ debugger \
geanycfp \
geanydoc \
geanyextrasel \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1899
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1899&view=rev
Author: cesspit
Date: 2011-02-05 11:24:39 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
old name references removed
Modified Paths:
--------------
trunk/geany-plugins/debugger/INSTALL
trunk/geany-plugins/debugger/po/ru.po
Modified: trunk/geany-plugins/debugger/INSTALL
===================================================================
--- trunk/geany-plugins/debugger/INSTALL 2011-02-05 11:18:58 UTC (rev 1898)
+++ trunk/geany-plugins/debugger/INSTALL 2011-02-05 11:24:39 UTC (rev 1899)
@@ -14,12 +14,12 @@
--------------------------------------------------------------------------------
./configure
make
-cp src/.libs/geanydbg.so ~/.config/geany/plugins
+cp src/.libs/debugger.so ~/.config/geany/plugins
Third
--------------------------------------------------------------------------------
-There will soon be a possibility to build geanydbg using waf.
+There will soon be a possibility to build debugger using waf.
Fourth
Modified: trunk/geany-plugins/debugger/po/ru.po
===================================================================
--- trunk/geany-plugins/debugger/po/ru.po 2011-02-05 11:18:58 UTC (rev 1898)
+++ trunk/geany-plugins/debugger/po/ru.po 2011-02-05 11:24:39 UTC (rev 1899)
@@ -5,7 +5,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: geanydbg 0.01\n"
+"Project-Id-Version: debugger 0.21\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-04 14:13+0300\n"
"PO-Revision-Date: 2010-12-29 22:39+0300\n"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1898
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1898&view=rev
Author: cesspit
Date: 2011-02-05 11:18:58 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
moving code to geany-plugins svn
Added Paths:
-----------
trunk/geany-plugins/debugger/
trunk/geany-plugins/debugger/AUTHORS
trunk/geany-plugins/debugger/COPYING
trunk/geany-plugins/debugger/ChangeLog
trunk/geany-plugins/debugger/INSTALL
trunk/geany-plugins/debugger/Makefile.am
trunk/geany-plugins/debugger/NEWS
trunk/geany-plugins/debugger/README
trunk/geany-plugins/debugger/THANKS
trunk/geany-plugins/debugger/autogen.sh
trunk/geany-plugins/debugger/configure.in
trunk/geany-plugins/debugger/indent-all.sh
trunk/geany-plugins/debugger/po/
trunk/geany-plugins/debugger/po/ChangeLog
trunk/geany-plugins/debugger/po/LINGUAS
trunk/geany-plugins/debugger/po/POTFILES.in
trunk/geany-plugins/debugger/po/POTFILES.skip
trunk/geany-plugins/debugger/po/ru.po
trunk/geany-plugins/debugger/src/
trunk/geany-plugins/debugger/src/Makefile.am
trunk/geany-plugins/debugger/src/bptree.c
trunk/geany-plugins/debugger/src/bptree.h
trunk/geany-plugins/debugger/src/breakpoint.c
trunk/geany-plugins/debugger/src/breakpoint.h
trunk/geany-plugins/debugger/src/breakpoints.c
trunk/geany-plugins/debugger/src/breakpoints.h
trunk/geany-plugins/debugger/src/callbacks.c
trunk/geany-plugins/debugger/src/callbacks.h
trunk/geany-plugins/debugger/src/dbm_bash.c
trunk/geany-plugins/debugger/src/dbm_gdb.c
trunk/geany-plugins/debugger/src/debug.c
trunk/geany-plugins/debugger/src/debug.h
trunk/geany-plugins/debugger/src/debug_module.c
trunk/geany-plugins/debugger/src/debug_module.h
trunk/geany-plugins/debugger/src/keys.c
trunk/geany-plugins/debugger/src/keys.h
trunk/geany-plugins/debugger/src/ltree.c
trunk/geany-plugins/debugger/src/ltree.h
trunk/geany-plugins/debugger/src/markers.c
trunk/geany-plugins/debugger/src/markers.h
trunk/geany-plugins/debugger/src/plugin.c
trunk/geany-plugins/debugger/src/stree.c
trunk/geany-plugins/debugger/src/stree.h
trunk/geany-plugins/debugger/src/tpage.c
trunk/geany-plugins/debugger/src/tpage.h
trunk/geany-plugins/debugger/src/utils.c
trunk/geany-plugins/debugger/src/utils.h
trunk/geany-plugins/debugger/src/vtree.c
trunk/geany-plugins/debugger/src/vtree.h
trunk/geany-plugins/debugger/src/watch_model.c
trunk/geany-plugins/debugger/src/watch_model.h
trunk/geany-plugins/debugger/src/wtree.c
trunk/geany-plugins/debugger/src/wtree.h
Added: trunk/geany-plugins/debugger/AUTHORS
===================================================================
--- trunk/geany-plugins/debugger/AUTHORS (rev 0)
+++ trunk/geany-plugins/debugger/AUTHORS 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1 @@
+Alexander Petukhov <Alexander.Petukhov(a)mail.ru>
Added: trunk/geany-plugins/debugger/COPYING
===================================================================
--- trunk/geany-plugins/debugger/COPYING (rev 0)
+++ trunk/geany-plugins/debugger/COPYING 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,340 @@
+ 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.
Added: trunk/geany-plugins/debugger/ChangeLog
===================================================================
--- trunk/geany-plugins/debugger/ChangeLog (rev 0)
+++ trunk/geany-plugins/debugger/ChangeLog 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,2 @@
+2011-01-01 Alexander Petukhov <Alexander.Petukhov(a)mail.ru>
+ * version 0.1
Added: trunk/geany-plugins/debugger/INSTALL
===================================================================
--- trunk/geany-plugins/debugger/INSTALL (rev 0)
+++ trunk/geany-plugins/debugger/INSTALL 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,35 @@
+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.
+
+There are different possibilities to install this plugin:
+
+First
+--------------------------------------------------------------------------------
+./configure
+make
+make install
+
+
+Second
+--------------------------------------------------------------------------------
+./configure
+make
+cp src/.libs/geanydbg.so ~/.config/geany/plugins
+
+
+Third
+--------------------------------------------------------------------------------
+There will soon be a possibility to build geanydbg using waf.
+
+
+Fourth
+--------------------------------------------------------------------------------
+Building much of the available plugins from svn by doing this:
+
+svn co https://geany-plugins.svn.sourceforge.net/svnroot/geany-plugins/trunk geany-plugins
+cd geany-plugins
+./waf configure
+./waf build -p -k
+
+Built *.so-files will be available in ./_build_/default/ after a successful build.
+Copy the ones you want to ~/.config/geany/plugins/
Added: trunk/geany-plugins/debugger/Makefile.am
===================================================================
--- trunk/geany-plugins/debugger/Makefile.am (rev 0)
+++ trunk/geany-plugins/debugger/Makefile.am 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,14 @@
+SUBDIRS = src po
+
+EXTRA_DIST = \
+ autogen.sh \
+ makefile.win32 \
+ intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in \
+ indent-all.sh
+
+DISTCLEANFILES = \
+ intltool-extract \
+ intltool-merge \
+ intltool-update
Added: trunk/geany-plugins/debugger/NEWS
===================================================================
--- trunk/geany-plugins/debugger/NEWS (rev 0)
+++ trunk/geany-plugins/debugger/NEWS 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1 @@
+See "ChangeLog"
Added: trunk/geany-plugins/debugger/README
===================================================================
--- trunk/geany-plugins/debugger/README (rev 0)
+++ trunk/geany-plugins/debugger/README 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1 @@
+
Added: trunk/geany-plugins/debugger/THANKS
===================================================================
--- trunk/geany-plugins/debugger/THANKS (rev 0)
+++ trunk/geany-plugins/debugger/THANKS 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1 @@
+
Added: trunk/geany-plugins/debugger/autogen.sh
===================================================================
--- trunk/geany-plugins/debugger/autogen.sh (rev 0)
+++ trunk/geany-plugins/debugger/autogen.sh 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,165 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+DIE=0
+
+if [ -n "$GNOME2_DIR" ]; then
+ ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
+ LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
+ PATH="$GNOME2_DIR/bin:$PATH"
+ export PATH
+ export LD_LIBRARY_PATH
+fi
+
+(test -f $srcdir/configure.in) || {
+ echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+ echo " top-level package directory"
+ exit 1
+}
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`autoconf' installed."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(grep "^AC_PROG_INTLTOOL" $srcdir/configure.in >/dev/null) && {
+ (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`intltool' installed."
+ echo "You can get it from:"
+ echo " ftp://ftp.gnome.org/pub/GNOME/"
+ DIE=1
+ }
+}
+
+(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.in >/dev/null) && {
+ (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`xml-i18n-toolize' installed."
+ echo "You can get it from:"
+ echo " ftp://ftp.gnome.org/pub/GNOME/"
+ DIE=1
+ }
+}
+
+(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
+ (libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+ }
+}
+
+(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.in >/dev/null) && {
+ (grep "sed.*POTFILES" $srcdir/configure.in) > /dev/null || \
+ (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`glib' installed."
+ echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
+ DIE=1
+ }
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`automake' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+ NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: Missing \`aclocal'. The version of \`automake'"
+ echo "installed doesn't appear recent enough."
+ echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+if test -z "$*"; then
+ echo "**Warning**: I am going to run \`configure' with no arguments."
+ echo "If you wish to pass any to it, please specify them on the"
+ echo \`$0\'" command line."
+ echo
+fi
+
+case $CC in
+xlc )
+ am_opt=--include-deps;;
+esac
+
+for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.in -print`
+do
+ dr=`dirname $coin`
+ if test -f $dr/NO-AUTO-GEN; then
+ echo skipping $dr -- flagged as no auto-gen
+ else
+ echo processing $dr
+ ( cd $dr
+
+ aclocalinclude="$ACLOCAL_FLAGS"
+
+ if grep "^AM_GLIB_GNU_GETTEXT" configure.in >/dev/null; then
+ echo "Creating $dr/aclocal.m4 ..."
+ test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
+ echo "Running glib-gettextize... Ignore non-fatal messages."
+ echo "no" | glib-gettextize --force --copy
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
+ fi
+ if grep "^AC_PROG_INTLTOOL" configure.in >/dev/null; then
+ echo "Running intltoolize..."
+ intltoolize --copy --force --automake
+ fi
+ if grep "^AM_PROG_XML_I18N_TOOLS" configure.in >/dev/null; then
+ echo "Running xml-i18n-toolize..."
+ xml-i18n-toolize --copy --force --automake
+ fi
+ if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
+ if test -z "$NO_LIBTOOLIZE" ; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ fi
+ fi
+ if grep "^AC_PROG_LIBTOOL" configure.in >/dev/null; then
+ if test -z "$NO_LIBTOOLIZE" ; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ fi
+ fi
+ echo "Running aclocal $aclocalinclude ..."
+ aclocal $aclocalinclude
+ if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
+ echo "Running autoheader..."
+ autoheader
+ fi
+ echo "Running automake --gnu $am_opt ..."
+ automake --add-missing --gnu $am_opt
+ echo "Running autoconf ..."
+ autoconf
+ )
+ fi
+done
+
+conf_flags="--enable-maintainer-mode"
+
+if test x$NOCONFIGURE = x; then
+ echo Running $srcdir/configure $conf_flags "$@" ...
+ $srcdir/configure $conf_flags "$@" \
+ && echo Now type \`make\' to compile. || exit 1
+else
+ echo Skipping configure process.
+fi
Property changes on: trunk/geany-plugins/debugger/autogen.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/configure.in
===================================================================
--- trunk/geany-plugins/debugger/configure.in (rev 0)
+++ trunk/geany-plugins/debugger/configure.in 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,63 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([debugger], [0.0.2], [Alexander.Petukhov(a)mail.ru])
+AM_INIT_AUTOMAKE([1.9 foreign])
+
+AM_CONFIG_HEADER(config.h)
+
+AC_PROG_CC
+
+AC_DISABLE_STATIC
+AM_PROG_LIBTOOL
+LIBTOOL="$LIBTOOL --silent"
+
+AC_PROG_INSTALL
+AC_PROG_INTLTOOL
+
+
+# checking for Geany
+PKG_CHECK_MODULES(GEANY, [geany >= 0.15])
+PKG_CHECK_MODULES(VTE, [vte >= 0.24])
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
+
+GEANY_VERSION=`$PKG_CONFIG --modversion geany`
+GTK_VERSION=`$PKG_CONFIG --modversion gtk+-2.0`
+
+
+# i18n
+GETTEXT_PACKAGE=geanydebugger
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
+
+ALL_LINGUAS="`sed -e '/^#/d' $srcdir/po/LINGUAS`" # take all languages found in file po/LINGUAS
+
+AM_GLIB_GNU_GETTEXT
+# workaround for intltool bug (http://bugzilla.gnome.org/show_bug.cgi?id=490845)
+if test "x$MSGFMT" = "xno"; then
+ AC_MSG_ERROR([msgfmt not found. Please install the gettext package.])
+fi
+
+# intltool hack to define install_sh on Debian/Ubuntu systems
+if test "x$install_sh" = "x"; then
+ install_sh="`pwd`/install-sh"
+ AC_SUBST(install_sh)
+fi
+
+# get the plugin installed at the correct location for Geany
+# TODO find a way to NOT override --libdir command line option if given
+libdir="`$PKG_CONFIG --variable=libdir geany`/geany"
+
+AC_OUTPUT([
+Makefile
+src/Makefile
+po/Makefile.in
+])
+
+echo "----------------------------------------"
+echo "Install geanydebugger in : ${libdir}"
+echo "Using Geany versio : ${GEANY_VERSION}"
+echo "Using GTK version : ${GTK_VERSION}"
+echo ""
+echo "Configuration is done OK."
+echo ""
Added: trunk/geany-plugins/debugger/indent-all.sh
===================================================================
--- trunk/geany-plugins/debugger/indent-all.sh (rev 0)
+++ trunk/geany-plugins/debugger/indent-all.sh 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,4 @@
+#!/bin/sh
+indent -bli0 -i8 -cli8 -npcs -l100 src/*.c src/*.h
+rm src/*~
+
Property changes on: trunk/geany-plugins/debugger/indent-all.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/po/ChangeLog
===================================================================
--- trunk/geany-plugins/debugger/po/ChangeLog (rev 0)
+++ trunk/geany-plugins/debugger/po/ChangeLog 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,8 @@
+2008-11-07 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * de.po: Update German translation, not yet complete.
+
+
+2008-11-02 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
+
+ * de.po, LINGUAS: Added German translation
Added: trunk/geany-plugins/debugger/po/LINGUAS
===================================================================
--- trunk/geany-plugins/debugger/po/LINGUAS (rev 0)
+++ trunk/geany-plugins/debugger/po/LINGUAS 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,2 @@
+# set of available languages (in alphabetic order)
+ru
Added: trunk/geany-plugins/debugger/po/POTFILES.in
===================================================================
--- trunk/geany-plugins/debugger/po/POTFILES.in (rev 0)
+++ trunk/geany-plugins/debugger/po/POTFILES.in 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,2 @@
+# List of source files containing translatable strings.
+
Added: trunk/geany-plugins/debugger/po/POTFILES.skip
===================================================================
--- trunk/geany-plugins/debugger/po/POTFILES.skip (rev 0)
+++ trunk/geany-plugins/debugger/po/POTFILES.skip 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1 @@
+# List of source files containing translatable strings but should be ignored.
Added: trunk/geany-plugins/debugger/po/ru.po
===================================================================
--- trunk/geany-plugins/debugger/po/ru.po (rev 0)
+++ trunk/geany-plugins/debugger/po/ru.po 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,212 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: geanydbg 0.01\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-01-04 14:13+0300\n"
+"PO-Revision-Date: 2010-12-29 22:39+0300\n"
+"Last-Translator: Alexander Petukhov <Alexander.Petukhov(a)promt.ru>\n"
+"Language-Team: Geany <Alexander.Petukhov(a)mail.ru>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: Russian\n"
+"X-Poedit-Country: RUSSIAN FEDERATION\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+#: ..\src\keys.c:45
+msgid "Run / Continue"
+msgstr "Запустить / Продолжить"
+
+#: ..\src\keys.c:46
+msgid "Stop"
+msgstr "Останов"
+
+#: ..\src\keys.c:47
+msgid "Step into"
+msgstr "Шаг в"
+
+#: ..\src\keys.c:48
+msgid "Step over"
+msgstr "Шаг через"
+
+#: ..\src\keys.c:49
+msgid "Step out"
+msgstr "Шаг из"
+
+#: ..\src\keys.c:50
+msgid "Add / Remove breakpoint"
+msgstr "Добавить / Удалить точку останова"
+
+#: ..\src\keys.c:50
+msgid "Run to cursor"
+msgstr "Выполнить до позиции курсора"
+
+#: ..\src\keys.c:50
+msgid "Jump to the currect instruction"
+msgstr "Перейти к текущей инструкции"
+
+#: ../src/bptree.c:350
+msgid "Enabled"
+msgstr "Активна"
+
+#: ../src/bptree.c:358
+msgid "Hit count"
+msgstr "Кол-во пропусков"
+
+#: ../src/bptree.c:371
+msgid "Condition"
+msgstr "Условие"
+
+#: ../src/bptree.c:380 ../src/stree.c:143
+msgid "File"
+msgstr "Файл"
+
+#: ../src/bptree.c:387 ../src/stree.c:151
+msgid "Line"
+msgstr "Строка"
+
+#: ../src/dbm_gdb.c:253
+msgid "Program received a signal"
+msgstr "Программа получила сигнал"
+
+#: ../src/dbm_gdb.c:420
+msgid "Failed to spawn gdb process"
+msgstr "Ошибка запуска GDB"
+
+#: ../src/dbm_gdb.c:453 ../src/dbm_gdb.c:502
+msgid "Error configuring GDB"
+msgstr "Ошибка установки параметров GDB"
+
+#: ../src/dbm_gdb.c:465
+msgid "Error loading file"
+msgstr "Ошибка загрузки файла"
+
+#: ../src/debug.c:162 ../src/tpage.c:266 ../src/tpage.c:329
+msgid "Delete variable?"
+msgstr "Удалить переменную?"
+
+#: ../src/debug.c:432
+msgid "Locals"
+msgstr "Локальные переменные"
+
+#: ../src/debug.c:447
+msgid "Call Stack"
+msgstr "Трассировка"
+
+#: ../src/debug.c:475
+msgid "Debug terminal"
+msgstr "Терминал"
+
+#: ../src/debug.c:492
+msgid "Debugger messages"
+msgstr "Отладочные сообщения"
+
+#: ../src/debug.c:731
+msgid "Watch"
+msgstr "Наблюдение"
+
+#: ../src/debug.c:827
+#, c-format
+msgid ""
+"Breakpoint at %s:%i cannot be set\n"
+"Debugger message: %s"
+msgstr ""
+"Точка останова %s:%i не может быть установлена\n"
+"Сообщение отладчика: %s"
+
+#: ../src/keys.c:69 ../src/plugin.c:45
+msgid "Debugger"
+msgstr "Отладчик"
+
+#: ../src/plugin.c:45
+msgid "Various debuggers integration."
+msgstr "Поддержка отладчиков."
+
+#: ../src/plugin.c:85 ../src/tpage.c:787
+msgid "Target"
+msgstr "Цель"
+
+#: ../src/plugin.c:91
+msgid "Breakpoints"
+msgstr "Точки останова"
+
+#: ../src/plugin.c:107
+msgid "Debug"
+msgstr "Отладка"
+
+#: ../src/stree.c:127
+msgid "Address"
+msgstr "Адрес"
+
+#: ../src/stree.c:135
+msgid "Function"
+msgstr "Функция"
+
+#: ../src/tpage.c:450
+msgid "Config saved successfully"
+msgstr "Настройки сохранены"
+
+#: ../src/tpage.c:487 ../src/tpage.c:572
+msgid "Error reading config file"
+msgstr "Ошибка чтения настроек"
+
+#: ../src/tpage.c:500
+#, c-format
+msgid "Configuration error: debugger module '%s' is not found"
+msgstr "Ошибка конфигурации: модуль отладчика '%s' не найден"
+
+#: ../src/tpage.c:577
+msgid "Some breakpoints can't be set as the files are missed"
+msgstr ""
+"Некоторые точки останова не могут быть установлены, т.к. отсутствуют "
+"соответствующие файлы"
+
+#: ../src/tpage.c:584
+msgid "Config loaded successfully"
+msgstr "Настройки загружены успешно"
+
+#: ../src/tpage.c:620
+msgid "Choose target file"
+msgstr "Выберите файл"
+
+#: ../src/tpage.c:795
+msgid "Browse"
+msgstr "Обзор"
+
+#: ../src/tpage.c:807
+msgid "Debugger:"
+msgstr "Отладчик:"
+
+#: ../src/tpage.c:830
+msgid "Arguments"
+msgstr "Аргументы"
+
+#: ../src/tpage.c:845
+msgid "Environment variables"
+msgstr "Переменные окружения"
+
+#: ../src/tpage.c:863 ../src/vtree.c:104
+msgid "Name"
+msgstr "Имя"
+
+#: ../src/tpage.c:872 ../src/vtree.c:119
+msgid "Value"
+msgstr "Значение"
+
+#: ../src/vtree.c:128
+msgid "Type"
+msgstr "Тип"
+
+#: ../src/watch_model.c:159
+msgid "Can't evaluate expression"
+msgstr "Не могу вычислить выражение"
+
+#: ../src/callbacks.c:165
+msgid "To edit source files stop debugging session"
+msgstr "Остановите отладку чтобы редактировать файлы"
Added: trunk/geany-plugins/debugger/src/Makefile.am
===================================================================
--- trunk/geany-plugins/debugger/src/Makefile.am (rev 0)
+++ trunk/geany-plugins/debugger/src/Makefile.am 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,41 @@
+
+lib_LTLIBRARIES = debugger.la
+debugger_la_SOURCES = \
+ bptree.c \
+ bptree.h \
+ breakpoint.c \
+ breakpoint.h \
+ breakpoints.c \
+ breakpoints.h \
+ callbacks.c \
+ callbacks.h \
+ dbm_gdb.c \
+ debug.c \
+ debug.h \
+ debug_module.c \
+ debug_module.h \
+ keys.c \
+ keys.h \
+ ltree.c \
+ ltree.h \
+ markers.c \
+ markers.h \
+ plugin.c \
+ stree.c \
+ stree.h \
+ tpage.c \
+ tpage.h \
+ utils.c \
+ utils.h \
+ vtree.c \
+ vtree.h \
+ watch_model.c \
+ watch_model.h \
+ wtree.c \
+ wtree.h
+
+debugger_la_LDFLAGS = -module -avoid-version
+debugger_la_LIBADD = @GEANY_LIBS@ $(INTLLIBS) -lutil
+
+AM_CFLAGS = @GEANY_CFLAGS@ -DLOCALEDIR=\""$(localedir)"\" -DPREFIX=\""$(prefix)"\"
+
Added: trunk/geany-plugins/debugger/src/bptree.c
===================================================================
--- trunk/geany-plugins/debugger/src/bptree.c (rev 0)
+++ trunk/geany-plugins/debugger/src/bptree.c 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,514 @@
+/*
+ * bptree.c
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+/*
+ * Contains breakpoints GtkTreeView manipulating functions
+ * and handlers for tree view events.
+ * Handlers only collect data from the tree and call
+ * corresponding breaks_set_.... functions, which call
+ * bptree_set... if breakpoint has been changed altered/added/removed
+ */
+
+#include <memory.h>
+
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "geanyplugin.h"
+
+#include "breakpoint.h"
+#include "breakpoints.h"
+#include "bptree.h"
+#include "utils.h"
+
+/* columns minumum width in characters */
+#define MW_ENABLED 3
+#define MW_HITSCOUNT 3
+#define MW_CONDITION 20
+#define MW_FILE 0
+#define MW_LINE 4
+
+/* Tree view columns */
+enum
+{
+ ENABLED,
+ HITSCOUNT,
+ CONDITION,
+ FILEPATH,
+ LINE,
+ N_COLUMNS
+};
+
+/* tree view and store handles */
+static GtkWidget *tree = NULL;
+static GtkTreeModel *model = NULL;
+static GtkListStore *store = NULL;
+
+/* column cell renderes */
+static GtkCellRenderer *enable_renderer;
+static GtkCellRenderer *hcount_renderer;
+static GtkCellRenderer *condition_renderer;
+
+/* tells to checkbox click handler whether page is in readonly mode (debug running) */
+static gboolean readonly = FALSE;
+
+/* callback handler */
+move_to_line_cb on_break_clicked = NULL;
+
+/*
+ * GtkTreeView event handlers
+ */
+
+/*
+ * double click
+ */
+void on_row_double_click(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data)
+{
+ GtkTreeIter iter;
+ gboolean res = gtk_tree_model_get_iter (
+ model,
+ &iter,
+ path);
+
+ gchar *file;
+ int line;
+ gtk_tree_model_get (
+ model,
+ &iter,
+ FILEPATH, &file,
+ LINE, &line,
+ -1);
+
+ /* use callback, supplied in bptree_init */
+ on_break_clicked(file, line);
+
+ g_free(file);
+}
+
+/*
+ * editing "condition" column value finished
+ */
+void on_condition_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data)
+{
+ GtkTreeIter iter;
+ GtkTreePath *tree_path = gtk_tree_path_new_from_string (path);
+
+ gboolean res = gtk_tree_model_get_iter (
+ model,
+ &iter,
+ tree_path);
+
+ gchar *file;
+ int line;
+ gchar* oldcondition;
+ gtk_tree_model_get (
+ model,
+ &iter,
+ CONDITION, &oldcondition,
+ FILEPATH, &file,
+ LINE, &line,
+ -1);
+
+ if (strcmp(oldcondition, new_text))
+ breaks_set_condition(file, line, new_text);
+
+ gtk_tree_path_free(tree_path);
+ g_free(file);
+ g_free(oldcondition);
+}
+
+/*
+ * editing "hitscount" column value finished
+ */
+void on_hitscount_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data)
+{
+ int count = atoi(new_text);
+ if (!count && strcmp(new_text, "0"))
+ return;
+
+ GtkTreeIter iter;
+ GtkTreePath *tree_path = gtk_tree_path_new_from_string (path);
+
+ gboolean res = gtk_tree_model_get_iter (
+ model,
+ &iter,
+ tree_path);
+
+ gchar *file;
+ int line;
+ gint oldcount;
+ gtk_tree_model_get (
+ model,
+ &iter,
+ HITSCOUNT, &oldcount,
+ FILEPATH, &file,
+ LINE, &line,
+ -1);
+
+ if (oldcount != count)
+ breaks_set_hits_count(file, line, count);
+
+ gtk_tree_path_free(tree_path);
+ g_free(file);
+}
+
+/*
+ * "Enabled" checkbox has been clicked
+ */
+void on_activeness_changed(GtkCellRendererToggle *cell_renderer, gchar *path, gpointer user_data)
+{
+ /* do not process event is page is readonly (debug is running) */
+ if (readonly)
+ return;
+
+ GtkTreeIter iter;
+ GtkTreePath *tree_path = gtk_tree_path_new_from_string (path);
+
+ gboolean res = gtk_tree_model_get_iter (
+ model,
+ &iter,
+ tree_path);
+
+ gchar *file;
+ int line;
+ gtk_tree_model_get (
+ model,
+ &iter,
+ FILEPATH, &file,
+ LINE, &line,
+ -1);
+
+ breaks_switch(file, line);
+
+ gtk_tree_path_free(tree_path);
+ g_free(file);
+}
+
+/*
+ * key pressed event
+ */
+static gboolean on_key_pressed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ guint keyval = ((GdkEventKey*)event)->keyval;
+
+ if (keyval == GDK_Delete)
+ {
+ /* "delete selected rows" */
+
+ /* path to select after deleteing finishes */
+ GtkTreeRowReference *reference_to_select = NULL;
+
+ /* get selected rows */
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
+ GList *rows = gtk_tree_selection_get_selected_rows(selection, &model);
+
+ /* get references to rows to keep references actual when altering model */
+ GList *references = NULL;
+ GList *iter = rows;
+ while (iter)
+ {
+ GtkTreePath *path = (GtkTreePath*)iter->data;
+ references = g_list_append(references, gtk_tree_row_reference_new(model, path));
+
+ /*
+ * set reference to select after deletion - upper sibling of the
+ * first row to delete that has upper sibling
+ */
+ if (!reference_to_select && gtk_tree_path_prev(path))
+ reference_to_select = gtk_tree_row_reference_new(model, path);
+
+ iter = iter->next;
+ }
+
+ /* free rows list */
+ g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (rows);
+
+ /* iterate through references removing them */
+ iter = references;
+ while (iter)
+ {
+ GtkTreeRowReference *reference = (GtkTreeRowReference*)iter->data;
+ if (gtk_tree_row_reference_valid(reference))
+ {
+ GtkTreePath *path = gtk_tree_row_reference_get_path(reference);
+ if (1 == gtk_tree_path_get_depth(path))
+ {
+ GtkTreeIter titer;
+ gtk_tree_model_get_iter(model, &titer, path);
+
+ gchar *filename = NULL;
+ gint line;
+
+ gtk_tree_model_get (
+ model,
+ &titer,
+ FILEPATH, &filename,
+ LINE, &line,
+ -1);
+
+ breaks_remove(filename, line);
+
+ g_free(filename);
+ }
+ }
+
+ iter = iter->next;
+ }
+
+ /* get path to select */
+ GtkTreePath *path = NULL;
+ if (reference_to_select)
+ path = gtk_tree_row_reference_get_path(reference_to_select);
+ else
+ {
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter_first(model, &iter);
+ path = gtk_tree_model_get_path(model, &iter);
+ }
+
+ /* set selection if any */
+ if (path)
+ {
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(widget), path, NULL, TRUE, 0.5, 0.5);
+ gtk_tree_path_free(path);
+ }
+
+ /* free references list */
+ g_list_foreach (references, (GFunc)gtk_tree_row_reference_free, NULL);
+ g_list_free (references);
+ }
+
+
+ return FALSE;
+}
+
+/*
+ * Interface functions
+ */
+
+/*
+ * init breaks tree view and return it if succesfull
+ * arguments:
+ * cb - callback to call on treeview double click
+ */
+gboolean bptree_init(move_to_line_cb cb)
+{
+ /* save double click callback */
+ on_break_clicked = cb;
+
+ /* create tree view */
+ store = gtk_list_store_new (
+ N_COLUMNS,
+ G_TYPE_BOOLEAN,
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INT);
+ model = GTK_TREE_MODEL(store);
+ tree = gtk_tree_view_new_with_model (model);
+
+ /* set tree view properties */
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), 1);
+ gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(tree), GTK_TREE_VIEW_GRID_LINES_VERTICAL);
+ /* multiple selection */
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
+ /* interlaced rows colors */
+ g_object_set(tree, "rules-hint", TRUE, NULL);
+
+ /* connect signals */
+ g_signal_connect(G_OBJECT(tree), "key-press-event", G_CALLBACK (on_key_pressed), NULL);
+ g_signal_connect(G_OBJECT(tree), "row-activated", G_CALLBACK (on_row_double_click), NULL);
+
+ /* creating columns */
+ GtkTreeViewColumn *column;
+ gchar *header;
+
+ int char_width = get_char_width(tree);
+
+ /* enabled */
+ header = _("Enabled");
+ enable_renderer = gtk_cell_renderer_toggle_new ();
+ g_signal_connect (G_OBJECT(enable_renderer), "toggled", G_CALLBACK(on_activeness_changed), NULL);
+ column = create_column(header, enable_renderer, FALSE,
+ get_header_string_width(header, MW_ENABLED, char_width),
+ "active", ENABLED);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+ /* hits count */
+ header = _("Hit count");
+ hcount_renderer = gtk_cell_renderer_spin_new ();
+ GtkAdjustment* adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 100000.0, 1.0, 2.0, 2.0));
+ g_object_set (hcount_renderer,
+ "editable", TRUE,
+ "adjustment", adj,
+ "digits", 0, NULL);
+ g_signal_connect (G_OBJECT (hcount_renderer), "edited", G_CALLBACK (on_hitscount_changed), NULL);
+ column = create_column(header, hcount_renderer, FALSE,
+ get_header_string_width(header, MW_HITSCOUNT, char_width),
+ "text", HITSCOUNT);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+ /* condition */
+ header = _("Condition");
+ condition_renderer = gtk_cell_renderer_text_new ();
+ g_object_set (condition_renderer, "editable", TRUE, NULL);
+ g_signal_connect (G_OBJECT (condition_renderer), "edited", G_CALLBACK (on_condition_changed), NULL);
+ column = create_column(header, condition_renderer, FALSE,
+ get_header_string_width(header, MW_CONDITION, char_width),
+ "text", CONDITION);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+ /* file */
+ header = _("File");
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+ column = create_column(header, renderer, TRUE,
+ get_header_string_width(header, MW_FILE, char_width),
+ "text", FILEPATH);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+ /* line */
+ header = _("Line");
+ renderer = gtk_cell_renderer_text_new ();
+ column = create_column(header, renderer, FALSE,
+ get_header_string_width(header, MW_LINE, char_width),
+ "text", LINE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+
+ return TRUE;
+}
+
+/*
+ * enable/disable break
+ * arguments:
+ * iter - tree view iterator
+ * enabled - value
+ */
+void bptree_set_enabled(GtkTreeIter iter, gboolean enabled)
+{
+ gtk_list_store_set(store, &iter, ENABLED, enabled, -1);
+}
+
+/*
+ * set breaks hits count
+ * arguments:
+ * iter - tree view iterator
+ * hitscount - value
+ */
+void bptree_set_hitscount(GtkTreeIter iter, int hitscount)
+{
+ gtk_list_store_set(store, &iter, HITSCOUNT, hitscount, -1);
+}
+
+/*
+ * set breaks condition
+ * arguments:
+ * iter - tree view iterator
+ * condition - value
+ */
+void bptree_set_condition(GtkTreeIter iter, gchar* condition)
+{
+ gtk_list_store_set(store, &iter, CONDITION, condition, -1);
+}
+
+/*
+ * get breaks condition
+ * arguments:
+ * iter - tree view iterator
+ * return value - breaks condition
+ */
+gchar* bptree_get_condition(GtkTreeIter iter)
+{
+ gchar *condition;
+ gtk_tree_model_get (
+ model,
+ &iter,
+ CONDITION, &condition,
+ -1);
+
+ return condition;
+}
+
+/*
+ * set tree view accessible / inaccessible to user input
+ * arguments:
+ * value - new value
+ */
+void bptree_set_readonly(gboolean value)
+{
+ readonly = value;
+ g_object_set (hcount_renderer, "editable", !readonly, NULL);
+ g_object_set (condition_renderer, "editable", !readonly, NULL);
+}
+
+/*
+ * get tree view widget
+ * return value - tree view widget
+ */
+GtkWidget* bptree_get_widget()
+{
+ return tree;
+}
+
+/*
+ * add new breakpoint to the tree view
+ * arguments:
+ * bp - breakpoint to add
+ */
+void bptree_add_breakpoint(breakpoint* bp)
+{
+ GtkTreeIter iter;
+ gtk_list_store_prepend (store, &iter);
+ gtk_list_store_set (store, &iter,
+ ENABLED, bp->enabled,
+ HITSCOUNT, bp->hitscount,
+ CONDITION, bp->condition,
+ FILEPATH, bp->file,
+ LINE, bp->line,
+ -1);
+ bp->iter = iter;
+}
+
+/*
+ * update existing breakpoint
+ * arguments:
+ * bp - breakpoint to update
+ */
+void bptree_update_breakpoint(breakpoint* bp)
+{
+ char file_and_line[FILENAME_MAX + 10];
+ sprintf(file_and_line, "%s:%i", bp->file, bp->line);
+ gtk_list_store_set (store, &bp->iter,
+ ENABLED, bp->enabled,
+ HITSCOUNT, bp->hitscount,
+ CONDITION, bp->condition,
+ FILEPATH, bp->file,
+ LINE, bp->line,
+ -1);
+}
+
+/*
+ * remove breakpoint
+ * arguments:
+ * bp - breakpoint to revove
+ */
+void bptree_remove_breakpoint(breakpoint* bp)
+{
+ gtk_list_store_remove(store, &(bp->iter));
+}
Property changes on: trunk/geany-plugins/debugger/src/bptree.c
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/bptree.h
===================================================================
--- trunk/geany-plugins/debugger/src/bptree.h (rev 0)
+++ trunk/geany-plugins/debugger/src/bptree.h 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,31 @@
+/*
+ * bptree.h
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+gboolean bptree_init(move_to_line_cb callback);
+GtkWidget* bptree_get_widget();
+void bptree_add_breakpoint(breakpoint* bp);
+void bptree_update_breakpoint(breakpoint* bp);
+void bptree_remove_breakpoint(breakpoint* bp);
+void bptree_set_condition(GtkTreeIter iter, gchar* condition);
+void bptree_set_hitscount(GtkTreeIter iter, int hitscount);
+void bptree_set_enabled(GtkTreeIter iter, gboolean enabled);
+gchar* bptree_get_condition(GtkTreeIter iter);
+void bptree_set_readonly(gboolean readonly);
Property changes on: trunk/geany-plugins/debugger/src/bptree.h
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/breakpoint.c
===================================================================
--- trunk/geany-plugins/debugger/src/breakpoint.c (rev 0)
+++ trunk/geany-plugins/debugger/src/breakpoint.c 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,63 @@
+/*
+ * breakpoint.c
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+/*
+ * Functions for creating new breakpoints.
+ */
+
+#include <gtk/gtk.h>
+#include <memory.h>
+#include "breakpoint.h"
+
+/*
+ * create new empty breakpoint
+ */
+breakpoint* break_new()
+{
+ breakpoint* bp = (breakpoint*)g_malloc(sizeof(breakpoint));
+ memset(bp, 0 , sizeof(breakpoint));
+
+ return bp;
+}
+
+/*
+ * create new breakpoint with parameters
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ * condition - breakpoints line
+ * enabled - is new breakpoint enabled
+ * hitscount - breakpoints hitscount
+*/
+breakpoint* break_new_full(char* file, int line, char* condition, int enabled, int hitscount)
+{
+ breakpoint* bp = break_new();
+ strcpy(bp->file, file);
+ bp->line = line;
+ if (condition)
+ strcpy(bp->condition, condition);
+ bp->enabled = enabled;
+ bp->hitscount = hitscount;
+
+ return bp;
+}
+
+
Property changes on: trunk/geany-plugins/debugger/src/breakpoint.c
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/breakpoint.h
===================================================================
--- trunk/geany-plugins/debugger/src/breakpoint.h (rev 0)
+++ trunk/geany-plugins/debugger/src/breakpoint.h 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,36 @@
+/*
+ * breakpoint.h
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+/* maximum condition length */
+#define CONDITION_MAX_LENGTH 1024
+
+/* structure describing a breakpoint */
+typedef struct _breakpoint {
+ gboolean enabled;
+ gchar file[FILENAME_MAX];
+ gint line;
+ gchar condition[CONDITION_MAX_LENGTH + 1];
+ gint hitscount;
+ GtkTreeIter iter;
+} breakpoint;
+
+breakpoint* break_new();
+breakpoint* break_new_full(char* file, int line, char* condition, int enabled, int hitscount);
Property changes on: trunk/geany-plugins/debugger/src/breakpoint.h
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/breakpoints.c
===================================================================
--- trunk/geany-plugins/debugger/src/breakpoints.c (rev 0)
+++ trunk/geany-plugins/debugger/src/breakpoints.c 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,476 @@
+/*
+ * breakpoints.c
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+/*
+ * Functions for manipulatins breakpoints and quering breakpoints state.
+ * Modifying functions do all job regarding markers and
+ * entries in breaks tree view in the debugger panel
+ */
+
+#include <string.h>
+
+#include "geanyplugin.h"
+extern GeanyFunctions *geany_functions;
+
+#include "breakpoint.h"
+#include "breakpoints.h"
+#include "utils.h"
+#include "markers.h"
+#include "debug.h"
+#include "bptree.h"
+
+/* container for break-for-file g_tree GTree-s */
+GHashTable* files = NULL;
+
+/*
+ * Functions for breakpoint iteration support
+ */
+
+/*
+ * Iterates through GTree for the particular file
+ */
+gboolean tree_foreach(gpointer key, gpointer value, gpointer data)
+{
+ ((breaks_iterate_function)data)(value);
+ return FALSE;
+}
+
+/*
+ * Iterates through hash table of GTree-s
+ */
+void hash_table_foreach(gpointer key, gpointer value, gpointer user_data)
+{
+ g_tree_foreach((GTree*)value, tree_foreach, user_data);
+}
+
+/*
+ * Helper functions
+ */
+
+/*
+ * lookup for breakpoint
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ */
+breakpoint* lookup_breakpoint(gchar* file, int line)
+{
+ breakpoint* bp = NULL;
+ GTree* tree = NULL;
+ if (tree = (GTree*)g_hash_table_lookup(files, file))
+ bp = g_tree_lookup(tree, (gconstpointer)line);
+
+ return bp;
+}
+
+/*
+ * compare pointers as integers
+ * return value similar to strcmp
+ * arguments:
+ * a - first integer
+ * b - second integer
+ * user_data - not used
+ */
+gint compare_func(gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ if (a == b)
+ return 0;
+ else
+ return a > b ? 1 : -1;
+}
+
+/*
+ * Handlers for breakpoints activities.
+ * Are called directly from breaks_set_... functions
+ * or from async_callback if break was set asyncronously.
+ *
+ */
+
+/*
+ * handles new break creation
+ * arguments:
+ * bp - breakpoint to handle
+ * success - success of operation
+ */
+void handle_break_new(breakpoint* bp, gboolean success)
+{
+ if (success)
+ {
+ /* add to breakpoints tab */
+ bptree_add_breakpoint(bp);
+ /* add marker */
+ markers_add_breakpoint(bp);
+ }
+ else
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR, debug_error_message());
+}
+
+/*
+ * handles break removing
+ * arguments:
+ * bp - breakpoint to handle
+ * success - success of operation
+ */
+void handle_break_remove(breakpoint* bp, gboolean success)
+{
+ if (success)
+ {
+ /* remove marker */
+ markers_remove_breakpoint(bp);
+ /* remove from breakpoints tab */
+ bptree_remove_breakpoint(bp);
+ /* remove from internal storage */
+ GTree *tree = g_hash_table_lookup(files,bp->file);
+ g_tree_remove(tree, (gconstpointer)bp->line);
+ }
+ else
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR, debug_error_message());
+}
+
+/*
+ * handles breakpoints hits count set
+ * arguments:
+ * bp - breakpoint to handle
+ * success - success of operation
+ */
+void handle_hitscount_set(breakpoint* bp, gboolean success)
+{
+ if (success)
+ bptree_set_hitscount(bp->iter, bp->hitscount);
+ else
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR, debug_error_message());
+}
+
+/*
+ * handles breakpoints condition set
+ * arguments:
+ * bp - breakpoint to handle
+ * success - success of operation
+ */
+void handle_condition_set(breakpoint* bp, gboolean success)
+{
+ if (success)
+ {
+ /* set condition in breaks tree */
+ bptree_set_condition(bp->iter, bp->condition);
+ }
+ else
+ {
+ /* revert to old condition (taken from tree) */
+ gchar* oldcondition = bptree_get_condition(bp->iter);
+ strcpy(bp->condition, oldcondition);
+ g_free(oldcondition);
+ /* show error message */
+ dialogs_show_msgbox(GTK_MESSAGE_ERROR, debug_error_message());
+ }
+}
+
+/*
+ * handles breakpoints enabled/disabled switch
+ * arguments:
+ * bp - breakpoint to handle
+ * success - success of operation
+ */
+void handle_switch(breakpoint* bp, gboolean success)
+{
+ /* remove old and set new marker */
+ if (bp->enabled)
+ {
+ markers_remove_breakpoint_disabled(bp->file, bp->line);
+ markers_add_breakpoint(bp);
+ }
+ else
+ {
+ markers_remove_breakpoint(bp);
+ markers_add_breakpoint_disabled(bp->file, bp->line);
+ }
+ /* set checkbox in breaks tree */
+ bptree_set_enabled(bp->iter, bp->enabled);
+}
+
+/*
+ * Async action callback.
+ * Called from debug module, when debugging session is interrupted
+ * and ready to perform action specified by "bsa" with "bp" breakpoint
+ * (activity type is passed to debug module when calling its "request_interrupt" function
+ * and then is passed to "async_callback")
+ * arguments:
+ * bp - breakpoint to handle
+ * bsa - type of activity (remove/add/change property)
+ */
+void async_callback(breakpoint* bp, break_set_activity bsa)
+{
+ /* perform requested operation */
+ gboolean success = BSA_REMOVE == bsa ? debug_remove_break(bp) : debug_set_break(bp, bsa);
+
+ /* handle relevant case */
+ if (BSA_REMOVE == bsa)
+ handle_break_remove(bp, success);
+ else if (BSA_NEW_BREAK == bsa)
+ handle_break_new(bp, success);
+ else if (BSA_UPDATE_ENABLE == bsa)
+ handle_switch(bp, success);
+ else if (BSA_UPDATE_HITS_COUNT == bsa)
+ handle_hitscount_set(bp, success);
+ else if (BSA_UPDATE_CONDITION == bsa)
+ handle_condition_set(bp, success);
+
+ /* resume debug session */
+ debug_run();
+}
+
+/*
+ * Init breaks related data.
+ * arguments:
+ * cb - callback to call on breakpoints tree view double click
+ */
+gboolean breaks_init(move_to_line_cb cb)
+{
+ /* create breakpoints storage */
+ files = g_hash_table_new_full(
+ g_str_hash,
+ g_str_equal,
+ (GDestroyNotify)g_free,
+ (GDestroyNotify)g_tree_destroy);
+
+ /* create breaks tab page control */
+ bptree_init(cb);
+
+ return TRUE;
+}
+
+/*
+ * Frees breaks related data.
+ */
+void breaks_destroy()
+{
+ /* remove all markers */
+ breaks_iterate((breaks_iterate_function)markers_remove_breakpoint);
+ /* free storage */
+ g_hash_table_destroy(files);
+}
+
+/*
+ * Add new breakpoint.
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ * condition - breakpoints line
+ * enabled - is new breakpoint enabled
+ * hitscount - breakpoints hitscount
+ */
+void breaks_add(char* file, int line, char* condition, int enabled, int hitscount)
+{
+ /* do not process async break manipulation on modules
+ that do not support async interuppt */
+ enum dbs state = debug_get_state();
+ if (DBS_RUNNING == state && !debug_supports_async_breaks())
+ return;
+
+ /* allocate memory */
+ breakpoint* bp = break_new_full(file, line, condition, enabled, hitscount);
+
+ /* check whether GTree for this file exists and create if not*/
+ GTree *tree;
+ if (!(tree = g_hash_table_lookup(files, bp->file)))
+ {
+ char *newfile = g_strdup(bp->file);
+ tree = g_tree_new_full(compare_func, NULL, NULL, (GDestroyNotify)g_free);
+ g_hash_table_insert(files, newfile, tree);
+ }
+
+ /* insert to internal storage */
+ g_tree_insert(tree, (gpointer)bp->line, (gpointer)bp);
+
+ /* handle creation instantly if debugger is idle or stopped
+ and request debug module interruption overwise */
+ if (DBS_IDLE == state || DBS_STOPPED == state)
+ handle_break_new(bp, DBS_IDLE == state || debug_set_break(bp, BSA_NEW_BREAK));
+ else if (DBS_STOP_REQUESTED != state)
+ debug_request_interrupt(async_callback, bp, BSA_NEW_BREAK);
+}
+
+/*
+ * Remove breakpoint.
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ */
+void breaks_remove(char* file, int line)
+{
+ /* do not process async break manipulation on modules
+ that do not support async interuppt */
+ enum dbs state = debug_get_state();
+ if (DBS_RUNNING == state && !debug_supports_async_breaks())
+ return;
+
+ /* lookup for breakpoint */
+ breakpoint* bp = NULL;
+ if (!(bp = lookup_breakpoint(file, line)))
+ return;
+
+ /* handle removing instantly if debugger is idle or stopped
+ and request debug module interruption overwise */
+ if (DBS_IDLE == state || DBS_STOPPED == state)
+ handle_break_remove(bp, DBS_IDLE == state || debug_remove_break(bp));
+ else if (DBS_STOP_REQUESTED != state)
+ debug_request_interrupt(async_callback, bp, BSA_REMOVE);
+}
+
+/*
+ * Switch breakpoints state.
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ */
+void breaks_switch(char* file, int line)
+{
+ /* do not process async break manipulation on modules
+ that do not support async interuppt */
+ enum dbs state = debug_get_state();
+ if (DBS_RUNNING == state && !debug_supports_async_breaks())
+ return;
+
+ /* lookup for breakpoint */
+ breakpoint* bp = NULL;
+ if (!(bp = lookup_breakpoint(file, line)))
+ return;
+
+ /* change activeness */
+ bp->enabled = !bp->enabled;
+
+ /* handle switching instantly if debugger is idle or stopped
+ and request debug module interruption overwise */
+ if (DBS_IDLE == state || DBS_STOPPED == state)
+ handle_switch(bp, state == DBS_IDLE || debug_set_break(bp, BSA_UPDATE_ENABLE));
+ else if (DBS_STOP_REQUESTED != state)
+ debug_request_interrupt(async_callback, bp, BSA_UPDATE_ENABLE);
+}
+
+/*
+ * Set breakpoints hits count.
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ * count - breakpoints hitscount
+ */
+void breaks_set_hits_count(char* file, int line, int count)
+{
+ /* do not process async break manipulation on modules
+ that do not support async interuppt */
+ enum dbs state = debug_get_state();
+ if (DBS_RUNNING == state && !debug_supports_async_breaks())
+ return;
+
+ /* lookup for breakpoint */
+ breakpoint* bp = NULL;
+ if (!(bp = lookup_breakpoint(file, line)))
+ return;
+
+ /* change hits count */
+ bp->hitscount = count;
+
+ /* handle setting hits count instantly if debugger is idle or stopped
+ and request debug module interruption overwise */
+ if (state == DBS_IDLE || state == DBS_STOPPED)
+ handle_hitscount_set(bp, state == DBS_IDLE || debug_set_break(bp, BSA_UPDATE_HITS_COUNT));
+ else if (state != DBS_STOP_REQUESTED)
+ debug_request_interrupt(async_callback, bp, BSA_UPDATE_HITS_COUNT);
+}
+
+/*
+ * Set breakpoints condition.
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ * condition - breakpoints line
+ */
+void breaks_set_condition(char* file, int line, char* condition)
+{
+ /* do not process async break manipulation on modules
+ that do not support async interuppt */
+ enum dbs state = debug_get_state();
+ if (DBS_RUNNING == state && !debug_supports_async_breaks())
+ return;
+
+ /* lookup for breakpoint */
+ breakpoint* bp = NULL;
+ if (!(bp = lookup_breakpoint(file, line)))
+ return;
+
+ /* change condition */
+ strcpy(bp->condition, condition);
+
+ /* handle setting condition instantly if debugger is idle or stopped
+ and request debug module interruption overwise */
+ if (state == DBS_IDLE || state == DBS_STOPPED)
+ handle_condition_set(bp, DBS_IDLE == state || debug_set_break(bp, BSA_UPDATE_CONDITION));
+ else if (state != DBS_STOP_REQUESTED)
+ debug_request_interrupt(async_callback, bp, BSA_UPDATE_CONDITION);
+}
+
+/*
+ * Checks whether breakpoint is set.
+ * arguments:
+ * file - breakpoints filename
+ * line - breakpoints line
+ */
+gboolean breaks_is_set(char* file, int line)
+{
+ /* first look for the tree for the given file */
+ GTree *tree;
+ if (!(tree = g_hash_table_lookup(files, file)))
+ return FALSE;
+ else
+ {
+ /* lookup for the break in GTree*/
+ gpointer p = g_tree_lookup(tree, (gconstpointer)line);
+ return p && ((breakpoint*)p)->enabled;
+ }
+}
+
+/*
+ * Get breakpoints GTree for the given file
+ * arguments:
+ * file - file name to get breaks for
+ */
+GTree *breaks_get_for_document(char* file)
+{
+ return g_hash_table_lookup(files, file);
+}
+
+/*
+ * Get breakpoints widget
+ */
+GtkWidget* breaks_get_widget()
+{
+ return bptree_get_widget();
+}
+
+/*
+ * Calls specified function on every breakpoint
+ * arguments:
+ * bif - function to call
+ */
+void breaks_iterate(breaks_iterate_function bif)
+{
+ g_hash_table_foreach(files, hash_table_foreach, (gpointer)bif);
+}
Property changes on: trunk/geany-plugins/debugger/src/breakpoints.c
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/breakpoints.h
===================================================================
--- trunk/geany-plugins/debugger/src/breakpoints.h (rev 0)
+++ trunk/geany-plugins/debugger/src/breakpoints.h 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,35 @@
+/*
+ * breakpoints.h
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+typedef void (*move_to_line_cb)(char* file, int line);
+typedef void (*breaks_iterate_function)(void* bp);
+
+gboolean breaks_init(move_to_line_cb callback);
+void breaks_destroy();
+void breaks_add(char* file, int line, char* condition, int enable, int hitscount);
+void breaks_remove(char* file, int line);
+void breaks_switch(char* file, int line);
+void breaks_set_hits_count(char* file, int line, int count);
+void breaks_set_condition(char* file, int line, char* condition);
+void breaks_iterate(breaks_iterate_function bif);
+gboolean breaks_is_set(char* file, int line);
+GtkWidget* breaks_get_widget();
+GTree* breaks_get_for_document(char* file);
Property changes on: trunk/geany-plugins/debugger/src/breakpoints.h
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/callbacks.c
===================================================================
--- trunk/geany-plugins/debugger/src/callbacks.c (rev 0)
+++ trunk/geany-plugins/debugger/src/callbacks.c 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,233 @@
+/*
+ * callbacks.c
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+/*
+ * Contains callbacks for the user actions as well
+ * as for the Geany events
+ */
+
+#include <string.h>
+
+#include "geanyplugin.h"
+#include "breakpoint.h"
+#include "breakpoints.h"
+#include "debug.h"
+#include "keys.h"
+#include "tpage.h"
+#include "stree.h"
+#include "utils.h"
+
+extern GeanyFunctions *geany_functions;
+
+/*
+ * Following group of callbacks are used for
+ * checking of existance of the config file
+ * and changing buttons state in the target page
+ */
+
+/*
+ * Occures on closing document
+ */
+void on_document_close(GObject *obj, GeanyDocument *doc, gpointer user_data)
+{
+ tpage_on_document_close();
+}
+
+/*
+ * Occures on saving document
+ */
+void on_document_save(GObject *obj, GeanyDocument *doc, gpointer user_data)
+{
+ tpage_on_document_activate(doc);
+}
+
+/*
+ * Occures on new document creating
+ */
+void on_document_new(GObject *obj, GeanyDocument *doc, gpointer user_data)
+{
+}
+
+/*
+ * Occures on document activating
+ */
+void on_document_activate(GObject *obj, GeanyDocument *doc, gpointer user_data)
+{
+ tpage_on_document_activate(doc);
+}
+
+/*
+ * Occures on document opening.
+ * Used to set breaks markers
+ */
+void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data)
+{
+ char* file = DOC_FILENAME(doc);
+ /*set markers*/
+ markers_set_for_document(doc->editor->sci);
+
+ /*set dwell interval*/
+ scintilla_send_message(doc->editor->sci, SCI_SETMOUSEDWELLTIME, 500, 0);
+
+ /* set caret policy */
+ scintilla_send_message(doc->editor->sci, SCI_SETYCARETPOLICY, CARET_SLOP | CARET_JUMPS | CARET_EVEN , 3);
+
+ /* check if current path contains config file */
+ tpage_on_document_activate(doc);
+
+ GTree *tree;
+ if (tree = breaks_get_for_document(file))
+ g_tree_foreach(tree, tree_foreach_set_marker, NULL);
+
+ /* if debug is active - tell the debug module that a file was opened */
+ if (DBS_IDLE != debug_get_state())
+ debug_on_file_open(doc);
+}
+
+/*
+ * Occures on notify from editor.
+ * Handles margin click to set/remove breakpoint
+ */
+gboolean on_editor_notify(
+ GObject *object, GeanyEditor *editor,
+ SCNotification *nt, gpointer data)
+{
+ switch (nt->nmhdr.code)
+ {
+ case SCN_MARGINCLICK:
+ {
+ if (1 != nt->margin)
+ break;
+
+ char* file = editor->document->file_name;
+ int line = sci_get_line_from_position(editor->sci, nt->position) + 1;
+
+ if (!breaks_is_set(file, line))
+ breaks_add(file, line, NULL, TRUE, 0);
+ else
+ breaks_remove(file, line);
+
+ scintilla_send_message(editor->sci, SCI_SETFOCUS, TRUE, 0);
+
+ return TRUE;
+ }
+ case SCN_DWELLSTART:
+ {
+ if (DBS_STOPPED != debug_get_state ())
+ break;
+
+ /* get a word under the cursor */
+ GString *word = get_word_at_position(editor->sci, nt->position);
+
+ if (word->len)
+ {
+ /* evaluate expression */
+ gchar *value = debug_evaluate_expression (word->str);
+ if (value)
+ {
+ /* create and show calltip */
+ gchar msg[1000];
+ sprintf(msg, "%s = %s", word->str, value);
+ scintilla_send_message (editor->sci, SCI_CALLTIPSHOW, nt->position, (long)msg);
+ g_free(value);
+ }
+ }
+
+ g_string_free(word, TRUE);
+
+ break;
+ }
+ case SCN_DWELLEND:
+ {
+ scintilla_send_message (editor->sci, SCI_CALLTIPCANCEL, 0, 0);
+ break;
+ }
+ case SCN_MODIFYATTEMPTRO:
+ {
+ dialogs_show_msgbox(GTK_MESSAGE_INFO, _("To edit source files stop debugging session"));
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+/*
+ * Occures when key is pressed.
+ * Handles debug Run/Stop/... and add/remove breakpoint activities
+ */
+gboolean keys_callback(guint key_id)
+{
+ switch (key_id)
+ {
+ case KEY_RUN:
+ debug_run();
+ break;
+ case KEY_STOP:
+ debug_stop();
+ break;
+ case KEY_STEP_OVER:
+ debug_step_over();
+ break;
+ case KEY_STEP_INTO:
+ debug_step_into();
+ break;
+ case KEY_STEP_OUT:
+ debug_step_out();
+ break;
+ case KEY_EXECUTE_UNTIL:
+ {
+ GeanyDocument *doc = document_get_current();
+ if (doc)
+ {
+ int line = sci_get_current_line(doc->editor->sci) + 1;
+ debug_execute_until(DOC_FILENAME(doc), line);
+ }
+ break;
+ }
+ case KEY_BREAKPOINT:
+ {
+ GeanyDocument *doc = document_get_current();
+ if (doc)
+ {
+ int line = sci_get_current_line(doc->editor->sci) + 1;
+ if (!breaks_is_set(DOC_FILENAME(doc), line))
+ breaks_add(DOC_FILENAME(doc), line, NULL, TRUE, 0);
+ else
+ breaks_remove(DOC_FILENAME(doc), line);
+ scintilla_send_message(doc->editor->sci, SCI_SETFOCUS, TRUE, 0);
+ }
+ break;
+ }
+ case KEY_CURRENT_INSTRUCTION:
+ {
+ if (DBS_STOPPED == debug_get_state() && debug_current_instruction_have_sources())
+ {
+ debug_jump_to_current_instruction();
+ gtk_widget_set_sensitive(stree_get_widget(), FALSE);
+ stree_select_first();
+ gtk_widget_set_sensitive(stree_get_widget(), TRUE);
+ }
+ }
+ }
+
+ return TRUE;
+}
Property changes on: trunk/geany-plugins/debugger/src/callbacks.c
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/callbacks.h
===================================================================
--- trunk/geany-plugins/debugger/src/callbacks.h (rev 0)
+++ trunk/geany-plugins/debugger/src/callbacks.h 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,28 @@
+/*
+ * callbacks.h
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data);
+void on_document_activate(GObject *obj, GeanyDocument *doc, gpointer user_data);
+void on_document_close(GObject *obj, GeanyDocument *doc, gpointer user_data);
+void on_document_save(GObject *obj, GeanyDocument *doc, gpointer user_data);
+void on_document_new(GObject *obj, GeanyDocument *doc, gpointer user_data);
+gboolean on_editor_notify(GObject *object, GeanyEditor *editor, SCNotification *nt, gpointer data);
+gboolean keys_callback(guint key_id);
Property changes on: trunk/geany-plugins/debugger/src/callbacks.h
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/geany-plugins/debugger/src/dbm_bash.c
===================================================================
--- trunk/geany-plugins/debugger/src/dbm_bash.c (rev 0)
+++ trunk/geany-plugins/debugger/src/dbm_bash.c 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,516 @@
+/*
+ * dbm_gdm.c
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+/*
+ * Implementation of struct _dbg_module for bash
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <poll.h>
+#include <gtk/gtk.h>
+
+#include "breakpoint.h"
+#include "debug_module.h"
+
+#include "geanyplugin.h"
+extern GeanyFunctions *geany_functions;
+extern GeanyData *geany_data;
+
+/* module features */
+#define MODULE_FEATURES 0
+
+/* bash spawn flags */
+#define BASH_SPAWN_FLAGS \
+ G_SPAWN_SEARCH_PATH | \
+ G_SPAWN_DO_NOT_REAP_CHILD
+
+/* callbacks to use for messaging, error reporting and state change alerting */
+static dbg_callbacks* dbg_cbs;
+
+/* terminal device name */
+gchar *terminal_device = NULL;
+
+/* bash command line arguments*/
+static gchar *bash_args[] = { "bash", "--debugger", NULL, NULL };
+
+/* bash pid*/
+static GPid bash_pid = 0;
+
+/* target pid*/
+static GPid target_pid = 0;
+
+/* GSource to watch bash exit */
+static GSource *bash_src;
+
+/* channels for bash input/output */
+static gint bash_in;
+static gint bash_out;
+static GIOChannel *bash_ch_in;
+static GIOChannel *bash_ch_out;
+
+/* bash output event source id */
+static guint bash_id_out;
+
+/* buffer for the error message */
+static char err_message[1000];
+
+/* locals list */
+static GList *locals = NULL;
+
+/* watches list */
+static GList *watches = NULL;
+
+/* forward declarations */
+static void stop();
+static variable* add_watch(gchar* expression);
+static void update_watches();
+static void update_locals();
+
+/* list of start messages, to show them in init if initialization is successfull */
+static GList *start_messages = NULL;
+
+/*
+ * frees startup messages list
+ */
+static void free_start_messages()
+{
+ g_list_foreach(start_messages, (GFunc)g_free, NULL);
+ g_list_free(start_messages);
+ start_messages = NULL;
+}
+
+/*
+ * shutdown GIOChannel
+ */
+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);
+ g_io_channel_unref(*ch);
+ *ch = NULL;
+ if (fd >= 0)
+ {
+ close(fd);
+ }
+ }
+}
+
+/*
+ * called on bash exit
+ */
+static void on_bash_exit(GPid pid, gint status, gpointer data)
+{
+ bash_pid = target_pid = 0;
+ g_spawn_close_pid(pid);
+ shutdown_channel(&bash_ch_in);
+ shutdown_channel(&bash_ch_out);
+
+ /* delete locals */
+ g_list_foreach(locals, (GFunc)g_free, NULL);
+ locals = NULL;
+
+ /* delete watches */
+ g_list_foreach(watches, (GFunc)g_free, NULL);
+ watches = NULL;
+
+ g_source_destroy(bash_src);
+
+ dbg_cbs->set_exited(0);
+}
+
+/*
+ * reads bash stdout until the end
+ */
+static gchar** read_to_the_end()
+{
+ struct pollfd pfd;
+ pfd.fd = bash_out;
+ pfd.events = POLLIN;
+ pfd.revents = 0;
+
+ GString *out = g_string_new("");
+
+ while(poll(&pfd, 1, 100))
+ {
+ gchar curbuf[1024];
+
+ GIOStatus st;
+ GError *err = NULL;
+ gsize count;
+
+ g_io_channel_read_chars(bash_ch_out, curbuf, sizeof(curbuf) - 1, &count, &err);
+ gboolean have_error = err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF);
+ if (!have_error && count)
+ {
+ curbuf[count] = '\0';
+ g_string_append(out, curbuf);
+ }
+ }
+
+ gchar **lines = g_strsplit(out->str, "\n", 0);
+ g_string_free(out, TRUE);
+
+ return lines;
+}
+
+/*
+ * asyncronous bash output reader
+ * looks for a stopped event, then notifies "debug" module and removes async handler
+ */
+static gboolean on_read_from_bash(GIOChannel * src, GIOCondition cond, gpointer data)
+{
+ gchar *line;
+ gint length;
+
+ if (G_IO_STATUS_NORMAL != g_io_channel_read_line(src, &line, NULL, &length, NULL))
+ return TRUE;
+
+ *(line + length) = '\0';
+
+ g_free(line);
+
+ return TRUE;
+}
+
+/*
+ * execute "command" asyncronously
+ * after writing command to an input channel
+ * connects reader to output channel and exits
+ * after execution
+ */
+static void exec_async_command(gchar* command)
+{
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message(command, "red");
+#endif
+
+ /* write command to bash input channel */
+ GIOStatus st;
+ GError *err = NULL;
+ gsize count;
+
+ char bash_command[1000];
+ sprintf(bash_command, "%s\n", command);
+
+ while (strlen(bash_command))
+ {
+ st = g_io_channel_write_chars(bash_ch_in, bash_command, strlen(bash_command), &count, &err);
+ strcpy(bash_command, bash_command + count);
+ if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF))
+ {
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message("Error sending command", "red");
+#endif
+ break;
+ }
+ }
+
+ /* flush the chanel */
+ st = g_io_channel_flush(bash_ch_in, &err);
+
+ /* connect read callback to the output chanel */
+ bash_id_out = g_io_add_watch(bash_ch_out, G_IO_IN, on_read_from_bash, NULL);
+}
+
+/*
+ * execute "command" syncronously
+ * i.e. reading output right
+ * after execution
+ */
+static gboolean exec_sync_command(gchar* command, gchar** output)
+{
+
+ dbg_cbs->report_error(command);
+
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message(command, "red");
+#endif
+
+ /* write command to bash input channel */
+ GIOStatus st;
+ GError *err = NULL;
+ gsize count;
+
+ char bash_command[1000];
+ sprintf(bash_command, "%s\n", command);
+ while (strlen(bash_command))
+ {
+ st = g_io_channel_write_chars(bash_ch_in, bash_command, strlen(bash_command), &count, &err);
+ strcpy(bash_command, bash_command + count);
+ if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF))
+ {
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message("Error sending command", "red");
+#endif
+ break;
+ }
+ }
+ st = g_io_channel_flush(bash_ch_in, &err);
+
+ gchar **lines = read_to_the_end ();
+ int i = 0;
+ while (lines[i++])
+ dbg_cbs->send_message(lines[i - 1], "red");
+ g_strfreev(lines);
+
+ return TRUE;
+}
+
+/*
+ * starts gdb and sets its parameners
+ */
+static gboolean init(dbg_callbacks* callbacks)
+{
+ dbg_cbs = callbacks;
+
+ return TRUE;
+}
+
+static gboolean load(char* file, char* commandline, GList* env, GList *witer)
+{
+ GError *err = NULL;
+
+ bash_args[2] = file;
+
+ /* spawn bash */
+ //gchar **bash_env = utils_copy_environment(NULL, NULL);
+ if (!g_spawn_async_with_pipes(NULL, bash_args, NULL,
+ BASH_SPAWN_FLAGS, NULL,
+ NULL, &bash_pid, &bash_in, &bash_out, NULL, &err))
+ {
+ dbg_cbs->report_error(_("Failed to spawn bash process"));
+ return 0;
+ }
+
+ /* set handler for bash process exit event */
+ g_child_watch_add(bash_pid, on_bash_exit, NULL);
+ bash_src = g_child_watch_source_new(bash_pid);
+
+ /* create GIOChanel for reading from bash */
+ bash_ch_in = g_io_channel_unix_new(bash_in);
+ g_io_channel_set_encoding(bash_ch_in, NULL, NULL);
+ g_io_channel_set_buffered(bash_ch_in, FALSE);
+
+ /* create GIOChanel for writing to bash */
+ bash_ch_out = g_io_channel_unix_new(bash_out);
+ g_io_channel_set_encoding(bash_ch_out, NULL, NULL);
+ g_io_channel_set_buffered(bash_ch_out, FALSE);
+
+ /* reading starting bash messages */
+ gchar **lines = read_to_the_end ();
+ int i = 0;
+ while (lines[i++])
+ dbg_cbs->send_message(lines[i - 1], "red");
+ g_strfreev(lines);
+
+ return TRUE;
+}
+
+/*
+ * starts debugging
+ */
+static void run(char* terminal_device)
+{
+ /* setting tty */
+ gchar command[1000];
+ sprintf (command, "tty %s", terminal_device);
+ exec_sync_command(command, NULL);
+}
+
+/*
+ * stops bash
+ */
+static void stop()
+{
+ /* write command to bash input channel */
+ GIOStatus st;
+ GError *err = NULL;
+ gsize count;
+
+ char *bash_command = "quit";
+ while (strlen(bash_command))
+ {
+ st = g_io_channel_write_chars(bash_ch_in, bash_command, strlen(bash_command), &count, &err);
+ strcpy(bash_command, bash_command + count);
+ if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF))
+ {
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message("Error sending command", "red");
+#endif
+ break;
+ }
+ }
+ st = g_io_channel_flush(bash_ch_in, &err);
+ //exec_sync_command("-bash-exit", FALSE, NULL);
+}
+
+/*
+ * resumes bash
+ */
+static void resume()
+{
+ //exec_async_command("-exec-continue");
+}
+
+/*
+ * step over
+ */
+static void step_over()
+{
+ //exec_async_command("-exec-next");
+}
+
+/*
+ * step into
+ */
+static void step_into()
+{
+ //exec_async_command("-exec-step");
+}
+
+/*
+ * step out
+ */
+static void step_out()
+{
+ //exec_async_command("-exec-finish");
+}
+
+/*
+ * execute until
+ */
+static void execute_until(gchar *file, int line)
+{
+}
+
+/*
+ * set breakpoint
+ */
+static gboolean set_break(breakpoint* bp, break_set_activity bsa)
+{
+ return TRUE;
+}
+
+/*
+ * removes breakpoint
+ */
+static gboolean remove_break(breakpoint* bp)
+{
+ return TRUE;
+}
+
+/*
+ * gets stack
+ */
+static GList* get_stack()
+{
+ GList *stack = NULL;
+ return stack;
+}
+
+
+/*
+ * updates watches list
+ */
+static void update_watches()
+{
+}
+
+/*
+ * updates locals list
+ */
+static void update_locals()
+{
+}
+
+/*
+ * get locals list
+ */
+static GList* get_locals ()
+{
+ return g_list_copy(locals);
+}
+
+/*
+ * get watches list
+ */
+static GList* get_watches ()
+{
+ return g_list_copy(watches);
+}
+
+/*
+ * get list of children
+ */
+static GList* get_children (gchar* path)
+{
+ return NULL;
+}
+
+/*
+ * add new watch
+ */
+static variable* add_watch(gchar* expression)
+{
+ return NULL;
+}
+
+/*
+ * remove watch
+ */
+static void remove_watch(gchar* path)
+{
+}
+
+/*
+ * evaluates given expression and returns the result
+ */
+static gchar *evaluate_expression(gchar *expression)
+{
+ return "";
+}
+
+/*
+ * request bash interrupt
+ */
+static gboolean request_interrupt()
+{
+ return FALSE;
+}
+
+/*
+ * get bash error messages
+ */
+static gchar* error_message()
+{
+ return err_message;
+}
+
+/*
+ * define bash debug module
+ */
+DBG_MODULE_DEFINE(bash);
+
+
Added: trunk/geany-plugins/debugger/src/dbm_gdb.c
===================================================================
--- trunk/geany-plugins/debugger/src/dbm_gdb.c (rev 0)
+++ trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-02-05 11:18:58 UTC (rev 1898)
@@ -0,0 +1,1504 @@
+/*
+ * dbm_gdm.c
+ *
+ * Copyright 2010 Alexander Petukhov <Alexander(dot)Petukhov(at)mail(dot)ru>
+ *
+ * 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.
+ */
+
+/*
+ * Implementation of struct _dbg_module for GDB
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <poll.h>
+#include <gtk/gtk.h>
+
+#include "breakpoint.h"
+#include "debug_module.h"
+
+#include "geanyplugin.h"
+extern GeanyFunctions *geany_functions;
+extern GeanyData *geany_data;
+
+/* module features */
+#define MODULE_FEATURES MF_ASYNC_BREAKS
+
+/* GDB spawn flags */
+#define GDB_SPAWN_FLAGS \
+ G_SPAWN_SEARCH_PATH | \
+ G_SPAWN_DO_NOT_REAP_CHILD
+
+/* GDB prompt */
+#define GDB_PROMPT "(gdb) \n"
+
+/* enumeration for GDB command execution status */
+typedef enum _result_class {
+ RC_DONE,
+ RC_EXIT,
+ RC_ERROR
+} result_class;
+
+/* enumeration for stop reason */
+enum sr {
+ SR_BREAKPOINT_HIT,
+ SR_END_STEPPING_RANGE,
+ SR_EXITED_NORMALLY,
+ SR_SIGNAL_RECIEVED,
+ SR_EXITED_SIGNALLED,
+} stop_reason;
+
+/* callbacks to use for messaging, error reporting and state change alerting */
+dbg_callbacks* dbg_cbs;
+
+/* GDB command line arguments*/
+static gchar *gdb_args[] = { "gdb", "-i=mi", NULL };
+
+/* GDB pid*/
+static GPid gdb_pid = 0;
+
+/* target pid*/
+static GPid target_pid = 0;
+
+/* GSource to watch GDB exit */
+static GSource *gdb_src;
+
+/* channels for GDB input/output */
+static gint gdb_in;
+static gint gdb_out;
+static GIOChannel *gdb_ch_in;
+static GIOChannel *gdb_ch_out;
+
+/* GDB output event source id */
+static guint gdb_id_out;
+
+/* buffer for the error message */
+char err_message[1000];
+
+/* flag, showing that on debugger stop we have to call a callback */
+gboolean requested_interrupt = FALSE;
+
+/* locals list */
+static GList *locals = NULL;
+
+/* watches list */
+static GList *watches = NULL;
+
+/* loaded files list */
+static GList *files = NULL;
+
+/* set to true if library was loaded/unloaded
+and it's nessesary to refresh files list */
+static gboolean file_refresh_needed = FALSE;
+
+/* forward declarations */
+void stop();
+variable* add_watch(gchar* expression);
+void update_watches();
+void update_locals();
+void update_files();
+
+/* list of start messages, to show them in init if initialization is successfull */
+GList *start_messages = NULL;
+
+/*
+ * frees startup messages list
+ */
+static void free_start_messages()
+{
+ g_list_foreach(start_messages, (GFunc)g_free, NULL);
+ g_list_free(start_messages);
+ start_messages = NULL;
+}
+
+/*
+ * print message using color, based on message type
+ */
+void colorize_message(gchar *message)
+{
+ gchar *color;
+ if ('=' == *message)
+ color = "rose";
+ else if ('^' == *message)
+ color = "brown";
+ else if ('*' == *message)
+ color = "blue";
+ else
+ color = "red";
+
+ dbg_cbs->send_message(message, color);
+}
+
+/*
+ * shutdown GIOChannel
+ */
+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);
+ g_io_channel_unref(*ch);
+ *ch = NULL;
+ if (fd >= 0)
+ {
+ close(fd);
+ }
+ }
+}
+
+/*
+ * called on GDB exit
+ */
+static void on_gdb_exit(GPid pid, gint status, gpointer data)
+{
+ gdb_pid = target_pid = 0;
+ g_spawn_close_pid(pid);
+ shutdown_channel(&gdb_ch_in);
+ shutdown_channel(&gdb_ch_out);
+
+ /* delete locals */
+ g_list_foreach(locals, (GFunc)g_free, NULL);
+ g_list_free(locals);
+ locals = NULL;
+
+ /* delete watches */
+ g_list_foreach(watches, (GFunc)g_free, NULL);
+ g_list_free(watches);
+ watches = NULL;
+
+ /* delete files */
+ g_list_foreach(files, (GFunc)g_free, NULL);
+ g_list_free(files);
+ files = NULL;
+
+ g_source_destroy(gdb_src);
+
+ dbg_cbs->set_exited(0);
+}
+
+/*
+ * reads gdb_out until "(gdb)" string met
+ */
+GList* read_until_prompt()
+{
+ GList *lines = NULL;
+
+ gchar *line = NULL;
+ gsize terminator;
+ while (G_IO_STATUS_NORMAL == g_io_channel_read_line(gdb_ch_out, &line, NULL, &terminator, NULL))
+ {
+ if (!strcmp(GDB_PROMPT, line))
+ break;
+
+ line[terminator] = '\0';
+ lines = g_list_append (lines, line);
+ }
+
+ return lines;
+}
+
+/*
+ * reads gdb_out until have data (by lines)
+ */
+GList* read_until_end()
+{
+ GList *lines = NULL;
+
+ struct pollfd pfd;
+ pfd.fd = gdb_out;
+ pfd.events = POLLIN;
+ pfd.revents = 0;
+
+ while(poll(&pfd, 1, 100))
+ {
+ gchar *line = NULL;
+ GIOStatus st;
+ gsize terminator;
+ GError *err = NULL;
+
+ if(G_IO_STATUS_NORMAL == g_io_channel_read_line(gdb_ch_out, &line, NULL, &terminator, &err))
+ {
+ line[terminator] = '\0';
+ lines = g_list_append(lines, line);
+ }
+ else
+ dbg_cbs->report_error(err->message);
+ }
+
+ return lines;
+}
+
+/*
+ * asyncronous gdb output reader
+ * looks for a stopped event, then notifies "debug" module and removes async handler
+ */
+static gboolean on_read_from_gdb(GIOChannel * src, GIOCondition cond, gpointer data)
+{
+ gchar *line;
+ gint length;
+
+ if (G_IO_STATUS_NORMAL != g_io_channel_read_line(src, &line, NULL, &length, NULL))
+ return TRUE;
+
+ gboolean prompt = !strcmp(line, GDB_PROMPT);
+
+ *(line + length) = '\0';
+
+ if (!prompt)
+ {
+ gchar *compressed = g_strcompress(line);
+ colorize_message(compressed);
+ g_free(compressed);
+ }
+
+ if (!target_pid && g_str_has_prefix(line, "=thread-group-created"))
+ {
+ *(strrchr(line, '\"')) = '\0';
+ target_pid = atoi(line + strlen("=thread-group-created,id=\""));
+ }
+ else if (g_str_has_prefix(line, "=library-loaded") || g_str_has_prefix(line, "=library-unloaded"))
+ file_refresh_needed = TRUE;
+ else if (*line == '*')
+ {
+ /* asyncronous record found */
+ char *record = NULL;
+ if (record = strchr(line, ','))
+ {
+ *record = '\0';
+ record++;
+ }
+ else
+ record = line + strlen(line);
+
+ if (!strcmp(line, "*running"))
+ dbg_cbs->set_run();
+ else if (!strcmp(line, "*stopped"))
+ {
+ /* removing read callback (will pulling all output left manually) */
+ g_source_remove(gdb_id_out);
+
+ /* update locals */
+ update_locals();
+
+ /* update watches */
+ update_watches();
+
+ /* update files */
+ if (file_refresh_needed)
+ {
+ update_files();
+ file_refresh_needed = FALSE;
+ }
+
+ /* looking for a reason to stop */
+ char *next = NULL;
+ char *reason = strstr(record, "reason=\"") + strlen("reason=\"");
+ next = strstr(reason, "\"") + 1;
+ *(next - 1) = '\0';
+ if (!strcmp(reason, "breakpoint-hit"))
+ stop_reason = SR_BREAKPOINT_HIT;
+ else if (!strcmp(reason, "end-stepping-range"))
+ stop_reason = SR_END_STEPPING_RANGE;
+ else if (!strcmp(reason, "signal-received"))
+ stop_reason = SR_SIGNAL_RECIEVED;
+ else if (!strcmp(reason, "exited-normally"))
+ stop_reason = SR_EXITED_NORMALLY;
+ else if (!strcmp(reason, "exited-signalled"))
+ stop_reason = SR_EXITED_SIGNALLED;
+
+ if (SR_BREAKPOINT_HIT == stop_reason || SR_END_STEPPING_RANGE == stop_reason)
+ {
+ dbg_cbs->set_stopped();
+ }
+ else if (stop_reason == SR_SIGNAL_RECIEVED)
+ {
+ if (!requested_interrupt)
+ dbg_cbs->report_error(_("Program received a signal"));
+ else
+ requested_interrupt = FALSE;
+
+ dbg_cbs->set_stopped();
+ }
+ else if (stop_reason == SR_EXITED_NORMALLY || stop_reason == SR_EXITED_SIGNALLED)
+ stop();
+ }
+ }
+ else if (g_str_has_prefix (line, "^error"))
+ {
+ /* removing read callback (will pulling all output left manually) */
+ g_source_remove(gdb_id_out);
+
+ /* get message */
+ char *msg = strstr(line, "msg=\"") + strlen("msg=\"");
+ *strrchr(msg, '\"') = '\0';
+ msg = g_strcompress(msg);
+
+ /* reading until prompt */
+ GList *lines = read_until_prompt();
+ GList *iter = lines;
+ while(iter)
+ {
+ gchar *l = (gchar*)iter->data;
+ if (strcmp(l, GDB_PROMPT))
+ colorize_message(l);
+ g_free(l);
+
+ iter = iter->next;
+ }
+ g_list_free (lines);
+
+ /* send error message */
+ dbg_cbs->report_error(msg);
+
+ g_free(msg);
+ }
+
+ g_free(line);
+
+ return TRUE;
+}
+
+/*
+ * execute "command" asyncronously
+ * after writing command to an input channel
+ * connects reader to output channel and exits
+ * after execution
+ */
+void exec_async_command(gchar* command)
+{
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message(command, "red");
+#endif
+
+ /* write command to gdb input channel */
+ GIOStatus st;
+ GError *err = NULL;
+ gsize count;
+
+ char gdb_command[1000];
+ sprintf(gdb_command, "%s\n", command);
+
+ while (strlen(gdb_command))
+ {
+ st = g_io_channel_write_chars(gdb_ch_in, gdb_command, strlen(gdb_command), &count, &err);
+ strcpy(gdb_command, gdb_command + count);
+ if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF))
+ {
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message("Error sending command", "red");
+#endif
+ break;
+ }
+ }
+
+ /* flush the chanel */
+ st = g_io_channel_flush(gdb_ch_in, &err);
+
+ /* connect read callback to the output chanel */
+ gdb_id_out = g_io_add_watch(gdb_ch_out, G_IO_IN, on_read_from_gdb, NULL);
+}
+
+/*
+ * execute "command" syncronously
+ * i.e. reading output right
+ * after execution
+ */
+result_class exec_sync_command(gchar* command, gboolean wait4prompt, gchar** command_record)
+{
+
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message(command, "red");
+#endif
+
+ /* write command to gdb input channel */
+ GIOStatus st;
+ GError *err = NULL;
+ gsize count;
+
+ char gdb_command[1000];
+ sprintf(gdb_command, "%s\n", command);
+ while (strlen(gdb_command))
+ {
+ st = g_io_channel_write_chars(gdb_ch_in, gdb_command, strlen(gdb_command), &count, &err);
+ strcpy(gdb_command, gdb_command + count);
+ if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF))
+ {
+#ifdef DEBUG_OUTPUT
+ dbg_cbs->send_message("Error sending command", "red");
+#endif
+ break;
+ }
+ }
+ st = g_io_channel_flush(gdb_ch_in, &err);
+
+ if (!wait4prompt)
+ return RC_DONE;
+
+ GList *lines = read_until_prompt();
+
+#ifdef DEBUG_OUTPUT
+ GList *line = lines;
+ while (line)
+ {
+ dbg_cbs->send_message((gchar*)line->data, "red");
+ line = line->next;
+ }
+#endif
+
+ result_class rc;
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.