Added VG_() prefixes to functions exported from m_ume to avoid

namespace pollution.

Also broadened a couple of _dl_* suppressions so that vgtest_ume
passes on my machine.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3993
This commit is contained in:
Nicholas Nethercote 2005-06-21 23:03:36 +00:00
parent 82a9510ad7
commit 514f201d55
7 changed files with 46 additions and 46 deletions

View File

@ -176,7 +176,7 @@ static int find_vdso(char *start, char *end, const char *perm,
/* Look for our AUXV table */
static int scan_auxv(void* init_sp)
{
struct ume_auxv *auxv = find_auxv((UWord*)init_sp);
struct ume_auxv *auxv = VG_(find_auxv)((UWord*)init_sp);
int padfile = -1, found = 0;
for (; auxv->a_type != AT_NULL; auxv++)
@ -215,7 +215,7 @@ static int scan_auxv(void* init_sp)
#if defined(VGP_ppc32_linux)
case AT_SYSINFO_EHDR:
VG_(vdso_base) = auxv->u.a_val;
foreach_map(find_vdso, NULL);
VG_(foreach_map)(find_vdso, NULL);
break;
#endif
}
@ -764,7 +764,7 @@ static Addr setup_client_stack(void* init_sp,
Addr cl_esp; /* client stack base (initial esp) */
/* use our own auxv as a prototype */
orig_auxv = find_auxv(init_sp);
orig_auxv = VG_(find_auxv)(init_sp);
/* ==================== compute sizes ==================== */
@ -1211,7 +1211,7 @@ static void load_client(char* cl_argv[], const char* exec, Int need_help,
} else {
Int ret;
VG_(clexecfd) = VG_(open)(exec, VKI_O_RDONLY, VKI_S_IRUSR);
ret = do_exec(exec, info);
ret = VG_(do_exec)(exec, info);
if (ret != 0) {
fprintf(stderr, "valgrind: do_exec(%s) failed: %s\n",
exec, strerror(ret));
@ -1280,7 +1280,7 @@ static void as_unpad(void *start, void *end, int padfile)
extra.killpad_padstat = &padstat;
extra.killpad_start = start;
extra.killpad_end = end;
foreach_map(killpad, &extra);
VG_(foreach_map)(killpad, &extra);
}
static void as_closepadfile(int padfile)

View File

@ -76,10 +76,10 @@ static void check_mmap(void* res, void* base, int len)
// '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 = buf;
@ -129,13 +129,13 @@ void foreach_map(int (*fn)(char *start, char *end,
/*------------------------------------------------------------*/
// __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) == stack
// 8(%esp) == 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 @@ asm(
// %rdi == stack
// %rsi == 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 @@ asm(
// %r3 == stack
// %r4 == 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 @@ asm(
/*--- Finding auxv on the stack ---*/
/*------------------------------------------------------------*/
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!)
@ -734,7 +734,7 @@ static int do_exec_inner(const char *exe, struct exeinfo *info)
// See ume.h for an indication of which entries of 'info' are inputs, which
// 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 = NULL;
info->interp_args = NULL;

View File

@ -45,10 +45,10 @@
/* 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);
/* 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 @@ void foreach_map(int (*fn)(char *start, char *end,
*/
extern
__attribute__((noreturn))
void jump_and_switch_stacks ( Addr stack, Addr dst );
void VG_(jump_and_switch_stacks) ( Addr stack, Addr dst );
/*------------------------------------------------------------*/
@ -95,7 +95,7 @@ struct exeinfo
// checks execute permissions, sets up interpreter if program is a script,
// reads headers, maps file into memory, and returns important info about
// the program.
extern int do_exec(const char *exe, struct exeinfo *info);
extern int VG_(do_exec)(const char *exe, struct exeinfo *info);
/*------------------------------------------------------------*/
/*--- Finding and dealing with auxv ---*/
@ -110,7 +110,7 @@ struct ume_auxv
} u;
};
extern struct ume_auxv *find_auxv(UWord* orig_esp);
extern struct ume_auxv *VG_(find_auxv)(UWord* orig_esp);
/* Our private auxv entries */
#define AT_UME_PADFD 0xff01 /* padding file fd */

View File

@ -85,7 +85,7 @@ static void *fix_auxv(void *v_init_esp, const struct exeinfo *info,
assert(&delta >= stack && &delta < &stack[sizeof(stack)/sizeof(*stack)]);
/* find the beginning of the AUXV table */
auxv = find_auxv(v_init_esp);
auxv = VG_(find_auxv)(v_init_esp);
/* 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 @@ void as_pad(void *start, void *end, int padfile)
extra.fillgap_end = end;
extra.fillgap_padfile = padfile;
foreach_map(fillgap, &extra);
VG_(foreach_map)(fillgap, &extra);
if (extra.fillgap_start < extra.fillgap_end) {
void* res = mmap(extra.fillgap_start,
@ -283,7 +283,7 @@ static void main2(void)
snprintf(buf, sizeof(buf), "%s/%s", valgrind_lib, stage2);
err = do_exec(buf, &info);
err = VG_(do_exec)(buf, &info);
if (err != 0) {
fprintf(stderr, "valgrind: failed to load %s: %s\n",
@ -301,11 +301,11 @@ static void main2(void)
if (0) {
printf("---------- launch stage 2 ----------\n");
printf("eip=%p esp=%p\n", (void *)info.init_eip, esp);
foreach_map(prmap, /*dummy*/NULL);
VG_(foreach_map)(prmap, /*dummy*/NULL);
}
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 @@ int main(int argc, char** argv)
/* 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 */
);

