[Ltrace-devel] r33 - ltrace/trunk
Paul Gilliam
pgilliam-guest at costa.debian.org
Mon Mar 13 17:43:15 UTC 2006
Author: pgilliam-guest
Date: 2006-03-13 17:43:13 +0000 (Mon, 13 Mar 2006)
New Revision: 33
Modified:
ltrace/trunk/elf.c
ltrace/trunk/options.c
ltrace/trunk/options.h
Log:
fix the -x processing to get rid of bad waring.
Modified: ltrace/trunk/elf.c
===================================================================
--- ltrace/trunk/elf.c 2006-03-10 23:13:20 UTC (rev 32)
+++ ltrace/trunk/elf.c 2006-03-13 17:43:13 UTC (rev 33)
@@ -351,9 +351,10 @@
struct library_symbol *library_symbols = NULL;
struct ltelf lte[MAX_LIBRARY + 1];
size_t i;
- struct opt_e_t *xptr;
+ struct opt_x_t *xptr;
struct library_symbol **lib_tail = NULL;
- struct opt_e_t *main_cheat;
+ struct opt_x_t *main_cheat;
+ int exit_out = 0;
elf_version(EV_CURRENT);
@@ -440,22 +441,24 @@
add_library_symbol(elf_plt2addr
(lte, (void *)addr), name,
lib_tail, 1, 0);
+ xptr->found = 1;
break;
}
}
for (xptr = opt_x; xptr; xptr = xptr->next)
- if (xptr->name) {
- if (strcmp(xptr->name, E_ENTRY_NAME) == 0)
- add_library_symbol(elf_plt2addr
- (lte,
- (void *)lte->ehdr.e_entry),
- "_start", lib_tail, 1, 0);
- else
- fprintf(stderr,
- "Warning: Couldn't get symbol \"%s\" "
- "from \"%s\" or it's a duplicate",
- xptr->name, proc->filename);
+ if ( ! xptr->found) {
+ char *badthing = "WARNING";
+ if (E_ENTRY_NAME && strcmp(xptr->name, E_ENTRY_NAME)) {
+ badthing = "ERROR";
+ exit_out = 1;
+ }
+ fprintf (stderr,
+ "%s: Couldn't find symbol \"%s\" in file \"%s\"\n",
+ badthing, xptr->name, proc->filename);
}
+ if (exit_out) {
+ exit (1);
+ }
for (i = 0; i < library_num + 1; ++i)
do_close_elf(<e[i]);
Modified: ltrace/trunk/options.c
===================================================================
--- ltrace/trunk/options.c 2006-03-10 23:13:20 UTC (rev 32)
+++ ltrace/trunk/options.c 2006-03-13 17:43:13 UTC (rev 33)
@@ -51,7 +51,7 @@
int opt_e_enable = 1;
/* List of global function names given to -x: */
-struct opt_e_t *opt_x = NULL;
+struct opt_x_t *opt_x = NULL;
/* Set a break on the routine named here in order to re-initialize breakpoints
after all the PLTs have been initialzed */
@@ -323,7 +323,7 @@
case 'x':
{
- struct opt_e_t *p = opt_x;
+ struct opt_x_t *p = opt_x;
/* First, check for duplicate. */
while (p && strcmp(p->name, optarg)) {
@@ -334,12 +334,13 @@
}
/* If not duplicate, add to list. */
- p = malloc(sizeof(struct opt_e_t));
+ p = malloc(sizeof(struct opt_x_t));
if (!p) {
perror("ltrace: malloc");
exit(1);
}
p->name = optarg;
+ p->found = 0;
p->next = opt_x;
opt_x = p;
break;
Modified: ltrace/trunk/options.h
===================================================================
--- ltrace/trunk/options.h 2006-03-10 23:13:20 UTC (rev 32)
+++ ltrace/trunk/options.h 2006-03-13 17:43:13 UTC (rev 33)
@@ -31,11 +31,17 @@
struct opt_e_t *next;
};
+struct opt_x_t {
+ char *name;
+ int found;
+ struct opt_x_t *next;
+};
+
extern struct opt_p_t *opt_p; /* attach to process with a given pid */
extern struct opt_e_t *opt_e; /* list of function names to display */
extern int opt_e_enable; /* 0 if '!' is used, 1 otherwise */
-extern struct opt_e_t *opt_x; /* list of functions to break at */
+extern struct opt_x_t *opt_x; /* list of functions to break at */
extern char **process_options(int argc, char **argv);
More information about the Ltrace-devel
mailing list