void read_unitinfo_dwarf2( /*OUT*/UnitInfo* ui,
UChar* unitblock_img,
UChar* debugabbrev_img,
- UChar* debugstr_img,
- struct _DebugInfo* di )
+ UChar* debugstr_img )
{
UInt acode, abcode;
ULong atoffs, blklen;
VG_(printf)( "Reading UnitInfo at 0x%lx.....\n",
block_img - debug_info_img + 0UL );
read_unitinfo_dwarf2( &ui, block_img,
- debug_abbv_img, debug_str_img, di );
+ debug_abbv_img, debug_str_img );
if (0)
VG_(printf)( " => LINES=0x%llx NAME=%s DIR=%s\n",
ui.stmt_list, ui.name, ui.compdir );
string *, int, int);
static int
-arm_pt (struct work_stuff *, const char *, int, const char **,
- const char **);
+arm_pt (const char *, int, const char **, const char **);
static int
demangle_class_name (struct work_stuff *, const char **, string *);
}
static int
-arm_pt (struct work_stuff *work, const char *mangled,
+arm_pt (const char *mangled,
int n, const char **anchor, const char **args)
{
/* Check if ARM template with "__pt__" in it ("parameterized type") */
return;
}
/* ARM template? (Also handles HP cfront extensions) */
- else if (arm_pt (work, *mangled, n, &p, &args))
+ else if (arm_pt (*mangled, n, &p, &args))
{
int hold_options;
string type_str;
/* The main processing for command line options. See comments above
on early_process_cmd_line_options.
*/
-static Bool main_process_cmd_line_options( UInt* client_auxv,
- const HChar* toolname )
+static Bool main_process_cmd_line_options( const HChar* toolname )
{
// VG_(clo_log_fd) is used by all the messaging. It starts as 2 (stderr)
// and we cannot change it until we know what we are changing it to is
{
HChar* toolname = "memcheck"; // default to Memcheck
Int need_help = 0; // 0 = no, 1 = --help, 2 = --help-debug
- UInt* client_auxv = NULL;
ThreadId tid_main = VG_INVALID_THREADID;
Int loglevel, i;
Bool logging_to_fd;
VG_(debugLog)(1, "main",
"(main_) Process Valgrind's command line options, "
"setup logging\n");
- logging_to_fd = main_process_cmd_line_options(client_auxv, toolname);
+ logging_to_fd = main_process_cmd_line_options(toolname);
//--------------------------------------------------------------
// Zeroise the millisecond counter by doing a first read of it.
// Read and write the lower and upper red-zone bytes of a block.
static __inline__
-void set_rz_lo_byte ( Arena* a, Block* b, UInt rz_byteno, UByte v )
+void set_rz_lo_byte ( Block* b, UInt rz_byteno, UByte v )
{
UByte* b2 = (UByte*)b;
b2[hp_overhead_szB() + sizeof(SizeT) + rz_byteno] = v;
}
static __inline__
-void set_rz_hi_byte ( Arena* a, Block* b, UInt rz_byteno, UByte v )
+void set_rz_hi_byte ( Block* b, UInt rz_byteno, UByte v )
{
UByte* b2 = (UByte*)b;
b2[get_bszB(b) - sizeof(SizeT) - rz_byteno - 1] = v;
}
static __inline__
-UByte get_rz_lo_byte ( Arena* a, Block* b, UInt rz_byteno )
+UByte get_rz_lo_byte ( Block* b, UInt rz_byteno )
{
UByte* b2 = (UByte*)b;
return b2[hp_overhead_szB() + sizeof(SizeT) + rz_byteno];
}
static __inline__
-UByte get_rz_hi_byte ( Arena* a, Block* b, UInt rz_byteno )
+UByte get_rz_hi_byte ( Block* b, UInt rz_byteno )
{
UByte* b2 = (UByte*)b;
return b2[get_bszB(b) - sizeof(SizeT) - rz_byteno - 1];
// to get_rz_hi_byte().
if (!a->clientmem && is_inuse_block(b)) {
for (i = 0; i < a->rz_szB; i++) {
- if (get_rz_lo_byte(a, b, i) !=
+ if (get_rz_lo_byte(b, i) !=
(UByte)(((Addr)b&0xff) ^ REDZONE_LO_MASK))
{BLEAT("redzone-lo");return False;}
- if (get_rz_hi_byte(a, b, i) !=
+ if (get_rz_hi_byte(b, i) !=
(UByte)(((Addr)b&0xff) ^ REDZONE_HI_MASK))
{BLEAT("redzone-hi");return False;}
}
set_next_b(b, NULL); // ditto
if (!a->clientmem) {
for (i = 0; i < a->rz_szB; i++) {
- set_rz_lo_byte(a, b, i, (UByte)(((Addr)b&0xff) ^ REDZONE_LO_MASK));
- set_rz_hi_byte(a, b, i, (UByte)(((Addr)b&0xff) ^ REDZONE_HI_MASK));
+ set_rz_lo_byte(b, i, (UByte)(((Addr)b&0xff) ^ REDZONE_LO_MASK));
+ set_rz_hi_byte(b, i, (UByte)(((Addr)b&0xff) ^ REDZONE_HI_MASK));
}
}
# ifdef DEBUG_MALLOC
/* Set the standard set of blocked signals, used whenever we're not
running a client syscall. */
-static void block_signals(ThreadId tid)
+static void block_signals(void)
{
vki_sigset_t mask;
handler to longjmp. */
vg_assert(trc == 0);
trc = VG_TRC_FAULT_SIGNAL;
- block_signals(tid);
+ block_signals();
}
done_this_time = (Int)dispatch_ctr_SAVED - (Int)VG_(dispatch_ctr) - 0;
handler to longjmp. */
vg_assert(argblock[2] == 0); /* next guest IP was not written */
vg_assert(argblock[3] == 0); /* trc was not written */
- block_signals(tid);
+ block_signals();
retval = VG_TRC_FAULT_SIGNAL;
} else {
/* store away the guest program counter */
vg_assert(VG_(is_running_thread)(tid));
if (jumped) {
- block_signals(tid);
+ block_signals();
VG_(poll_signals)(tid);
}
}
print_sched_event(tid, "entering VG_(scheduler)");
/* set the proper running signal mask */
- block_signals(tid);
+ block_signals();
vg_assert(VG_(is_running_thread)(tid));
static void build_vg_sigframe(struct vg_sigframe *frame,
ThreadState *tst,
- const vki_sigset_t *mask,
UInt flags,
Int sigNo)
{
Addr esp_top_of_frame,
const vki_siginfo_t *siginfo,
const struct vki_ucontext *siguc,
- void *handler, UInt flags,
+ UInt flags,
const vki_sigset_t *mask,
void *restorer)
{
VG_TRACK( post_mem_write, Vg_CoreSignal, tst->tid,
esp, offsetof(struct sigframe, vg) );
- build_vg_sigframe(&frame->vg, tst, mask, flags, sigNo);
+ build_vg_sigframe(&frame->vg, tst, flags, sigNo);
return esp;
}
Addr esp_top_of_frame,
const vki_siginfo_t *siginfo,
const struct vki_ucontext *siguc,
- void *handler, UInt flags,
+ UInt flags,
const vki_sigset_t *mask,
void *restorer)
{
VG_TRACK( post_mem_write, Vg_CoreSignal, tst->tid,
esp, offsetof(struct rt_sigframe, vg) );
- build_vg_sigframe(&frame->vg, tst, mask, flags, sigNo);
+ build_vg_sigframe(&frame->vg, tst, flags, sigNo);
return esp;
}
if (flags & VKI_SA_SIGINFO)
esp = build_rt_sigframe(tst, esp_top_of_frame, siginfo, siguc,
- handler, flags, mask, restorer);
+ flags, mask, restorer);
else
esp = build_sigframe(tst, esp_top_of_frame, siginfo, siguc,
- handler, flags, mask, restorer);
+ flags, mask, restorer);
/* Set the thread so it will next run the handler. */
/* tst->m_esp = esp; also notify the tool we've updated ESP */
void notify_aspacem_of_mmap(Addr a, SizeT len, UInt prot,
UInt flags, Int fd, Off64T offset);
static
-void notify_tool_of_mmap(Addr a, SizeT len, UInt prot, Off64T offset,
- ULong di_handle);
+void notify_tool_of_mmap(Addr a, SizeT len, UInt prot, ULong di_handle);
/* Returns True iff address range is something the client can
UInt flags, Int fd, Off64T offset )
{
notify_aspacem_of_mmap(a, len, prot, flags, fd, offset);
- notify_tool_of_mmap(a, len, prot, offset, 0/*di_handle*/);
+ notify_tool_of_mmap(a, len, prot, 0/*di_handle*/);
}
static
}
static
-void notify_tool_of_mmap(Addr a, SizeT len, UInt prot, Off64T offset,
- ULong di_handle)
+void notify_tool_of_mmap(Addr a, SizeT len, UInt prot, ULong di_handle)
{
Bool rr, ww, xx;
/* Note the fact that a file descriptor was just closed. */
static
-void record_fd_close(ThreadId tid, Int fd)
+void record_fd_close(Int fd)
{
OpenFd *i = allocated_fds;
(Addr)sres.res, /* addr kernel actually assigned */
arg2, /* length */
arg3, /* prot */
- arg6, /* offset */
di_handle /* so the tool can refer to the read debuginfo later,
if it wants. */
);
POST(sys_close)
{
- if (VG_(clo_track_fds)) record_fd_close(tid, ARG1);
+ if (VG_(clo_track_fds)) record_fd_close(ARG1);
}
PRE(sys_dup)
/* Add and remove signals from mask so that we end up telling the
kernel the state we actually want rather than what the client
wants. */
-static void sanitize_client_sigmask(ThreadId tid, vki_sigset_t *mask)
+static void sanitize_client_sigmask(vki_sigset_t *mask)
{
VG_(sigdelset)(mask, VKI_SIGKILL);
VG_(sigdelset)(mask, VKI_SIGSTOP);
PRINT(" --> [async] ... \n");
mask = tst->sig_mask;
- sanitize_client_sigmask(tid, &mask);
+ sanitize_client_sigmask(&mask);
/* Gack. More impedance matching. Copy the possibly
modified syscall args back into the guest state. */
VG_(add_to_unredir_transtab)( &vge,
nraddr,
(Addr)(&tmpbuf[0]),
- tmpbuf_used,
- do_self_check );
+ tmpbuf_used );
}
}
void VG_(add_to_unredir_transtab)( VexGuestExtents* vge,
Addr64 entry,
AddrH code,
- UInt code_len,
- Bool is_self_checking )
+ UInt code_len )
{
Int i, j, code_szQ;
HChar *srcP, *dstP;
void VG_(add_to_unredir_transtab)( VexGuestExtents* vge,
Addr64 entry,
AddrH code,
- UInt code_len,
- Bool is_self_checking );
+ UInt code_len );
extern
Bool VG_(search_unredir_transtab) ( /*OUT*/AddrH* result,
Addr64 guest_addr );
/* --- Called from non-generated code --- */
-/* This is for memory errors in pthread functions, as opposed to pthread API
- errors which are found by the core. */
-void MC_(record_core_mem_error) ( ThreadId tid, Bool isAddrErr, Char* msg )
+/* This is for memory errors in signal-related memory. */
+void MC_(record_core_mem_error) ( ThreadId tid, Char* msg )
{
VG_(maybe_record_error)( tid, Err_CoreMem, /*addr*/0, msg, /*extra*/NULL );
}
void* MC_(new_block) ( ThreadId tid,
- Addr p, SizeT size, SizeT align, UInt rzB,
+ Addr p, SizeT size, SizeT align,
Bool is_zeroed, MC_AllocKind kind,
VgHashTable table);
void MC_(handle_free) ( ThreadId tid,
void MC_(record_overlap_error) ( ThreadId tid, Char* function,
Addr src, Addr dst, SizeT szB );
-void MC_(record_core_mem_error) ( ThreadId tid, Bool isAddrErr, Char* msg );
+void MC_(record_core_mem_error) ( ThreadId tid, Char* msg );
void MC_(record_regparam_error) ( ThreadId tid, Char* msg, UInt otag );
void MC_(record_memparam_error) ( ThreadId tid, Addr a,
Bool isAddrErr, Char* msg, UInt otag );
break;
case Vg_CoreSignal:
- MC_(record_core_mem_error)( tid, /*isAddrErr*/True, s );
+ MC_(record_core_mem_error)( tid, s );
break;
default:
but we took them out because they ranged from not-very-helpful to
downright annoying, and they complicated the error data structures. */
static Int mc_get_or_set_vbits_for_client (
- ThreadId tid,
Addr a,
Addr vbits,
SizeT szB,
case VG_USERREQ__GET_VBITS:
*ret = mc_get_or_set_vbits_for_client
- ( tid, arg[1], arg[2], arg[3], False /* get them */ );
+ ( arg[1], arg[2], arg[3], False /* get them */ );
break;
case VG_USERREQ__SET_VBITS:
*ret = mc_get_or_set_vbits_for_client
- ( tid, arg[1], arg[2], arg[3], True /* set them */ );
+ ( arg[1], arg[2], arg[3], True /* set them */ );
break;
case VG_USERREQ__COUNT_LEAKS: { /* count leaked bytes */
case VG_USERREQ__MALLOCLIKE_BLOCK: {
Addr p = (Addr)arg[1];
SizeT sizeB = arg[2];
- UInt rzB = arg[3];
+ //UInt rzB = arg[3]; XXX: unused!
Bool is_zeroed = (Bool)arg[4];
- MC_(new_block) ( tid, p, sizeB, /*ignored*/0, rzB, is_zeroed,
+ MC_(new_block) ( tid, p, sizeB, /*ignored*/0, is_zeroed,
MC_AllocCustom, MC_(malloc_list) );
return True;
}
/* Allocate memory and note change in memory available */
void* MC_(new_block) ( ThreadId tid,
- Addr p, SizeT szB, SizeT alignB, UInt rzB,
+ Addr p, SizeT szB, SizeT alignB,
Bool is_zeroed, MC_AllocKind kind, VgHashTable table)
{
ExeContext* ec;
return NULL;
} else {
return MC_(new_block) ( tid, 0, n, VG_(clo_alignment),
- MC_MALLOC_REDZONE_SZB, /*is_zeroed*/False, MC_AllocMalloc,
- MC_(malloc_list));
+ /*is_zeroed*/False, MC_AllocMalloc, MC_(malloc_list));
}
}
return NULL;
} else {
return MC_(new_block) ( tid, 0, n, VG_(clo_alignment),
- MC_MALLOC_REDZONE_SZB, /*is_zeroed*/False, MC_AllocNew,
- MC_(malloc_list));
+ /*is_zeroed*/False, MC_AllocNew, MC_(malloc_list));
}
}
return NULL;
} else {
return MC_(new_block) ( tid, 0, n, VG_(clo_alignment),
- MC_MALLOC_REDZONE_SZB, /*is_zeroed*/False, MC_AllocNewVec,
- MC_(malloc_list));
+ /*is_zeroed*/False, MC_AllocNewVec, MC_(malloc_list));
}
}
return NULL;
} else {
return MC_(new_block) ( tid, 0, n, alignB,
- MC_MALLOC_REDZONE_SZB, /*is_zeroed*/False, MC_AllocMalloc,
- MC_(malloc_list));
+ /*is_zeroed*/False, MC_AllocMalloc, MC_(malloc_list));
}
}
return NULL;
} else {
return MC_(new_block) ( tid, 0, nmemb*size1, VG_(clo_alignment),
- MC_MALLOC_REDZONE_SZB, /*is_zeroed*/True, MC_AllocMalloc,
- MC_(malloc_list));
+ /*is_zeroed*/True, MC_AllocMalloc, MC_(malloc_list));
}
}
MC_(record_illegal_mempool_error) ( tid, pool );
} else {
check_mempool_sane(mp);
- MC_(new_block)(tid, addr, szB, /*ignored*/0, mp->rzB, mp->is_zeroed,
+ MC_(new_block)(tid, addr, szB, /*ignored*/0, mp->is_zeroed,
MC_AllocCustom, mp->chunks);
check_mempool_sane(mp);
}