dominance.c (calc_dfs_tree_nonrec): Reverse order of tests in if statement so we...
[official-gcc.git] / libjava / include / name-finder.h
blob2d2ab9f4f6e5c3b80162413c75e4cc669456a303
1 // name-finder.h - Convert addresses to names
3 /* Copyright (C) 2000 Red Hat Inc
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
11 /**
12 * @author Andrew Haley <aph@cygnus.com>
13 * @date Jan 6 2000
16 #include <gcj/cni.h>
17 #include <jvm.h>
19 #include <sys/types.h>
20 #include <sys/wait.h>
22 #include <string.h>
23 #include <stdio.h>
25 #ifdef HAVE_UNISTD_H
26 #include <unistd.h>
27 #endif
29 /* _Jv_name_finder is a class wrapper around a mechanism that can
30 convert addresses of methods to their names and the names of files
31 in which they appear. */
33 class _Jv_name_finder
35 public:
36 _Jv_name_finder (char *executable);
37 ~_Jv_name_finder ()
39 #if defined (HAVE_PIPE) && defined (HAVE_FORK)
40 close (f_pipe[1]);
41 fclose (b_pipe_fd);
43 int wstat;
44 // We don't care about errors here.
45 waitpid (pid, &wstat, 0);
46 #endif
49 /* Given a pointer to a function or method, try to convert it into a
50 name and the appropriate line and source file. The caller passes
51 the code pointer in p.
53 Returns false if the lookup fails. Even if this happens, the field
54 hex will have been correctly filled in with the pointer.
56 The other fields are method_name and file_name, which lookup will
57 attempt to fill appropriately. If the lookup has failed, these
58 fields contain garbage.*/
59 bool lookup (void *p);
61 char method_name[1024];
62 char file_name[1024];
63 char hex[sizeof (void *) * 2 + 5];
65 private:
66 void toHex (void *p);
67 #if defined (HAVE_PIPE) && defined (HAVE_FORK)
68 pid_t pid;
69 int f_pipe[2], b_pipe[2];
70 FILE *b_pipe_fd;
71 int error;
72 #endif