Author: florian
Date: Mon Sep 21 21:31:29 2015
New Revision: 15668
Log:
Remove unused include directives from priv_aspacemgr.h
Adjust up source files as needed.
Fix a few function parameter types.
Add ML_(am_write).
Modified:
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-common.c
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-dot.c
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segments.c
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segnames.c
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/priv_aspacemgr.h
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/unit-test/stubs.c
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-common.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-common.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-common.c Mon Sep 21 21:31:29 2015
@@ -37,7 +37,14 @@
************************************************************* */
#include "priv_aspacemgr.h"
-#include "config.h"
+#include "pub_core_vki.h" // VKI_PAGE_SIZE
+#include "pub_core_libcbase.h" // VG_IS_PAGE_ALIGNED
+#include "pub_core_libcassert.h" // VG_(exit_now)
+#include "pub_core_syscall.h" // VG_(do_syscallN)
+#include "pub_core_vkiscnums.h" // system call numbers
+#include "pub_core_debuglog.h" // VG_(debugLog)
+#include "pub_core_options.h" // VG_(clo_valgrind_stacksize)
+#include "config.h" // HAVE_REMAP
/*-----------------------------------------------------------------*/
@@ -93,7 +100,6 @@
return sr_Res(sres);
}
-
//--------------------------------------------------------------
// A simple sprintf implementation, so as to avoid dependence on
// m_libcprint.
@@ -281,18 +287,24 @@
return res;
}
-Int ML_(am_read) ( Int fd, void* buf, Int count)
+Int ML_(am_read) ( Int fd, void* buf, SizeT count)
{
SysRes res = VG_(do_syscall3)(__NR_read, fd, (UWord)buf, count);
return sr_isError(res) ? -1 : sr_Res(res);
}
+Int ML_(am_write) ( Int fd, const void *buf, SizeT count)
+{
+ SysRes res = VG_(do_syscall3)(__NR_write, fd, (UWord)buf, count);
+ return sr_isError(res) ? -1 : sr_Res(res);
+}
+
void ML_(am_close) ( Int fd )
{
(void)VG_(do_syscall1)(__NR_close, fd);
}
-Int ML_(am_readlink)(const HChar* path, HChar* buf, UInt bufsiz)
+Int ML_(am_readlink)(const HChar* path, HChar* buf, SizeT bufsiz)
{
SysRes res;
# if defined(VGP_arm64_linux)
@@ -350,7 +362,7 @@
return False;
}
-Bool ML_(am_resolve_filename) ( Int fd, /*OUT*/HChar* buf, Int nbuf )
+Bool ML_(am_resolve_filename)( Int fd, /*OUT*/HChar* buf, SizeT nbuf )
{
#if defined(VGO_linux)
Int i;
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-dot.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-dot.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-dot.c Mon Sep 21 21:31:29 2015
@@ -34,6 +34,9 @@
Function ML_(am_write_dot) is the single entry point here. */
#include "priv_aspacemgr.h"
+#include "pub_core_vki.h" // VKI_O_CREAT
+#include "pub_core_debuglog.h" // VG_(debugLog)
+
/* Output a character. Characters are written to a buffer which is flushed
when full or when C is the NUL character. */
@@ -43,7 +46,7 @@
static UInt num_char;
if (num_char == sizeof buf || c == '\0') {
- VG_(do_syscall3)(__NR_write, *(Int *)p, (UWord)buf, num_char);
+ ML_(am_write)(*(Int *)p, buf, num_char);
num_char = 0;
}
if (c != '\0') buf[num_char++] = c;
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c Mon Sep 21 21:31:29 2015
@@ -39,7 +39,13 @@
************************************************************* */
#include "priv_aspacemgr.h"
-#include "config.h"
+#include "pub_core_libcbase.h" // VG_(strcmp), etc
+#include "pub_core_vki.h" // VKI_PROT_EXEC, etc.
+#include "pub_core_debuglog.h" // VG_(debugLog)
+#include "pub_core_options.h" // VG_(clo_sanity_level)
+#include "pub_core_syscall.h" // SysRes
+#include "config.h" // HAVE_REMAP
+
/*-----------------------------------------------------------------*/
/*--- ---*/
@@ -559,29 +565,22 @@
a discrepancy is detected, but does not abort the system. Returned
Bool is False if a discrepancy was found. */
-Bool VG_(am_do_sync_check) ( const HChar* fn,
- const HChar* file, Int line )
+Bool VG_(am_do_sync_check)( const HChar* fn, const HChar* file, Int line )
{
sync_check_ok = True;
- if (0)
- VG_(debugLog)(0,"aspacem", "do_sync_check %s:%d\n", file,line);
- parse_procselfmaps( sync_check_mapping_callback,
- sync_check_gap_callback );
+ parse_procselfmaps( sync_check_mapping_callback, sync_check_gap_callback );
+
if (!sync_check_ok) {
- VG_(debugLog)(0,"aspacem",
- "sync check at %s:%d (%s): FAILED\n",
+ VG_(debugLog)(0,"aspacem", "do_sync_check at %s:%d (%s): FAILED\n",
file, line, fn);
VG_(debugLog)(0,"aspacem", "\n");
# if 0
- {
- HChar buf[100]; // large enough
- VG_(am_show_nsegments)(0,"post syncheck failure");
- VG_(sprintf)(buf, "/bin/cat /proc/%d/maps", VG_(getpid)());
- VG_(system)(buf);
- }
+ HChar buf[100]; // large enough
+ VG_(am_show_nsegments)(0, "post do_sync_check failure");
+ ML_(am_sprintf)(buf, "/bin/cat /proc/%d/maps", ML_(am_getpid)());
+ VG_(system)(buf);
# endif
-
}
return sync_check_ok;
}
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segments.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segments.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segments.c Mon Sep 21 21:31:29 2015
@@ -45,6 +45,10 @@
*/
#include "priv_aspacemgr.h"
+#include "pub_core_vki.h" // VKI_PAGE_SIZE
+#include "pub_core_libcbase.h" // VG_IS_PAGE_ALIGNED
+#include "pub_core_debuglog.h" // VG_(debugLog)
+
#ifdef ASPACEMGR_UNIT_TEST
/* Remove the alignment test so we can have segments with intervals that
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segnames.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segnames.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-segnames.c Mon Sep 21 21:31:29 2015
@@ -114,8 +114,11 @@
So we leave it as is until a use case comes up that needs something better.
*/
-#include "pub_core_basics.h" // types
#include "priv_aspacemgr.h"
+#include "pub_core_basics.h" // types
+#include "pub_core_libcbase.h" // VG_(strlen)
+#include "pub_core_debuglog.h" // VG_(debugLog)
+
// A few constants.
enum {
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/priv_aspacemgr.h
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/priv_aspacemgr.h (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/priv_aspacemgr.h Mon Sep 21 21:31:29 2015
@@ -37,25 +37,7 @@
minimal set of imports. */
#include "pub_core_basics.h" // types
-#include "pub_core_vkiscnums.h" // system call numbers
-#include "pub_core_vki.h" // VKI_PAGE_SIZE, VKI_MREMAP_MAYMOVE,
- // VKI_MREMAP_FIXED, vki_stat64
-
-#include "pub_core_debuglog.h" // VG_(debugLog)
-
-#include "pub_core_libcbase.h" // VG_(strlen), VG_(strcmp), VG_(strncpy)
- // VG_IS_PAGE_ALIGNED
- // VG_PGROUNDDN, VG_PGROUNDUP
-
-#include "pub_core_libcassert.h" // VG_(exit_now)
-
-#include "pub_core_syscall.h" // VG_(do_syscallN)
- // VG_(mk_SysRes_Error)
- // VG_(mk_SysRes_Success)
-
-#include "pub_core_options.h" // VG_(clo_sanity_level)
-
-#include "pub_core_aspacemgr.h" // self
+#include "pub_core_aspacemgr.h" // NSegment
/* --------------- Implemented in aspacemgr-common.c ---------------*/
@@ -111,26 +93,25 @@
extern SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode );
extern void ML_(am_close) ( Int fd );
-extern Int ML_(am_read) ( Int fd, void* buf, Int count);
-extern Int ML_(am_readlink) ( const HChar* path, HChar* buf, UInt bufsiz );
+extern Int ML_(am_read) ( Int fd, void* buf, SizeT count);
+extern Int ML_(am_readlink) ( const HChar* path, HChar* buf, SizeT bufsiz );
extern Int ML_(am_fcntl) ( Int fd, Int cmd, Addr arg );
+extern Int ML_(am_write) ( Int fd, const void *buf, SizeT count);
/* Get the dev, inode and mode info for a file descriptor, if
possible. Returns True on success. */
-extern
Bool ML_(am_get_fd_d_i_m)( Int fd,
/*OUT*/ULong* dev,
/*OUT*/ULong* ino, /*OUT*/UInt* mode );
-extern
-Bool ML_(am_resolve_filename) ( Int fd, /*OUT*/HChar* buf, Int nbuf );
+Bool ML_(am_resolve_filename) ( Int fd, /*OUT*/HChar* buf, SizeT nbuf );
void ML_(am_show_len_concisely)( /*OUT*/HChar *buf, Addr start, Addr end );
/* ------ Implemented separately in aspacemgr-linux.c ------ */
/* Do a sanity check (/proc/self/maps sync check) */
-extern void ML_(am_do_sanity_check)( void );
+void ML_(am_do_sanity_check)( void );
/* ------ Implemented in aspacemgr-segnames.c ------ */
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/unit-test/stubs.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/unit-test/stubs.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/unit-test/stubs.c Mon Sep 21 21:31:29 2015
@@ -30,6 +30,7 @@
#include "pub_core_libcbase.h"
#include "pub_core_debuglog.h"
#include "pub_core_libcassert.h"
+#include "pub_core_syscall.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -180,7 +181,7 @@
return (SysRes){};
}
-Int ML_(am_read)( Int fd, void* buf, Int count )
+Int ML_(am_read)( Int fd, void* buf, SizeT count )
{
assert(0);
return 1;
@@ -201,7 +202,7 @@
assert(0);
}
-Bool ML_(am_resolve_filename)( Int fd, /*OUT*/HChar *buf, Int nbuf )
+Bool ML_(am_resolve_filename)( Int fd, /*OUT*/HChar *buf, SizeT nbuf )
{
assert(0);
return 1;
|