add line-number dumping
This commit is contained in:
parent
f6cdbdf63c
commit
656b0e3bb2
|
@ -1,3 +1,3 @@
|
||||||
AUTOMAKE_OPTIONS= foreign
|
AUTOMAKE_OPTIONS= foreign
|
||||||
|
|
||||||
EXTRA_DIST= disassemble.h globals.h modules.h qfprogs.h strings.h
|
EXTRA_DIST= disassemble.h globals.h lines.h modules.h qfprogs.h strings.h
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef __lines_h
|
||||||
|
#define __lines_h
|
||||||
|
|
||||||
|
struct progs_s;
|
||||||
|
|
||||||
|
void dump_lines (struct progs_s *pr);
|
||||||
|
|
||||||
|
#endif//__lines_h
|
|
@ -10,6 +10,7 @@ bin_PROGRAMS= qfprogs
|
||||||
|
|
||||||
#man_MANS= qfprogs.1
|
#man_MANS= qfprogs.1
|
||||||
|
|
||||||
qfprogs_SOURCES= disassemble.c globals.c modules.c qfprogs.c strings.c
|
qfprogs_SOURCES= \
|
||||||
|
disassemble.c globals.c lines.c modules.c qfprogs.c strings.c
|
||||||
qfprogs_LDADD= $(QFPROGS_LIBS)
|
qfprogs_LDADD= $(QFPROGS_LIBS)
|
||||||
qfprogs_DEPENDENCIES= $(QFPROGS_DEPS)
|
qfprogs_DEPENDENCIES= $(QFPROGS_DEPS)
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
#FILENAME#
|
||||||
|
|
||||||
|
#DESCRIPTION#
|
||||||
|
|
||||||
|
Copyright (C) 2001 #AUTHOR#
|
||||||
|
|
||||||
|
Author: #AUTHOR#
|
||||||
|
Date: #DATE#
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRINGS_H
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "QF/progs.h"
|
||||||
|
|
||||||
|
#include "qfprogs.h"
|
||||||
|
#include "lines.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
dump_lines (progs_t *pr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!pr->debug)
|
||||||
|
return;
|
||||||
|
for (i = 0; i < pr->debug->num_linenos; i++) {
|
||||||
|
pr_lineno_t *lineno = &pr->linenos[i];
|
||||||
|
|
||||||
|
printf ("%5d %5d\n", lineno->fa.addr, lineno->line);
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,6 +60,7 @@ static const char rcsid[] =
|
||||||
|
|
||||||
#include "disassemble.h"
|
#include "disassemble.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "lines.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ static const struct option long_options[] = {
|
||||||
{"strings", no_argument, 0, 's'},
|
{"strings", no_argument, 0, 's'},
|
||||||
{"fields", no_argument, 0, 'f'},
|
{"fields", no_argument, 0, 'f'},
|
||||||
{"functions", no_argument, 0, 'F'},
|
{"functions", no_argument, 0, 'F'},
|
||||||
|
{"lines", no_argument, 0, 'l'},
|
||||||
{"modules", no_argument, 0, 'M'},
|
{"modules", no_argument, 0, 'M'},
|
||||||
{NULL, 0, NULL, 0},
|
{NULL, 0, NULL, 0},
|
||||||
};
|
};
|
||||||
|
@ -223,7 +225,7 @@ main (int argc, char **argv)
|
||||||
void (*func)(progs_t *pr) = dump_globals;
|
void (*func)(progs_t *pr) = dump_globals;
|
||||||
|
|
||||||
init_qf ();
|
init_qf ();
|
||||||
while ((c = getopt_long (argc, argv, "dgsfFM", long_options, 0)) != EOF) {
|
while ((c = getopt_long (argc, argv, "dgsfFlM", long_options, 0)) != EOF) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
func = disassemble_progs;
|
func = disassemble_progs;
|
||||||
|
@ -240,6 +242,9 @@ main (int argc, char **argv)
|
||||||
case 'F':
|
case 'F':
|
||||||
func = dump_functions;
|
func = dump_functions;
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
func = dump_lines;
|
||||||
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
func = dump_modules;
|
func = dump_modules;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue