Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Florian Lorenzen <lorenzen@physik.fu-berlin.de>
To: gdb-patches@sourceware.org
Subject: Plotting from GDB
Date: Thu, 31 Jan 2008 17:32:00 -0000	[thread overview]
Message-ID: <wnzr6fx9ayz.wl%lorenzen@physik.fu-berlin.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 460 bytes --]

Hello,

I spent a lot of time debugging numerical codes. Very often, it is
useful to plot a certain quantity instead of staring on numbers. To
help with this, I wrote some small user defined commands to create a
plot with gnuplot during the debugging session. Perhaps, you want to
include it in your distribution, I attach you the file. (I know, DDD
has this functionality, but perhaps CLI or Emacs users might be
interested in this.)

Best regards,

Florian


[-- Attachment #1.2: plot1d.gdb --]
[-- Type: text/plain, Size: 1395 bytes --]

# plot1d.gdb
#
# Copyright (C) 2008 Florian Lorenzen
#
# Plot an expression that expands to {x1, x2, ..., xN}, i. e.
# N numbers using gnuplot.
#
# This file is for the GNU debugger 6.x.
#
# It writes temporary files named __plot1d.dump, __plot1d.dat, __plot1d.gp, so
# you should not have files of the same name in the working directory.
#
# It requires sed, awk, and gnuplot available in the $PATH.

# plot1d_opt_range <expr> <opt> <range>
#
# Plot the points of <expr> passing <opt> as plot options using
# <range> in the set yrange command.
define plot1d_opt_range
  shell rm -f __plot1d.dump __plot1d.dat __plot1d.gp
  set logging file __plot1d.dump
  set logging on
  output $arg0
  set logging off
  shell awk '{printf("%s", $0)}' < __plot1d.dump | \
    sed 's/^{\(.*\)}$/\1/;s/, */\n/g' > __plot1d.dat
  shell echo "set yrange $arg2; plot '__plot1d.dat' $arg1 title '$arg0'; \
    pause -1 \"Press enter to continue\"" > __plot1d.gp
  shell gnuplot __plot1d.gp
  shell rm -f __plot1d.dump __plot1d.dat __plot1d.gp
end

# plot1d <expr>
#
# Just plot the points of <expr>.
define plot1d
  plot1d_opt_range $arg0 "" "[*:*]"
end

# plot1d_opt <expr> <opt>
#
# Plot the points of <expr> passing <opt> to the
# plot command after the datafile. So, one can pass
# "with lines" here.
define plot1d_opt
  plot1d_opt_range $arg0 $arg1 "[*:*]"
end


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2008-01-31 17:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 17:32 Florian Lorenzen [this message]
2008-01-31 22:07 ` Daniel Jacobowitz
2008-02-05  9:52 ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wnzr6fx9ayz.wl%lorenzen@physik.fu-berlin.de \
    --to=lorenzen@physik.fu-berlin.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox