|
From: <sv...@va...> - 2005-06-21 23:04:05
|
Author: njn
Date: 2005-06-22 00:03:36 +0100 (Wed, 22 Jun 2005)
New Revision: 3993
Log:
Added VG_() prefixes to functions exported from m_ume to avoid=20
namespace pollution.
Also broadened a couple of _dl_* suppressions so that vgtest_ume
passes on my machine.
Modified:
trunk/coregrind/m_main.c
trunk/coregrind/m_ume.c
trunk/coregrind/pub_core_ume.h
trunk/coregrind/stage1.c
trunk/memcheck/tests/Makefile.am
trunk/memcheck/tests/vgtest_ume.c
trunk/memcheck/tests/vgtest_ume.stderr.exp
Modified: trunk/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_main.c 2005-06-21 22:47:54 UTC (rev 3992)
+++ trunk/coregrind/m_main.c 2005-06-21 23:03:36 UTC (rev 3993)
@@ -176,7 +176,7 @@
/* Look for our AUXV table */
static int scan_auxv(void* init_sp)
{
- struct ume_auxv *auxv =3D find_auxv((UWord*)init_sp);
+ struct ume_auxv *auxv =3D VG_(find_auxv)((UWord*)init_sp);
int padfile =3D -1, found =3D 0;
=20
for (; auxv->a_type !=3D AT_NULL; auxv++)
@@ -215,7 +215,7 @@
#if defined(VGP_ppc32_linux)
case AT_SYSINFO_EHDR:
VG_(vdso_base) =3D auxv->u.a_val;
- foreach_map(find_vdso, NULL);
+ VG_(foreach_map)(find_vdso, NULL);
break;
#endif
}
@@ -764,7 +764,7 @@
Addr cl_esp; /* client stack base (initial esp) */
=20
/* use our own auxv as a prototype */
- orig_auxv =3D find_auxv(init_sp);
+ orig_auxv =3D VG_(find_auxv)(init_sp);
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D compu=
te sizes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
=20
@@ -1211,7 +1211,7 @@
} else {
Int ret;
VG_(clexecfd) =3D VG_(open)(exec, VKI_O_RDONLY, VKI_S_IRUSR);
- ret =3D do_exec(exec, info);
+ ret =3D VG_(do_exec)(exec, info);
if (ret !=3D 0) {
fprintf(stderr, "valgrind: do_exec(%s) failed: %s\n",
exec, strerror(ret));
@@ -1280,7 +1280,7 @@
extra.killpad_padstat =3D &padstat;
extra.killpad_start =3D start;
extra.killpad_end =3D end;
- foreach_map(killpad, &extra);
+ VG_(foreach_map)(killpad, &extra);
}
=20
static void as_closepadfile(int padfile)
Modified: trunk/coregrind/m_ume.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_ume.c 2005-06-21 22:47:54 UTC (rev 3992)
+++ trunk/coregrind/m_ume.c 2005-06-21 23:03:36 UTC (rev 3993)
@@ -76,10 +76,10 @@
=20
// 'extra' allows the caller to pass in extra args to 'fn', like free
// variables to a closure.
-void foreach_map(int (*fn)(char *start, char *end,
- const char *perm, off_t offset,
- int maj, int min, int ino, void* extra),
- void* extra)
+void VG_(foreach_map)(int (*fn)(char *start, char *end,
+ const char *perm, off_t offset,
+ int maj, int min, int ino, void* extra),
+ void* extra)
{
static char buf[10240];
char *bufptr =3D buf;
@@ -129,13 +129,13 @@
/*------------------------------------------------------------*/
=20
// __attribute__((noreturn))
-// void jump_and_switch_stacks ( Addr stack, Addr dst );
+// void VG_(jump_and_switch_stacks) ( Addr stack, Addr dst );
#if defined(VGA_x86)
// 4(%esp) =3D=3D stack
// 8(%esp) =3D=3D dst
asm(
-".global jump_and_switch_stacks\n"
-"jump_and_switch_stacks:\n"
+".global vgPlain_jump_and_switch_stacks\n"
+"vgPlain_jump_and_switch_stacks:\n"
" movl %esp, %esi\n" // remember old stack pointer
" movl 4(%esi), %esp\n" // set stack
" pushl 8(%esi)\n" // dst to stack
@@ -153,8 +153,8 @@
// %rdi =3D=3D stack
// %rsi =3D=3D dst
asm(
-".global jump_and_switch_stacks\n"
-"jump_and_switch_stacks:\n"
+".global vgPlain_jump_and_switch_stacks\n"
+"vgPlain_jump_and_switch_stacks:\n"
" movq %rdi, %rsp\n" // set stack
" pushq %rsi\n" // dst to stack
" movq $0, %rax\n" // zero all GP regs
@@ -188,8 +188,8 @@
// %r3 =3D=3D stack
// %r4 =3D=3D dst
asm(
-".global jump_and_switch_stacks\n"
-"jump_and_switch_stacks:\n"
+".global vgPlain_jump_and_switch_stacks\n"
+"vgPlain_jump_and_switch_stacks:\n"
" mtctr %r4\n\t" // dst to %ctr
" mr %r1,%r3\n\t" // stack to %sp
" li 0,0\n\t" // zero all GP regs
@@ -237,7 +237,7 @@
/*--- Finding auxv on the stack ---*/
/*------------------------------------------------------------*/
=20
-struct ume_auxv *find_auxv(UWord* sp)
+struct ume_auxv *VG_(find_auxv)(UWord* sp)
{
sp++; // skip argc (Nb: is word-sized, not int-sized!)
=20
@@ -734,7 +734,7 @@
=20
// See ume.h for an indication of which entries of 'info' are inputs, wh=
ich
// are outputs, and which are both.
-int do_exec(const char *exe, struct exeinfo *info)
+int VG_(do_exec)(const char *exe, struct exeinfo *info)
{
info->interp_name =3D NULL;
info->interp_args =3D NULL;
Modified: trunk/coregrind/pub_core_ume.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_ume.h 2005-06-21 22:47:54 UTC (rev 3992)
+++ trunk/coregrind/pub_core_ume.h 2005-06-21 23:03:36 UTC (rev 3993)
@@ -45,10 +45,10 @@
=20
/* This is only here so it can be shared between stage1 and stage2 */
extern
-void foreach_map(int (*fn)(char *start, char *end,
- const char *perm, off_t offset,
- int maj, int min, int ino, void* extra),
- void* extra);
+void VG_(foreach_map)(int (*fn)(char *start, char *end,
+ const char *perm, off_t offset,
+ int maj, int min, int ino, void* extra),
+ void* extra);
=20
/* Jump to 'dst', but first set the stack pointer to 'stack'. Also,
clear all the integer registers before entering 'dst'. It's
@@ -62,7 +62,7 @@
*/
extern
__attribute__((noreturn))
-void jump_and_switch_stacks ( Addr stack, Addr dst );
+void VG_(jump_and_switch_stacks) ( Addr stack, Addr dst );
=20
=20
/*------------------------------------------------------------*/
@@ -95,7 +95,7 @@
// checks execute permissions, sets up interpreter if program is a scrip=
t,=20
// reads headers, maps file into memory, and returns important info abou=
t
// the program.
-extern int do_exec(const char *exe, struct exeinfo *info);
+extern int VG_(do_exec)(const char *exe, struct exeinfo *info);
=20
/*------------------------------------------------------------*/
/*--- Finding and dealing with auxv ---*/
@@ -110,7 +110,7 @@
} u;
};
=20
-extern struct ume_auxv *find_auxv(UWord* orig_esp);
+extern struct ume_auxv *VG_(find_auxv)(UWord* orig_esp);
=20
/* Our private auxv entries */
#define AT_UME_PADFD 0xff01 /* padding file fd */
Modified: trunk/coregrind/stage1.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/stage1.c 2005-06-21 22:47:54 UTC (rev 3992)
+++ trunk/coregrind/stage1.c 2005-06-21 23:03:36 UTC (rev 3993)
@@ -85,7 +85,7 @@
assert(&delta >=3D stack && &delta < &stack[sizeof(stack)/sizeof(*sta=
ck)]);
=20
/* find the beginning of the AUXV table */
- auxv =3D find_auxv(v_init_esp);
+ auxv =3D VG_(find_auxv)(v_init_esp);
=20
/* Work out how we should move things to make space for the new
auxv entry. It seems that ld.so wants a 16-byte aligned stack on
@@ -236,7 +236,7 @@
extra.fillgap_end =3D end;
extra.fillgap_padfile =3D padfile;
=20
- foreach_map(fillgap, &extra);
+ VG_(foreach_map)(fillgap, &extra);
=09
if (extra.fillgap_start < extra.fillgap_end) {
void* res =3D mmap(extra.fillgap_start,=20
@@ -283,7 +283,7 @@
=20
snprintf(buf, sizeof(buf), "%s/%s", valgrind_lib, stage2);
=20
- err =3D do_exec(buf, &info);
+ err =3D VG_(do_exec)(buf, &info);
=20
if (err !=3D 0) {
fprintf(stderr, "valgrind: failed to load %s: %s\n",
@@ -301,11 +301,11 @@
if (0) {
printf("---------- launch stage 2 ----------\n");
printf("eip=3D%p esp=3D%p\n", (void *)info.init_eip, esp);
- foreach_map(prmap, /*dummy*/NULL);
+ VG_(foreach_map)(prmap, /*dummy*/NULL);
}
=20
VG_(debugLog)(1, "stage1", "main2(): starting stage2\n");
- jump_and_switch_stacks(
+ VG_(jump_and_switch_stacks)(
(Addr) esp, /* stack */
(Addr) info.init_eip /* where to */
);
@@ -358,7 +358,7 @@
=20
/* move onto another stack so we can play with the main one */
VG_(debugLog)(1, "stage1", "main(): running main2() on new stack\n");
- jump_and_switch_stacks(
+ VG_(jump_and_switch_stacks)(
(Addr) stack + sizeof(stack), /* stack */
(Addr) main2 /* where to */
);
Modified: trunk/memcheck/tests/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/Makefile.am 2005-06-21 22:47:54 UTC (rev 3992)
+++ trunk/memcheck/tests/Makefile.am 2005-06-21 23:03:36 UTC (rev 3993)
@@ -202,5 +202,5 @@
=20
vgtest_ume_CFLAGS =3D -DVGA_$(VG_ARCH) -DVGO_$(VG_OS)
vgtest_ume_SOURCES =3D vgtest_ume.c
-vgtest_ume_LDADD =3D ../../coregrind/ume.o
+vgtest_ume_LDADD =3D ../../coregrind/m_ume.o
=20
Modified: trunk/memcheck/tests/vgtest_ume.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/vgtest_ume.c 2005-06-21 22:47:54 UTC (rev 3992)
+++ trunk/memcheck/tests/vgtest_ume.c 2005-06-21 23:03:36 UTC (rev 3993)
@@ -6,14 +6,14 @@
#include <assert.h>
#include <elf.h>
#include "../../include/pub_tool_basics.h"
-#include "../../coregrind/ume.h"
+#include "../../coregrind/pub_core_ume.h"
=20
#define STKSZ (64*1024)
=20
static void* init_sp;
=20
//-------------------------------------------------------------------
-// Test foreach_map()
+// Test VG_(foreach_map)()
//-------------------------------------------------------------------
=20
static int x[8];
@@ -36,12 +36,12 @@
=20
static void test__foreach_map(void)
{
- fprintf(stderr, "Calling foreach_map()\n");
- foreach_map(f, /*dummy*/NULL);
+ fprintf(stderr, "Calling VG_(foreach_map)()\n");
+ VG_(foreach_map)(f, /*dummy*/NULL);
}
=20
//-------------------------------------------------------------------
-// Test find_auxv()
+// Test VG_(find_auxv)()
//-------------------------------------------------------------------
=20
static void test__find_auxv(void)
@@ -50,8 +50,8 @@
=20
assert(init_sp !=3D NULL);
=20
- fprintf(stderr, "Calling find_auxv()\n");
- auxv =3D find_auxv((UWord*)init_sp);
+ fprintf(stderr, "Calling VG_(find_auxv)()\n");
+ auxv =3D VG_(find_auxv)((UWord*)init_sp);
=20
// Check the auxv value looks sane
assert((void*)auxv > (void*)init_sp);
@@ -72,7 +72,7 @@
}
=20
//-------------------------------------------------------------------
-// Test do_exec()
+// Test VG_(do_exec)()
//-------------------------------------------------------------------
=20
static void push_auxv(unsigned char **espp, int type, void *val)
@@ -103,8 +103,8 @@
info.exe_end =3D 0x50ffffff;
info.map_base =3D 0x51000000;
=20
- fprintf(stderr, "Calling do_exec(\"hello\")\n");
- err =3D do_exec("hello", &info);
+ fprintf(stderr, "Calling VG_(do_exec)(\"hello\")\n");
+ err =3D VG_(do_exec)("hello", &info);
assert(0 =3D=3D err);
=20
// printf("info.exe_base=3D%p exe_end=3D%p\n",=20
@@ -134,7 +134,7 @@
=20
// fprintf(stderr, "ume_go: %p %p\n", (void*)info.init_eip, (void*)esp=
);
=20
- jump_and_switch_stacks((Addr)esp, info.init_eip);
+ VG_(jump_and_switch_stacks)((Addr)esp, info.init_eip);
=20
assert(0); // UNREACHABLE
}
Modified: trunk/memcheck/tests/vgtest_ume.stderr.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/vgtest_ume.stderr.exp 2005-06-21 22:47:54 UTC (r=
ev 3992)
+++ trunk/memcheck/tests/vgtest_ume.stderr.exp 2005-06-21 23:03:36 UTC (r=
ev 3993)
@@ -1,4 +1,4 @@
-Calling foreach_map()
-Calling find_auxv()
-Calling do_exec("hello")
+Calling VG_(foreach_map)()
+Calling VG_(find_auxv)()
+Calling VG_(do_exec)("hello")
Hello, world!
|