View File

@ -202,5 +202,5 @@ endif
vgtest_ume_CFLAGS = -DVGA_$(VG_ARCH) -DVGO_$(VG_OS)
vgtest_ume_SOURCES = vgtest_ume.c
vgtest_ume_LDADD = ../../coregrind/ume.o
vgtest_ume_LDADD = ../../coregrind/m_ume.o

View File

@ -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"
#define STKSZ (64*1024)
static void* init_sp;
//-------------------------------------------------------------------
// Test foreach_map()
// Test VG_(foreach_map)()
//-------------------------------------------------------------------
static int x[8];
@ -36,12 +36,12 @@ static int f(char *start, char *end, const char *perm, off_t off,
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);
}
//-------------------------------------------------------------------
// Test find_auxv()
// Test VG_(find_auxv)()
//-------------------------------------------------------------------
static void test__find_auxv(void)
@ -50,8 +50,8 @@ static void test__find_auxv(void)
assert(init_sp != NULL);
fprintf(stderr, "Calling find_auxv()\n");
auxv = find_auxv((UWord*)init_sp);
fprintf(stderr, "Calling VG_(find_auxv)()\n");
auxv = VG_(find_auxv)((UWord*)init_sp);
// Check the auxv value looks sane
assert((void*)auxv > (void*)init_sp);
@ -72,7 +72,7 @@ static void test__find_auxv(void)
}
//-------------------------------------------------------------------
// Test do_exec()
// Test VG_(do_exec)()
//-------------------------------------------------------------------
static void push_auxv(unsigned char **espp, int type, void *val)
@ -103,8 +103,8 @@ static void test__do_exec(void)
info.exe_end = 0x50ffffff;
info.map_base = 0x51000000;
fprintf(stderr, "Calling do_exec(\"hello\")\n");
err = do_exec("hello", &info);
fprintf(stderr, "Calling VG_(do_exec)(\"hello\")\n");
err = VG_(do_exec)("hello", &info);
assert(0 == err);
// printf("info.exe_base=%p exe_end=%p\n",
@ -134,7 +134,7 @@ static void test__do_exec(void)
// fprintf(stderr, "ume_go: %p %p\n", (void*)info.init_eip, (void*)esp);
jump_and_switch_stacks((Addr)esp, info.init_eip);
VG_(jump_and_switch_stacks)((Addr)esp, info.init_eip);
assert(0); // UNREACHABLE
}

View File

@ -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!