diff --git a/NEWS b/NEWS index ce6cc7130..fdeebfaea 100644 --- a/NEWS +++ b/NEWS @@ -664,7 +664,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 471311 gdb --multi mode stdout redirecting to stderr 471807 Add support for lazy reading and downloading of DWARF debuginfo 472219 Syscall param ppoll(ufds.events) points to uninitialised byte(s) -472875 none/tests/s390x/dfp-1 failure +472875 none/tests/s390x/dfp-1 failure 472963 Broken regular expression in configure.ac 473604 Fix bug472219.c compile failure with Clang 16 473677 make check compile failure with Clang 16 based on GCC 13.x @@ -854,7 +854,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 444568 drd/tests/pth_barrier_thr_cr fails on Fedora 38 445743 "The impossible happened: mutex is locked simultaneously by two threads" while using mutexes with priority inheritance and signals -449309 Missing loopback device ioctl(s) +449309 Missing loopback device ioctl(s) 459476 vgdb: allow address reuse to avoid "address already in use" errorsuse" errors 460356 s390: Sqrt32Fx4 -- cannot reduce tree 462830 WARNING: unhandled amd64-freebsd syscall: 474 @@ -931,7 +931,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 453055 shared_timed_mutex drd test fails with "Lock shared failed" message 453602 Missing command line option to enable/disable debuginfod 452802 Handle lld 9+ split RW PT_LOAD segments correctly -454040 s390x: False-positive memcheck:cond in memmem on arch13 systems +454040 s390x: False-positive memcheck:cond in memmem on arch13 systems 456171 [PATCH] FreeBSD: Don't record address errors when accessing the 'kern.ps_strings' sysctl struct n-i-bz Implement vgdb invoker on FreeBSD 458845 PowerPC: The L field for the dcbf and sync instruction should be diff --git a/callgrind/bbcc.c b/callgrind/bbcc.c index 47149c62f..910d49419 100644 --- a/callgrind/bbcc.c +++ b/callgrind/bbcc.c @@ -179,7 +179,7 @@ BBCC* lookup_bbcc(BB* bb, Context* cxt) } CLG_DEBUG(2," lookup_bbcc(BB %#lx, Cxt %u, fn '%s'): %p (tid %u)\n", - bb_addr(bb), cxt->base_number, cxt->fn[0]->name, + bb_addr(bb), cxt->base_number, cxt->fn[0]->name, bbcc, bbcc ? bbcc->tid : 0); CLG_DEBUGIF(2) diff --git a/callgrind/dump.c b/callgrind/dump.c index 09a4a2152..155bd5d33 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -197,7 +197,7 @@ static void print_fn(VgFile *fp, const HChar* tag, const fn_node* fn) VG_(fprintf)(fp, "%s\n", fn->name); } -static void print_mangled_fn(VgFile *fp, const HChar* tag, +static void print_mangled_fn(VgFile *fp, const HChar* tag, Context* cxt, int rec_index) { int i; @@ -235,7 +235,7 @@ static void print_mangled_fn(VgFile *fp, const HChar* tag, if (rec_index >0) VG_(fprintf)(fp, "'%d", rec_index +1); for(i=1;isize;i++) - VG_(fprintf)(fp, "'(%u)", + VG_(fprintf)(fp, "'(%u)", cxt->fn[i]->pure_cxt->base_number); VG_(fprintf)(fp, "\n"); @@ -291,7 +291,7 @@ static Bool print_fn_pos(VgFile *fp, FnPos* last, BBCC* bbcc) last->cxt = 0; /* reprint context */ res = True; } - + if (last->cxt != bbcc->cxt) { fn_node* last_from = (last->cxt && last->cxt->size >1) ? last->cxt->fn[1] : 0; @@ -346,7 +346,7 @@ static Bool print_fn_pos(VgFile *fp, FnPos* last, BBCC* bbcc) last->cxt = bbcc->cxt; CLG_DEBUG(2, "- print_fn_pos: %s\n", res ? "changed" : ""); - + return res; } @@ -381,7 +381,7 @@ Bool get_debug_pos(BBCC* bbcc, Addr addr, AddrPos* p) Bool found_file_line; int cachepos = addr % DEBUG_CACHE_SIZE; - + if (debug_cache_addr[cachepos] == addr) { p->line = debug_cache_line[cachepos]; p->file = debug_cache_file[cachepos]; @@ -476,7 +476,7 @@ static void copy_apos(AddrPos* dst, AddrPos* src) dst->bb_addr = src->bb_addr; dst->file = src->file; dst->line = src->line; -} +} /* copy file position and init cost */ static void init_fcost(AddrCost* c, Addr addr, Addr bbaddr, file_node* file) @@ -554,7 +554,7 @@ void fprint_pos(VgFile *fp, const AddrPos* curr, const AddrPos* last) else { if (CLG_(clo).dump_instr) { int diff = curr->addr - last->addr; - if ( CLG_(clo).compress_pos && (last->addr >0) && + if ( CLG_(clo).compress_pos && (last->addr >0) && (diff > -100) && (diff < 100)) { if (diff >0) VG_(fprintf)(fp, "+%d ", diff); @@ -569,7 +569,7 @@ void fprint_pos(VgFile *fp, const AddrPos* curr, const AddrPos* last) if (CLG_(clo).dump_bb) { int diff = curr->bb_addr - last->bb_addr; - if ( CLG_(clo).compress_pos && (last->bb_addr >0) && + if ( CLG_(clo).compress_pos && (last->bb_addr >0) && (diff > -100) && (diff < 100)) { if (diff >0) VG_(fprintf)(fp, "+%d ", diff); @@ -584,7 +584,7 @@ void fprint_pos(VgFile *fp, const AddrPos* curr, const AddrPos* last) if (CLG_(clo).dump_line) { int diff = curr->line - last->line; - if ( CLG_(clo).compress_pos && (last->line >0) && + if ( CLG_(clo).compress_pos && (last->line >0) && (diff > -100) && (diff < 100)) { if (diff >0) @@ -627,7 +627,7 @@ static void fprint_fcost(VgFile *fp, AddrCost* c, AddrPos* last) c->p.file->name, c->p.line, c->p.bb_addr, c->p.addr); CLG_(print_cost)(-5, CLG_(sets).full, c->cost); } - + fprint_pos(fp, &(c->p), last); copy_apos( last, &(c->p) ); /* update last to current position */ @@ -654,17 +654,17 @@ static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last, CLG_ASSERT(jcc->to !=0); CLG_ASSERT(jcc->from !=0); - + if (!get_debug_pos(jcc->to, bb_addr(jcc->to->bb), &target)) { /* if we don't have debug info, don't switch to file "???" */ target.file = last->file; } if ((jcc->jmpkind == jk_CondJump) || (jcc->jmpkind == jk_Jump)) { - + /* this is a JCC for a followed conditional or boring jump. */ CLG_ASSERT(CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost)); - + /* objects among jumps should be the same. * Otherwise this jump would have been changed to a call * (see setup_bbcc) @@ -683,7 +683,7 @@ static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last, if (last->file != target.file) { print_file(fp, "jfi=", target.file); } - + if (jcc->from->cxt != jcc->to->cxt) { if (CLG_(clo).mangle_names) print_mangled_fn(fp, "jfn", @@ -691,7 +691,7 @@ static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last, else print_fn(fp, "jfn", jcc->to->cxt->fn[0]); } - + if (jcc->jmpkind == jk_CondJump) { /* format: jcnd=/ */ VG_(fprintf)(fp, "jcnd=%llu/%llu ", @@ -702,7 +702,7 @@ static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last, VG_(fprintf)(fp, "jump=%llu ", jcc->call_counter); } - + fprint_pos(fp, &target, last); VG_(fprintf)(fp, "\n"); fprint_pos(fp, curr, last); @@ -714,7 +714,7 @@ static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last, file = jcc->to->cxt->fn[0]->file; obj = jcc->to->bb->obj; - + /* object of called position different to object of this function?*/ if (jcc->from->cxt->fn[0]->file->obj != obj) { print_obj(fp, "cob=", obj); @@ -731,7 +731,7 @@ static void fprint_jcc(VgFile *fp, jCC* jcc, AddrPos* curr, AddrPos* last, print_fn(fp, "cfn", jcc->to->cxt->fn[0]); if (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost)) { - VG_(fprintf)(fp, "calls=%llu ", + VG_(fprintf)(fp, "calls=%llu ", jcc->call_counter); fprint_pos(fp, &target, last); @@ -804,7 +804,7 @@ static jCC* sort_jcc_list(jCC* head) { * Print all costs of a BBCC: * - FCCs of instructions * - JCCs of the unique jump of this BB - * returns True if something was written + * returns True if something was written */ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) { @@ -843,22 +843,22 @@ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) if (CLG_(clo).dump_bbs || CLG_(clo).dump_instr || (newCost->p.line != currCost->p.line) || (newCost->p.file != currCost->p.file)) { - + if (!CLG_(is_zero_cost)( CLG_(sets).full, currCost->cost )) { something_written = True; - + /* Output file position and inline function markers */ fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file, bbcc); fprint_fcost(fp, currCost, last); } - + /* switch buffers */ currSum = 1 - currSum; currCost = &(ccSum[currSum]); newCost = &(ccSum[1-currSum]); } - + /* add line cost to current cost sum */ (*CLG_(cachesim).add_icost)(currCost->cost, bbcc, instr_info, ecounter); @@ -870,7 +870,7 @@ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost ))) jcc_count++; - if (jcc_count>0) { + if (jcc_count>0) { if (!CLG_(is_zero_cost)( CLG_(sets).full, currCost->cost )) { /* no need to switch buffers, as position is the same */ fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file, bbcc); @@ -897,7 +897,7 @@ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) jmp++; } } - + /* jCCs at end? If yes, dump cumulated line info first */ jcc_count = 0; for(jcc=bbcc->jmp[jmp].jcc_list; jcc; jcc=jcc->next_from) { @@ -906,21 +906,21 @@ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost ))) jcc_count++; } - + if ( (bbcc->skipped && - !CLG_(is_zero_cost)(CLG_(sets).full, bbcc->skipped)) || + !CLG_(is_zero_cost)(CLG_(sets).full, bbcc->skipped)) || (jcc_count>0) ) { - + if (!CLG_(is_zero_cost)( CLG_(sets).full, currCost->cost )) { /* no need to switch buffers, as position is the same */ fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file, bbcc); fprint_fcost(fp, currCost, last); } - + get_debug_pos(bbcc, bb_jmpaddr(bb), &(currCost->p)); fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file, bbcc); something_written = True; - + /* first, print skipped costs for calls */ if (bbcc->skipped && !CLG_(is_zero_cost)( CLG_(sets).full, bbcc->skipped )) { @@ -939,7 +939,7 @@ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) CLG_ASSERT(jcc->jmp == jmp); if ( ((jcc->jmpkind != jk_Call) && (jcc->call_counter >0)) || (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost ))) - + fprint_jcc(fp, jcc, &(currCost->p), last, ecounter); } } @@ -948,25 +948,25 @@ static Bool fprint_bbcc(VgFile *fp, BBCC* bbcc, AddrPos* last) if (CLG_(clo).dump_bbs || CLG_(clo).dump_bb) { if (!CLG_(is_zero_cost)( CLG_(sets).full, currCost->cost )) { something_written = True; - + fprint_apos(fp, &(currCost->p), last, bbcc->cxt->fn[0]->file, bbcc); fprint_fcost(fp, currCost, last); } if (CLG_(clo).dump_bbs) VG_(fprintf)(fp, "\n"); - + /* when every cost was immediately written, we must have done so, * as this function is only called when there's cost in a BBCC */ CLG_ASSERT(something_written); } - + bbcc->ecounter_sum = 0; for(i=0; i<=bbcc->bb->cjmp_count; i++) bbcc->jmp[i].ecounter = 0; bbcc->ret_counter = 0; - + CLG_DEBUG(1, "- fprint_bbcc: JCCs %d\n", jcc_count); - + return something_written; } @@ -1072,7 +1072,7 @@ static void CLG_(qsort)(BBCC **a, int n, int (*cmp)(BBCC**,BBCC**)) for (pm = a; pm < a+n; pm++) { VG_(printf)(" %3ld BB %#lx, ", pm - qsort_start + 0L, - bb_addr((*pm)->bb)); + bb_addr((*pm)->bb)); CLG_(print_cxt)(9, (*pm)->cxt, (*pm)->rec_index); } } @@ -1100,14 +1100,14 @@ static void CLG_(qsort)(BBCC **a, int n, int (*cmp)(BBCC**,BBCC**)) while ((pb <= pc) && ((r=cmp(pb, pv)) <= 0)) { if (r==0) { /* same as pivot, to start */ - swap(pa,pb); pa++; + swap(pa,pb); pa++; } pb ++; } while ((pb <= pc) && ((r=cmp(pc, pv)) >= 0)) { if (r==0) { /* same as pivot, to end */ - swap(pc,pd); pd--; + swap(pc,pd); pd--; } pc --; } @@ -1122,7 +1122,7 @@ static void CLG_(qsort)(BBCC **a, int n, int (*cmp)(BBCC**,BBCC**)) /* put pivot from start into middle */ if ((s = pa-a)>0) { for(r=0;r0) { for(r=0;r0) { for(r=0;rbb)); @@ -1188,18 +1188,18 @@ static void cs_addCount(thread_info* ti) /* add BBCCs with active call in call stack of current thread. * update cost sums for active calls */ - + for(i = 0; i < CLG_(current_call_stack).sp; i++) { call_entry* e = &(CLG_(current_call_stack).entry[i]); if (e->jcc == 0) continue; - + CLG_(add_diff_cost_lz)( CLG_(sets).full, &(e->jcc->cost), e->enter_cost, CLG_(current_state).cost); bbcc = e->jcc->from; CLG_DEBUG(1, " [%2d] (tid %u), added active: %s\n", i,CLG_(current_tid),bbcc->cxt->fn[0]->name); - + if (bbcc->ecounter_sum>0 || bbcc->ret_counter>0) { /* already counted */ continue; @@ -1216,13 +1216,13 @@ static void cs_addPtr(thread_info* ti) /* add BBCCs with active call in call stack of current thread. * update cost sums for active calls */ - + for(i = 0; i < CLG_(current_call_stack).sp; i++) { call_entry* e = &(CLG_(current_call_stack).entry[i]); if (e->jcc == 0) continue; bbcc = e->jcc->from; - + if (bbcc->ecounter_sum>0 || bbcc->ret_counter>0) { /* already counted */ continue; @@ -1236,7 +1236,7 @@ static void cs_addPtr(thread_info* ti) /** * Put all BBCCs with costs into a sorted array. - * The returned arrays ends with a null pointer. + * The returned arrays ends with a null pointer. * Must be freed after dumping. */ static @@ -1245,7 +1245,7 @@ BBCC** prepare_dump(void) BBCC **array; prepare_count = 0; - + /* if we do not separate among threads, this gives all */ /* count number of BBCCs with >0 executions */ CLG_(forall_bbccs)(hash_addCount); @@ -1262,7 +1262,7 @@ BBCC** prepare_dump(void) /* allocate bbcc array, insert BBCCs and sort */ prepare_ptr = array = (BBCC**) CLG_MALLOC("cl.dump.pd.1", - (prepare_count+1) * sizeof(BBCC*)); + (prepare_count+1) * sizeof(BBCC*)); CLG_(forall_bbccs)(hash_addPtr); @@ -1376,7 +1376,7 @@ static VgFile *new_dumpfile(thread_info* ti, const HChar* trigger) if (!CLG_(clo).combine_dumps) { i = VG_(sprintf)(filename, "%s", out_file); - + if (trigger) i += VG_(sprintf)(filename+i, ".%d", out_counter); @@ -1484,7 +1484,7 @@ static VgFile *new_dumpfile(thread_info* ti, const HChar* trigger) if (fnc->dump_at_enter) { VG_(fprintf)(fp, "desc: Option: --fn-dump-at-enter=%s\n", fnc->name); - } + } if (fnc->dump_at_leave) { VG_(fprintf)(fp, "desc: Option: --fn-dump-at-leave=%s\n", fnc->name); @@ -1492,11 +1492,11 @@ static VgFile *new_dumpfile(thread_info* ti, const HChar* trigger) if (fnc->separate_callers != CLG_(clo).separate_callers) { VG_(fprintf)(fp, "desc: Option: --separate-callers%d=%s\n", fnc->separate_callers, fnc->name); - } + } if (fnc->separate_recursions != CLG_(clo).separate_recursions) { VG_(fprintf)(fp, "desc: Option: --separate-recs%d=%s\n", fnc->separate_recursions, fnc->name); - } + } fnc = fnc->next; } } @@ -1575,7 +1575,7 @@ static void close_dumpfile(VgFile *fp) fprint_cost_ln(fp, "totals: ", CLG_(dumpmap), dump_total_cost); //fprint_fcc_ln(fp, "summary: ", &dump_total_fcc); - CLG_(add_cost_lz)(CLG_(sets).full, + CLG_(add_cost_lz)(CLG_(sets).full, &CLG_(total_cost), dump_total_cost); VG_(fclose)(fp); @@ -1649,7 +1649,7 @@ static void print_bbccs_of_thread(thread_info* ti) while(1) { /* on context/function change, print old cost buffer before */ - if (lastFnPos.cxt && ((*p==0) || + if (lastFnPos.cxt && ((*p==0) || (lastFnPos.cxt != (*p)->cxt) || (lastFnPos.rec_index != (*p)->rec_index))) { if (!CLG_(is_zero_cost)( CLG_(sets).full, ccSum[currSum].cost )) { @@ -1658,18 +1658,18 @@ static void print_bbccs_of_thread(thread_info* ti) lastFnPos.cxt->fn[0]->file, 0); fprint_fcost(print_fp, &ccSum[currSum], &lastAPos); } - + if (ccSum[currSum].p.file != lastFnPos.cxt->fn[0]->file) { /* switch back to file of function */ print_file(print_fp, "fe=", lastFnPos.cxt->fn[0]->file); } VG_(fprintf)(print_fp, "\n"); } - + if (*p == 0) break; - + if (print_fn_pos(print_fp, &lastFnPos, *p)) { - + /* new function */ init_apos(&lastAPos, 0, 0, (*p)->cxt->fn[0]->file); init_fcost(&ccSum[0], 0, 0, 0); @@ -1677,31 +1677,31 @@ static void print_bbccs_of_thread(thread_info* ti) currSum = 0; last_inline_fn = 0; /* reset inline function tracking */ } - + if (CLG_(clo).dump_bbs) { /* FIXME: Specify Object of BB if different to object of fn */ int i; ULong ecounter = (*p)->ecounter_sum; VG_(fprintf)(print_fp, "bb=%#lx ", (UWord)(*p)->bb->offset); for(i = 0; i<(*p)->bb->cjmp_count;i++) { - VG_(fprintf)(print_fp, "%u %llu ", + VG_(fprintf)(print_fp, "%u %llu ", (*p)->bb->jmp[i].instr, ecounter); ecounter -= (*p)->jmp[i].ecounter; } - VG_(fprintf)(print_fp, "%u %llu\n", + VG_(fprintf)(print_fp, "%u %llu\n", (*p)->bb->instr_count, ecounter); } - + fprint_bbcc(print_fp, *p, &lastAPos); - + p++; } close_dumpfile(print_fp); VG_(free)(array); - + /* set counters of last dump */ CLG_(copy_cost)( CLG_(sets).full, ti->lastdump_cost, CLG_(current_state).cost ); @@ -1858,7 +1858,7 @@ void CLG_(init_dumps)(void) return; } thisPID = currentPID; - + if (!CLG_(clo).out_format) CLG_(clo).out_format = DEFAULT_OUTFORMAT; @@ -1876,20 +1876,20 @@ void CLG_(init_dumps)(void) /* allocate space big enough for final filenames */ filename = (HChar*) CLG_MALLOC("cl.dump.init_dumps.2", VG_(strlen)(out_file)+32); - + /* Make sure the output base file can be written. * This is used for the dump at program termination. * We stop with an error here if we can not create the * file: This is probably because of missing rights, * and trace parts wouldn't be allowed to be written, too. - */ + */ VG_(strcpy)(filename, out_file); res = VG_(open)(filename, VKI_O_WRONLY|VKI_O_TRUNC, 0); - if (sr_isError(res)) { + if (sr_isError(res)) { res = VG_(open)(filename, VKI_O_CREAT|VKI_O_WRONLY, VKI_S_IRUSR|VKI_S_IWUSR); if (sr_isError(res)) { - file_err(); + file_err(); } } if (!sr_isError(res)) VG_(close)( (Int)sr_Res(res) ); diff --git a/callgrind/global.h b/callgrind/global.h index 174672972..97a22bf25 100644 --- a/callgrind/global.h +++ b/callgrind/global.h @@ -104,10 +104,10 @@ struct _CommandLineOptions { Bool dump_instr; Bool dump_bb; Bool dump_bbs; /* Dump basic block information? */ - + /* Dump generation options */ ULong dump_every_bb; /* Dump every xxx BBs. */ - + /* Collection options */ Bool separate_threads; /* Separate threads in dump? */ Int separate_callers; /* Separate dependent on how many callers? */ @@ -162,7 +162,7 @@ struct _Statistics { ULong bb_executions; Int context_counter; - Int bb_retranslations; + Int bb_retranslations; Int distinct_objs; Int distinct_files; @@ -262,7 +262,7 @@ struct _jCC { }; -/* +/* * Info for one instruction of a basic block. */ typedef struct _InstrInfo InstrInfo; @@ -316,12 +316,12 @@ struct _BB { VgSectKind sect_kind; /* section of this BB, e.g. PLT */ UInt instr_count; - + /* filled by CLG_(get_fn_node) if debug info is available */ fn_node* fn; /* debug info for this BB */ UInt line; Bool is_entry; /* True if this BB is a function entry */ - + BBCC* bbcc_list; /* BBCCs for same BB (see next_bbcc in BBCC) */ BBCC* last_bbcc; /* Temporary: Cached for faster access (LRU) */ @@ -395,19 +395,19 @@ struct _BBCC { * across recycled valgrind ThreadId slots. * Only for lookup/assertion purposes. */ UInt rec_index; /* Recursion index in rec->bbcc for this bbcc */ - BBCC** rec_array; /* Variable sized array of pointers to + BBCC** rec_array; /* Variable sized array of pointers to * recursion BBCCs. Shared. */ ULong ret_counter; /* how often returned from jccs of this bbcc; * used to check if a dump for this BBCC is needed */ - + BBCC* next_bbcc; /* Chain of BBCCs for same BB */ BBCC* lru_next_bbcc; /* BBCC executed next the last time */ - + jCC* lru_from_jcc; /* Temporary: Cached for faster access (LRU) */ jCC* lru_to_jcc; /* Temporary: Cached for faster access (LRU) */ - FullCost skipped; /* cost for skipped functions called from + FullCost skipped; /* cost for skipped functions called from * jmp_addr. Allocated lazy */ - + BBCC* next; /* entry chain in hash */ ULong* cost; /* start of 64bit costs for this BBCC */ ULong ecounter_sum; /* execution counter for first instruction of BB */ @@ -482,7 +482,7 @@ struct _obj_node { * * is 0 if the function called is not skipped (usual case). * Otherwise, it is the last non-skipped BBCC. This one gets all - * the calls to non-skipped functions and all costs in skipped + * the calls to non-skipped functions and all costs in skipped * instructions. */ struct _call_entry { @@ -514,14 +514,14 @@ struct _exec_state { /* the signum of the handler, 0 for main thread context */ Int sig; - + /* the old call stack pointer at entering the signal handler */ Int orig_sp; - + FullCost cost; Bool collect; Context* cxt; - + /* number of conditional jumps passed in last BB */ Int jmps_passed; BBCC* bbcc; /* last BB executed */ @@ -541,7 +541,7 @@ typedef struct _cxt_hash cxt_hash; struct _cxt_hash { UInt size, entries; Context** table; -}; +}; /* Thread specific state structures, i.e. parts of a thread state. * There are variables for the current state of each part, @@ -590,7 +590,7 @@ struct _exec_stack { exec_state* entry[MAX_SIGHANDLERS]; }; -/* Thread State +/* Thread State * * This structure stores thread specific info while a thread is *not* * running. See function switch_thread() for save/restore on thread switch. @@ -676,7 +676,7 @@ struct cachesim_if void (*printstat)(Int,Int,Int); void (*add_icost)(SimCost, BBCC*, InstrInfo*, ULong); void (*finish)(void); - + void (*log_1I0D)(InstrInfo*) VG_REGPARM(1); void (*log_2I0D)(InstrInfo*, InstrInfo*) VG_REGPARM(2); void (*log_3I0D)(InstrInfo*, InstrInfo*, InstrInfo*) VG_REGPARM(3); diff --git a/callgrind/main.c b/callgrind/main.c index 54ecb178b..69af08255 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -706,8 +706,8 @@ void addEvent_D_guarded ( ClgState* clgs, InstrInfo* inode, ea, mkIRExpr_HWord( datasize ) ); regparms = 3; di = unsafeIRDirty_0_N( - regparms, - helperName, VG_(fnptr_to_fnentry)( helperAddr ), + regparms, + helperName, VG_(fnptr_to_fnentry)( helperAddr ), argv ); di->guard = guard; addStmtToIRSB( clgs->sbOut, IRStmt_Dirty(di) ); @@ -914,7 +914,7 @@ void addConstMemStoreStmt( IRSB* bbOut, UWord addr, UInt val, IRType hWordTy) IRConst_U32( addr ) : IRConst_U64( addr )), IRExpr_Const(IRConst_U32(val)) )); -} +} /* add helper call to setup_bbcc, with pointer to BB struct as argument @@ -999,7 +999,7 @@ IRSB* CLG_(instrument)( VgCallbackClosure* closure, CLG_ASSERT(Ist_IMark == st->tag); origAddr = st->Ist.IMark.addr + st->Ist.IMark.delta; - CLG_ASSERT(origAddr == st->Ist.IMark.addr + CLG_ASSERT(origAddr == st->Ist.IMark.addr + st->Ist.IMark.delta); // XXX: check no overflow /* Get BB struct (creating if necessary). @@ -1424,7 +1424,7 @@ static void zero_thread_cost(thread_info* t) if (!CLG_(current_call_stack).entry[i].jcc) continue; /* reset call counters to current for active calls */ - CLG_(copy_cost)( CLG_(sets).full, + CLG_(copy_cost)( CLG_(sets).full, CLG_(current_call_stack).entry[i].enter_cost, CLG_(current_state).cost ); CLG_(current_call_stack).entry[i].jcc->call_counter = 0; @@ -1433,7 +1433,7 @@ static void zero_thread_cost(thread_info* t) CLG_(forall_bbccs)(CLG_(zero_bbcc)); /* set counter for last dump */ - CLG_(copy_cost)( CLG_(sets).full, + CLG_(copy_cost)( CLG_(sets).full, t->lastdump_cost, CLG_(current_state).cost ); } @@ -1525,18 +1525,18 @@ static void dump_state_of_thread_togdb(thread_info* ti) ce = CLG_(get_call_entry)(i); /* if this frame is skipped, we don't have counters */ if (!ce->jcc) continue; - + from = ce->jcc->from; VG_(gdb_printf)("function-%d-%d: %s\n",t, i, from->cxt->fn[0]->name); VG_(gdb_printf)("calls-%d-%d: %llu\n",t, i, ce->jcc->call_counter); - + /* FIXME: EventSets! */ CLG_(copy_cost)( CLG_(sets).full, sum, ce->jcc->cost ); CLG_(copy_cost)( CLG_(sets).full, tmp, ce->enter_cost ); CLG_(add_diff_cost)( CLG_(sets).full, sum, ce->enter_cost, CLG_(current_state).cost ); CLG_(copy_cost)( CLG_(sets).full, ce->enter_cost, tmp ); - + mcost = CLG_(mappingcost_as_string)(CLG_(dumpmap), sum); VG_(gdb_printf)("events-%d-%d: %s\n",t, i, mcost); VG_(free)(mcost); @@ -1571,7 +1571,7 @@ static void dump_state_togdb(void) VG_(free)(evmap); /* "part:" line (number of last part. Is 0 at start */ VG_(gdb_printf)("part: %d\n", CLG_(get_dump_counter)()); - + /* threads */ th = CLG_(get_threads)(); VG_(gdb_printf)("threads:"); @@ -1584,7 +1584,7 @@ static void dump_state_togdb(void) CLG_(forall_threads)(dump_state_of_thread_togdb); } - + static void print_monitor_help ( void ) { VG_(gdb_printf) ("\n"); @@ -1610,7 +1610,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, const HChar *req) VG_(strcpy) (s, req); wcmd = VG_(strtok_r) (s, " ", &ssaveptr); - switch (VG_(keyword_id) ("help dump zero status instrumentation", + switch (VG_(keyword_id) ("help dump zero status instrumentation", wcmd, kwd_report_duplicated_matches)) { case -2: /* multiple matches */ return True; @@ -1660,7 +1660,7 @@ static Bool handle_gdb_monitor_command (ThreadId tid, const HChar *req) return True; } - default: + default: tl_assert(0); return False; } @@ -1674,7 +1674,7 @@ Bool CLG_(handle_client_request)(ThreadId tid, UWord *args, UWord *ret) return False; switch(args[0]) { - case VG_USERREQ__DUMP_STATS: + case VG_USERREQ__DUMP_STATS: CLG_(dump_profile)("Client Request", True); *ret = 0; /* meaningless */ break; @@ -2020,7 +2020,7 @@ void finish(void) CLG_(dump_profile)(0, False); if (VG_(clo_verbosity) == 0) return; - + if (VG_(clo_stats)) { VG_(message)(Vg_DebugMsg, "\n"); clg_print_stats(); @@ -2110,7 +2110,7 @@ void CLG_(post_clo_init)(void) CLG_DEBUG(1, " Using user specified value for " "--vex-iropt-register-updates\n"); } else { - CLG_DEBUG(1, + CLG_DEBUG(1, " Using default --vex-iropt-register-updates=" "sp-at-mem-access\n"); } @@ -2140,13 +2140,13 @@ void CLG_(post_clo_init)(void) CLG_DEBUG(1, " Using user specified value for " "--px-file-backed\n"); } else { - CLG_DEBUG(1, + CLG_DEBUG(1, " Using default --px-file-backed=" "sp-at-mem-access\n"); } if (VG_(clo_vex_control).iropt_unroll_thresh != 0) { - VG_(message)(Vg_UserMsg, + VG_(message)(Vg_UserMsg, "callgrind only works with --vex-iropt-unroll-thresh=0\n" "=> resetting it back to 0\n"); VG_(clo_vex_control).iropt_unroll_thresh = 0; // cannot be overridden. @@ -2157,7 +2157,7 @@ void CLG_(post_clo_init)(void) "=> resetting it back to 'no'\n"); VG_(clo_vex_control).guest_chase = False; // cannot be overridden. } - + CLG_DEBUG(1, " dump threads: %s\n", CLG_(clo).separate_threads ? "Yes":"No"); CLG_DEBUG(1, " call sep. : %d\n", CLG_(clo).separate_callers); CLG_DEBUG(1, " rec. sep. : %d\n", CLG_(clo).separate_recursions); diff --git a/configure.ac b/configure.ac index d67b72134..6b5a4b374 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ ##------------------------------------------------------------## -# +# # The multiple-architecture stuff in this file is pretty # cryptic. Read docs/internals/multiple-architectures.txt # for at least a partial explanation of what is going on. @@ -126,7 +126,7 @@ rm $tmpfile AC_MSG_CHECKING([for a supported version of gcc]) # Obtain the compiler version. -# +# # A few examples of how the ${CC} --version output looks like: # # ######## gcc variants ######## @@ -157,7 +157,7 @@ then is_clang="clang" # Don't use -dumpversion with clang: it will always produce "4.2.1". gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'` -elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ; +elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ; then is_clang="icc" gcc_version=`${CC} -dumpversion 2>/dev/null` @@ -224,12 +224,12 @@ AC_MSG_CHECKING([for a supported CPU]) VGCONF_PLATFORM_ARM_ARCH= case "${host_cpu}" in - i?86) + i?86) AC_MSG_RESULT([ok (${host_cpu})]) ARCH_MAX="x86" ;; - x86_64|amd64) + x86_64|amd64) AC_MSG_RESULT([ok (${host_cpu})]) ARCH_MAX="amd64" ;; @@ -314,7 +314,7 @@ case "${host_cpu}" in ARCH_MAX="riscv64" ;; - *) + *) AC_MSG_RESULT([no (${host_cpu})]) AC_MSG_ERROR([Unsupported host architecture. Sorry]) ;; @@ -337,14 +337,14 @@ CODSPEED_ONLY64BIT_DEFAULT # Check if a 64-bit only build has been requested AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit, - [AC_ARG_ENABLE(only64bit, + [AC_ARG_ENABLE(only64bit, [ --enable-only64bit do a 64-bit only build], [vg_cv_only64bit=$enableval], [vg_cv_only64bit=no])]) # Check if a 32-bit only build has been requested AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit, - [AC_ARG_ENABLE(only32bit, + [AC_ARG_ENABLE(only32bit, [ --enable-only32bit do a 32-bit only build], [vg_cv_only32bit=$enableval], [vg_cv_only32bit=no])]) @@ -376,7 +376,7 @@ case "${host_os}" in kernel=`uname -r` case "${kernel}" in - 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*) + 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*) AC_MSG_RESULT([unsupported (${kernel})]) AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6]) ;; @@ -415,7 +415,7 @@ case "${host_os}" in # has only one relevant version, the OS version. The `uname` check # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard, - # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion), + # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion), # and we don't know of an macros similar to __GLIBC__ to get that info. # # XXX: `uname -r` won't do the right thing for cross-compiles, but @@ -482,7 +482,7 @@ case "${host_os}" in DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}" DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; - *) + *) AC_MSG_RESULT([unsupported (${kernel})]) AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and 17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)]) ;; @@ -510,7 +510,7 @@ case "${host_os}" in DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}" ;; - *) + *) AC_MSG_RESULT([no (${host_os})]) AC_MSG_ERROR([Valgrind is operating system specific. Sorry.]) ;; @@ -595,7 +595,7 @@ AC_SUBST(VGCONF_PLATFORM_SEC_CAPS) AC_MSG_CHECKING([for a supported CPU/OS combination]) -# NB. The load address for a given platform may be specified in more +# NB. The load address for a given platform may be specified in more # than one place, in some cases, depending on whether we're doing a biarch, # 32-bit only or 64-bit only build. eg see case for amd64-linux below. # Be careful to give consistent values in all subcases. Also, all four @@ -786,7 +786,7 @@ case "$ARCH_MAX-$VGCONF_OS" in fi AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) ;; - arm-linux) + arm-linux) VGCONF_ARCH_PRI="arm" VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX" VGCONF_PLATFORM_SEC_CAPS="" @@ -838,7 +838,7 @@ case "$ARCH_MAX-$VGCONF_OS" in valt_load_address_sec_inner="0xUNSET" AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) ;; - mips32-linux) + mips32-linux) VGCONF_ARCH_PRI="mips32" VGCONF_ARCH_SEC="" VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX" @@ -958,7 +958,7 @@ esac # Set up VGCONF_ARCHS_INCLUDE_. Either one or two of these become # defined. -AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86, +AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86, test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \ @@ -967,21 +967,21 @@ AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86, -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \ -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \ -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS ) -AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64, +AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64, test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \ -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \ -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS ) -AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32, - test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ +AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32, + test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ) -AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64, +AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64, test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX ) -AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM, +AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM, test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX ) -AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64, +AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64, test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD ) AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X, @@ -990,7 +990,7 @@ AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32, test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX ) AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64, - test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ) + test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ) AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS, test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX ) AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_RISCV64, @@ -998,22 +998,22 @@ AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_RISCV64, # Set up VGCONF_PLATFORMS_INCLUDE_. Either one or two of these # become defined. -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX, +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX) -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX, +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX) -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX, - test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX, + test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX) AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX) AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX) -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX, +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX) -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX, +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX) AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \ @@ -1030,14 +1030,14 @@ AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_RISCV64_LINUX, AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD, test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \ -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD) -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD, +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD, test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD) -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD, +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD, test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD) AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN, test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN) -AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN, +AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN, test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN) AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS, test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \ @@ -1047,7 +1047,7 @@ AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS, # Similarly, set up VGCONF_OS_IS_. Exactly one of these becomes defined. -# Relies on the assumption that the primary and secondary targets are +# Relies on the assumption that the primary and secondary targets are # for the same OS, so therefore only necessary to test the primary. AM_CONDITIONAL(VGCONF_OS_IS_LINUX, test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ @@ -1094,7 +1094,7 @@ AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC, AC_SUBST(VALT_LOAD_ADDRESS_PRI) AC_SUBST(VALT_LOAD_ADDRESS_SEC) AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner, - [AC_ARG_ENABLE(inner, + [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting], [vg_cv_inner=$enableval], [vg_cv_inner=no])]) @@ -1113,7 +1113,7 @@ fi # Check whether we should build with the undefined beahviour sanitiser. AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan, - [AC_ARG_ENABLE(ubsan, + [AC_ARG_ENABLE(ubsan, [ --enable-ubsan enables the undefined behaviour sanitiser], [vg_cv_ubsan=$enableval], [vg_cv_ubsan=no])]) @@ -1600,7 +1600,7 @@ AC_MSG_RESULT([no]) AC_CHECK_MEMBER([pthread_mutex_t.__m_kind], [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], - 1, + 1, [Define to 1 if pthread_mutex_t has a member called __m_kind.]) ], [], @@ -2061,7 +2061,7 @@ safe_CXXFLAGS=$CXXFLAGS CXXFLAGS=-std=c++0x AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include +#include ])], [ ac_cxx_can_include_thread_header=yes @@ -2083,7 +2083,7 @@ safe_CXXFLAGS=$CXXFLAGS CXXFLAGS=-std=c++0x AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include +#include ])], [ ac_cxx_can_include_condition_variable_header=yes @@ -3246,8 +3246,8 @@ fi AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { long long int x; - __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } + do { long long int x; + __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } while (0) ]])], [ ac_have_as_sse3=yes @@ -3268,7 +3268,7 @@ AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3]) save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -msse -Werror" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { long long int x; + do { long long int x; __asm__ __volatile__( "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); } while (0) @@ -3355,7 +3355,7 @@ AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes) AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt']) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { + do { __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax"); } while (0) ]])], [ @@ -3375,7 +3375,7 @@ AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes]) AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel']) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { + do { __asm__ __volatile__("1: loopnel 1b\n"); } while (0) ]])], [ @@ -3395,7 +3395,7 @@ AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes]) AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32']) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { + do { asm volatile ("addr32 rep movsb"); } while (0) ]])], [ @@ -3415,11 +3415,11 @@ AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes]) AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { long long int x; + do { long long int x; __asm__ __volatile__( "crc32q %%r15,%%r15" : : : "r15" ); __asm__ __volatile__( - "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11"); + "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11"); __asm__ __volatile__( "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); } while (0) @@ -3440,7 +3440,7 @@ AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes) AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { long long int x; + do { long long int x; __asm__ __volatile__( "vmovupd (%%rsp), %%ymm7" : : : "xmm7" ); __asm__ __volatile__( @@ -3463,7 +3463,7 @@ AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes) AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { long long int x; + do { long long int x; __asm__ __volatile__( "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" ); __asm__ __volatile__( @@ -3672,7 +3672,7 @@ AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes) AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - do { long long int x; + do { long long int x; __asm__ __volatile__( "movbe (%%rsp), %%r15" : : : "memory", "r15" ); } while (0) @@ -4071,7 +4071,7 @@ AC_MSG_RESULT([no]) # AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include +#include ]], [[ return !SYS_lwp_sigqueue; ]])], [ @@ -4859,7 +4859,7 @@ if test "$VGCONF_OS" = "freebsd" ; then AC_CHECK_FUNCS([ \ eventfd ]) - + AM_CONDITIONAL([FREEBSD_EVENTFD], [test x$ac_cv_func_eventfd = xyes]) @@ -5145,7 +5145,7 @@ fi #---------------------------------------------------------------------------- # Do we have a useable MPI setup on the primary and/or secondary targets? # On Linux, by default, assumes mpicc and -m32/-m64 -# Note: this is a kludge in that it assumes the specified mpicc +# Note: this is a kludge in that it assumes the specified mpicc # understands -m32/-m64 regardless of what is specified using # --with-mpicc=. AC_PATH_PROG([MPI_CC], [mpicc], [mpicc], @@ -5232,7 +5232,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ int r = MPI_Init(NULL,NULL); r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb ); r |= MPI_Finalize(); - return r; + return r; ]])], [ ac_have_mpi2_pri=yes AC_MSG_RESULT([yes, $MPI_CC]) @@ -5269,7 +5269,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ int r = MPI_Init(NULL,NULL); r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb ); r |= MPI_Finalize(); - return r; + return r; ]])], [ ac_have_mpi2_sec=yes AC_MSG_RESULT([yes, $MPI_CC]) @@ -5316,7 +5316,7 @@ AM_CONDITIONAL(HAVE_STATIC_LIBC, test x$ac_have_static_libc = xyes) # in a situation (eg) where, on amd64-linux, the test for Boost checks # for usable 64-bit Boost facilities, but because we are doing a 32-bit # only build (meaning, the primary target is x86-linux), the build -# of the regtest programs that use Boost fails, because they are +# of the regtest programs that use Boost fails, because they are # build as 32-bit (IN THIS EXAMPLE). # # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES @@ -5370,7 +5370,7 @@ safe_CFLAGS=$CFLAGS CFLAGS="-fopenmp $mflag_primary -Werror" AC_LINK_IFELSE([AC_LANG_SOURCE([ -#include +#include int main(int argc, char** argv) { omp_set_dynamic(0); @@ -5556,7 +5556,7 @@ fi AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64], [test x$ac_have_builtin_atomic64 = xyes]) - + AC_MSG_CHECKING([if platform has openat2 syscall]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @@ -5766,7 +5766,7 @@ CFLAGS=$safe_CFLAGS # Nb: VEX/Makefile is generated from Makefile.vex.in. AC_CONFIG_FILES([ - Makefile + Makefile VEX/Makefile:Makefile.vex.in third_party/Makefile valgrind.spec @@ -5775,13 +5775,13 @@ AC_CONFIG_FILES([ glibc-2.X-helgrind.supp glibc-2.X-drd.supp include/valgrind.h - docs/Makefile + docs/Makefile docs/xml/vg-entities.xml - tests/Makefile - perf/Makefile + tests/Makefile + perf/Makefile gdbserver_tests/Makefile gdbserver_tests/solaris/Makefile - include/Makefile + include/Makefile auxprogs/Makefile mpi/Makefile coregrind/Makefile diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 97f98b62b..d42e8d48c 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -9,7 +9,7 @@ This file is part of Valgrind, a dynamic binary instrumentation framework. - Copyright (C) 2000-2017 Julian Seward + Copyright (C) 2000-2017 Julian Seward jseward@acm.org This program is free software; you can redistribute it and/or @@ -84,14 +84,14 @@ debuginfo reading confusing. Recently I arrived at some terminology which makes it clearer (to me, at least). There are 3 kinds of address used in the debuginfo reading process: - + stated VMAs - the address where (eg) a .so says a symbol is, that is, what it tells you if you consider the .so in isolation - + actual VMAs - the address where (eg) said symbol really wound up after the .so was mapped into memory - + image addresses - pointers into the copy of the .so (etc) transiently mmaped aboard whilst we read its info @@ -298,7 +298,7 @@ static void show_epochs ( const HChar* msg ) static ULong handle_counter = 1; /* Allocate and zero out a new DebugInfo record. */ -static +static DebugInfo* alloc_DebugInfo( const HChar* filename ) { Bool traceme; @@ -317,7 +317,7 @@ DebugInfo* alloc_DebugInfo( const HChar* filename ) /* Everything else -- pointers, sizes, arrays -- is zeroed by ML_(dinfo_zalloc). Now set up the debugging-output flags. */ - traceme + traceme = VG_(string_match)( VG_(clo_trace_symtab_patt), filename ); if (traceme) { di->trace_symtab = VG_(clo_trace_symtab); @@ -463,7 +463,7 @@ static void discard_or_archive_DebugInfo ( DebugInfo* di ) if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir)) VG_(dmsg)("%s syms at %#lx-%#lx in %s (have_dinfo %d)\n", archive ? "Archiving" : "Discarding", - di->text_avma, + di->text_avma, di->text_avma + di->text_size, curr->fsm.filename ? curr->fsm.filename : "???", @@ -541,7 +541,7 @@ static Bool discard_syms_in_range ( Addr start, SizeT length ) static Bool ranges_overlap (Addr s1, SizeT len1, Addr s2, SizeT len2 ) { Addr e1, e2; - if (len1 == 0 || len2 == 0) + if (len1 == 0 || len2 == 0) return False; e1 = s1 + len1 - 1; e2 = s2 + len2 - 1; @@ -832,7 +832,7 @@ static Bool overlaps_DebugInfoMappings ( const DebugInfoMapping* map1, /* Helper (indirect) for di_notify_ACHIEVE_ACCEPT_STATE */ -static void show_DebugInfoMappings +static void show_DebugInfoMappings ( const DebugInfo* di, /*MOD*/XArray* maps /* XArray */ ) { @@ -936,7 +936,7 @@ static void truncate_DebugInfoMapping_overlaps /* When the sequence of observations causes a DebugInfoFSM to move into the accept state, call here to actually get the debuginfo read - in. Returns a ULong whose purpose is described in comments + in. Returns a ULong whose purpose is described in comments preceding VG_(di_notify_mmap) just below. */ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di ) @@ -1156,7 +1156,7 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd ) if (debug) { VG_(dmsg)("di_notify_mmap-0:\n"); VG_(dmsg)("di_notify_mmap-1: %#lx-%#lx %c%c%c\n", - seg->start, seg->end, + seg->start, seg->end, seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',seg->hasX ? 'x' : '-' ); } @@ -1490,7 +1490,7 @@ void VG_(addr_load_di)( Addr a ) VG_(di_load_di)(di); } -/* Unmap is simpler - throw away any SegInfos intersecting +/* Unmap is simpler - throw away any SegInfos intersecting [a, a+len). */ void VG_(di_notify_munmap)( Addr a, SizeT len ) { @@ -1642,7 +1642,7 @@ void VG_(di_notify_pdb_debuginfo)( Int fd_obj, Addr avma_obj, VG_(message)(Vg_UserMsg, "\n"); VG_(message)(Vg_UserMsg, "LOAD_PDB_DEBUGINFO: clreq: fd=%d, avma=%#lx, total_size=%lu, " - "bias=%#lx\n", + "bias=%#lx\n", fd_obj, avma_obj, total_size, (UWord)bias_obj ); } @@ -1661,7 +1661,7 @@ void VG_(di_notify_pdb_debuginfo)( Int fd_obj, Addr avma_obj, return; /* failed */ sz_exename = VG_(strlen)(exe); HChar exename[sz_exename + 1]; - VG_(strcpy)(exename, exe); // make a copy on the stack + VG_(strcpy)(exename, exe); // make a copy on the stack if (VG_(clo_verbosity) > 0) { VG_(message)(Vg_UserMsg, "LOAD_PDB_DEBUGINFO: objname: %s\n", exename); @@ -1884,7 +1884,7 @@ void VG_(di_discard_ALL_debuginfo)( void ) DebugInfoMapping* ML_(find_rx_mapping) ( DebugInfo* di, Addr lo, Addr hi ) { Word i; - vg_assert(lo <= hi); + vg_assert(lo <= hi); /* Optimization: Try to use the last matched rx mapping first */ if ( di->last_rx_map @@ -1951,7 +1951,7 @@ Bool VG_(next_IIPC)(InlIPCursor *iipc) di = iipc->di; for (i = iipc->inltab_lopos; i <= iipc->inltab_hipos; i++) { - if (di->inltab[i].addr_lo <= iipc->eip + if (di->inltab[i].addr_lo <= iipc->eip && iipc->eip < di->inltab[i].addr_hi && di->inltab[i].level < iipc->curlevel && (!hinl || hinl->level < di->inltab[i].level)) { @@ -1959,7 +1959,7 @@ Bool VG_(next_IIPC)(InlIPCursor *iipc) hinl_pos = i; } } - + iipc->cur_inltab = iipc->next_inltab; iipc->next_inltab = hinl_pos; if (iipc->next_inltab < 0) @@ -1981,12 +1981,12 @@ static void search_all_loctabs ( DiEpoch ep, Addr ptr, (note that inltab might have duplicates addr_lo). */ static Word inltab_insert_pos (DebugInfo *di, Addr eip) { - Word mid, - lo = 0, + Word mid, + lo = 0, hi = di->inltab_used-1; while (lo <= hi) { mid = (lo + hi) / 2; - if (eip < di->inltab[mid].addr_lo) { hi = mid-1; continue; } + if (eip < di->inltab[mid].addr_lo) { hi = mid-1; continue; } if (eip > di->inltab[mid].addr_lo) { lo = mid+1; continue; } lo = mid; break; } @@ -2032,7 +2032,7 @@ InlIPCursor* VG_(new_IIPC)(DiEpoch ep, Addr eip) if (di->inltab[i].addr_lo < eip - di->maxinl_codesz) return NULL; } - + if (i < 0) return NULL; // No entry containing eip. @@ -2043,7 +2043,7 @@ InlIPCursor* VG_(new_IIPC)(DiEpoch ep, Addr eip) ret->di = di; ret->inltab_hipos = i; for (i = ret->inltab_hipos - 1; i >= 0; i--) { - + if (di->inltab[i].addr_lo < eip - di->maxinl_codesz) break; /* Similar stop backward scan logic as above. */ } @@ -2100,27 +2100,27 @@ static void search_all_symtabs ( DiEpoch ep, Addr ptr, } else { inRange = (di->data_present && di->data_size > 0 - && di->data_avma <= ptr + && di->data_avma <= ptr && ptr < di->data_avma + di->data_size) || (di->sdata_present && di->sdata_size > 0 - && di->sdata_avma <= ptr + && di->sdata_avma <= ptr && ptr < di->sdata_avma + di->sdata_size) || (di->bss_present && di->bss_size > 0 - && di->bss_avma <= ptr + && di->bss_avma <= ptr && ptr < di->bss_avma + di->bss_size) || (di->sbss_present && di->sbss_size > 0 - && di->sbss_avma <= ptr + && di->sbss_avma <= ptr && ptr < di->sbss_avma + di->sbss_size) || (di->rodata_present && di->rodata_size > 0 - && di->rodata_avma <= ptr + && di->rodata_avma <= ptr && ptr < di->rodata_avma + di->rodata_size); } @@ -2151,7 +2151,7 @@ static void search_all_loctabs ( DiEpoch ep, Addr ptr, continue; if (di->text_present && di->text_size > 0 - && di->text_avma <= ptr + && di->text_avma <= ptr && ptr < di->text_avma + di->text_size) { lno = ML_(search_one_loctab) ( di, ptr ); if (lno == -1) goto not_found; @@ -2176,7 +2176,7 @@ typedef Addr sym_avma; // Fields below here are not part of the key. const HChar* sym_name; - PtrdiffT offset : (sizeof(PtrdiffT)*8)-1; + PtrdiffT offset : (sizeof(PtrdiffT)*8)-1; Bool isText : 1; } Sym_Name_CacheEnt; @@ -2212,10 +2212,10 @@ static void sym_name_cache__invalidate ( void ) { -- caller must choose one kind or the other. NOTE: See IMPORTANT COMMENT above about persistence and ownership - in pub_tool_debuginfo.h + in pub_tool_debuginfo.h get_sym_name and the fact it calls the demangler is the main reason for non persistence of the information returned by m_debuginfo.c - functions : the string returned in *BUF is persistent as long as + functions : the string returned in *BUF is persistent as long as (1) the DebugInfo it belongs to is not discarded (2) the demangler is not invoked again Also, the returned string is owned by "somebody else". Callers must @@ -2266,7 +2266,7 @@ Bool get_sym_name ( Bool do_cxx_demangling, Bool do_z_demangling, se->sym_name, buf ); /* Do the below-main hack */ - // To reduce the endless nuisance of multiple different names + // To reduce the endless nuisance of multiple different names // for "the frame below main()" screwing up the testsuite, change all // known incarnations of said into a single name, "(below main)", if // --show-below-main=yes. @@ -2311,7 +2311,7 @@ Addr VG_(get_tocptr) ( DiEpoch ep, Addr guest_code_addr ) search_all_symtabs ( ep, guest_code_addr, &si, &sno, True/*consider text symbols only*/ ); - if (si == NULL) + if (si == NULL) return 0; else return GET_TOCPTR_AVMA(si->symtab[sno].avmas); @@ -2329,7 +2329,7 @@ Bool VG_(get_fnname) ( DiEpoch ep, Addr a, const HChar** buf ) return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True, /*below-main-renaming*/True, ep, a, buf, - /*match_anywhere_in_fun*/True, + /*match_anywhere_in_fun*/True, /*show offset?*/False, /*text sym*/True, /*offsetP*/NULL ); @@ -2370,7 +2370,7 @@ Bool VG_(get_fnname_w_offset) ( DiEpoch ep, Addr a, const HChar** buf ) return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True, /*below-main-renaming*/True, ep, a, buf, - /*match_anywhere_in_fun*/True, + /*match_anywhere_in_fun*/True, /*show offset?*/True, /*text sym*/True, /*offsetP*/NULL ); @@ -2414,7 +2414,7 @@ Bool VG_(get_fnname_if_entry) ( DiEpoch ep, Addr a, const HChar** buf ) res = get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True, /*below-main-renaming*/True, ep, a, &tmp, - /*match_anywhere_in_fun*/False, + /*match_anywhere_in_fun*/False, /*show offset?*/False, /*text sym*/True, /*offsetP*/NULL ); @@ -2433,7 +2433,7 @@ Bool VG_(get_fnname_raw) ( DiEpoch ep, Addr a, const HChar** buf ) return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False, /*below-main-renaming*/False, ep, a, buf, - /*match_anywhere_in_fun*/True, + /*match_anywhere_in_fun*/True, /*show offset?*/False, /*text sym*/True, /*offsetP*/NULL ); @@ -2461,7 +2461,7 @@ Bool VG_(get_fnname_no_cxx_demangle) ( DiEpoch ep, Addr a, const HChar** buf, return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/True, /*below-main-renaming*/True, ep, a, buf, - /*match_anywhere_in_fun*/True, + /*match_anywhere_in_fun*/True, /*show offset?*/False, /*text sym*/True, /*offsetP*/NULL ); @@ -2476,7 +2476,7 @@ Bool VG_(get_fnname_no_cxx_demangle) ( DiEpoch ep, Addr a, const HChar** buf, } } -/* mips-linux only: find the offset of current address. This is needed for +/* mips-linux only: find the offset of current address. This is needed for stack unwinding for MIPS. */ Bool VG_(get_inst_offset_in_function)( DiEpoch ep, Addr a, @@ -2486,7 +2486,7 @@ Bool VG_(get_inst_offset_in_function)( DiEpoch ep, Addr a, return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False, /*below-main-renaming*/False, ep, a, &fnname, - /*match_anywhere_in_sym*/True, + /*match_anywhere_in_sym*/True, /*show offset?*/False, /*text sym*/True, offset ); @@ -2549,7 +2549,7 @@ Bool VG_(get_datasym_and_offset)( DiEpoch ep, Addr data_addr, return get_sym_name ( /*C++-demangle*/False, /*Z-demangle*/False, /*below-main-renaming*/False, ep, data_addr, dname, - /*match_anywhere_in_sym*/True, + /*match_anywhere_in_sym*/True, /*show offset?*/False, /*text sym*/False, offset ); @@ -2557,7 +2557,7 @@ Bool VG_(get_datasym_and_offset)( DiEpoch ep, Addr data_addr, /* Map a code address to the name of a shared object file or the executable. Returns False if no idea; otherwise True. - Note: the string returned in *BUF is persistent as long as + Note: the string returned in *BUF is persistent as long as (1) the DebugInfo it belongs to is not discarded (2) the segment containing the address is not merged with another segment */ @@ -2574,7 +2574,7 @@ Bool VG_(get_objname) ( DiEpoch ep, Addr a, const HChar** objname ) continue; if (di->text_present && di->text_size > 0 - && di->text_avma <= a + && di->text_avma <= a && a < di->text_avma + di->text_size) { *objname = di->fsm.filename; return True; @@ -2610,7 +2610,7 @@ DebugInfo* VG_(find_DebugInfo) ( DiEpoch ep, Addr a ) continue; if (di->text_present && di->text_size > 0 - && di->text_avma <= a + && di->text_avma <= a && a < di->text_avma + di->text_size) { if (0 == (n_search & 0xF)) move_DebugInfo_one_step_forward( di ); @@ -2658,7 +2658,7 @@ Bool VG_(get_filename)( DiEpoch ep, Addr a, const HChar** filename ) UInt fndn_ix; search_all_loctabs ( ep, a, &si, &locno ); - if (si == NULL) + if (si == NULL) return False; fndn_ix = ML_(fndn_ix) (si, locno); *filename = ML_(fndn_ix2filename) (si, fndn_ix); @@ -2671,7 +2671,7 @@ Bool VG_(get_linenum)( DiEpoch ep, Addr a, UInt* lineno ) DebugInfo* si; Word locno; search_all_loctabs ( ep, a, &si, &locno ); - if (si == NULL) + if (si == NULL) return False; *lineno = si->loctab[locno].lineno; @@ -2753,7 +2753,7 @@ Bool VG_(lookup_symbol_SLOW)(DiEpoch ep, vg_assert(sec_names[0]); while (*sec_names) { if (0==VG_(strcmp)(name, *sec_names) - && (require_pToc + && (require_pToc ? GET_TOCPTR_AVMA(si->symtab[i].avmas) : True)) { *avmas = si->symtab[i].avmas; return True; @@ -2773,8 +2773,8 @@ Bool VG_(lookup_symbol_SLOW)(DiEpoch ep, /* Copy str into *buf starting at n, ensuring that buf is zero-terminated. Return the index of the terminating null character. */ -static SizeT -putStr( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str ) +static SizeT +putStr( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str ) { SizeT slen = VG_(strlen)(str); SizeT need = n + slen + 1; @@ -2791,21 +2791,21 @@ putStr( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str ) } /* Same as putStr, but escaping chars for XML output. */ -static SizeT +static SizeT putStrEsc( SizeT n, HChar** buf, SizeT *bufsiz, const HChar* str ) { HChar alt[2]; for (; *str != 0; str++) { switch (*str) { - case '&': - n = putStr( n, buf, bufsiz, "&"); + case '&': + n = putStr( n, buf, bufsiz, "&"); break; - case '<': - n = putStr( n, buf, bufsiz, "<"); + case '<': + n = putStr( n, buf, bufsiz, "<"); break; - case '>': - n = putStr( n, buf, bufsiz, ">"); + case '>': + n = putStr( n, buf, bufsiz, ">"); break; default: alt[0] = *str; @@ -2826,7 +2826,7 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc) # define APPEND_ESC(_str) \ n = putStrEsc(n, &buf, &bufsiz, _str) - UInt lineno; + UInt lineno; HChar ibuf[50]; // large enough SizeT n = 0; @@ -2979,7 +2979,7 @@ const HChar* VG_(describe_IP)(DiEpoch ep, Addr eip, const InlIPCursor *iipc) Int i; dirname = buf_dirname; // Remove leading prefixes from the dirname. - // If user supplied --fullpath-after=foo, this will remove + // If user supplied --fullpath-after=foo, this will remove // a leading string which matches '.*foo' (not greedy). for (i = 0; i < VG_(sizeXA)(VG_(clo_fullpath_after)); i++) { const HChar* prefix = @@ -3059,7 +3059,7 @@ typedef caller must set it to True before calling. */ __attribute__((noinline)) static -UWord evalCfiExpr ( const XArray* exprs, Int ix, +UWord evalCfiExpr ( const XArray* exprs, Int ix, const CfiExprEvalContext* eec, Bool* ok ) { UWord w, wL, wR; @@ -3146,7 +3146,7 @@ UWord evalCfiExpr ( const XArray* exprs, Int ix, } /* let's hope it doesn't trap! */ return ML_(read_UWord)((void *)a); - default: + default: goto unhandled; } /*NOTREACHED*/ @@ -3161,7 +3161,7 @@ UWord evalCfiExpr ( const XArray* exprs, Int ix, /* Search all the DebugInfos in the entire system, to find the DiCfSI_m - that pertains to 'ip'. + that pertains to 'ip'. If found, set *diP to the DebugInfo in which it resides, and *cfsi_mP to the cfsi_m pointer in that DebugInfo's cfsi_m_pool. @@ -3172,7 +3172,7 @@ UWord evalCfiExpr ( const XArray* exprs, Int ix, DebugInfos that are valid for the current epoch. */ __attribute__((noinline)) -static void find_DiCfSI ( /*OUT*/DebugInfo** diP, +static void find_DiCfSI ( /*OUT*/DebugInfo** diP, /*OUT*/DiCfSI_m** cfsi_mP, Addr ip ) { @@ -3254,7 +3254,7 @@ static void find_DiCfSI ( /*OUT*/DebugInfo** diP, if (0 && ((n_search & 0x7FFFF) == 0)) VG_(printf)("find_DiCfSI: %lu searches, " - "%lu DebugInfos looked at\n", + "%lu DebugInfos looked at\n", n_search, n_steps); } @@ -3346,23 +3346,23 @@ static Addr compute_cfa ( const D3UnwindRegs* uregs, cfa = 0; switch (cfsi_m->cfa_how) { # if defined(VGA_x86) || defined(VGA_amd64) - case CFIC_IA_SPREL: + case CFIC_IA_SPREL: cfa = cfsi_m->cfa_off + uregs->xsp; break; - case CFIC_IA_BPREL: + case CFIC_IA_BPREL: cfa = cfsi_m->cfa_off + uregs->xbp; break; # elif defined(VGA_arm) - case CFIC_ARM_R13REL: + case CFIC_ARM_R13REL: cfa = cfsi_m->cfa_off + uregs->r13; break; - case CFIC_ARM_R12REL: + case CFIC_ARM_R12REL: cfa = cfsi_m->cfa_off + uregs->r12; break; - case CFIC_ARM_R11REL: + case CFIC_ARM_R11REL: cfa = cfsi_m->cfa_off + uregs->r11; break; - case CFIC_ARM_R7REL: + case CFIC_ARM_R7REL: cfa = cfsi_m->cfa_off + uregs->r7; break; # elif defined(VGA_s390x) @@ -3395,10 +3395,10 @@ static Addr compute_cfa ( const D3UnwindRegs* uregs, break; # elif defined(VGA_ppc32) || defined(VGA_ppc64be) || defined(VGA_ppc64le) # elif defined(VGP_arm64_linux) - case CFIC_ARM64_SPREL: + case CFIC_ARM64_SPREL: cfa = cfsi_m->cfa_off + uregs->sp; break; - case CFIC_ARM64_X29REL: + case CFIC_ARM64_X29REL: cfa = cfsi_m->cfa_off + uregs->x29; break; # elif defined(VGP_arm64_freebsd) @@ -3431,7 +3431,7 @@ static Addr compute_cfa ( const D3UnwindRegs* uregs, cfa = evalCfiExpr(di->cfsi_exprs, cfsi_m->cfa_off, &eec, &ok ); if (!ok) return 0; break; - default: + default: vg_assert(0); } return cfa; @@ -3587,7 +3587,7 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere, cfsi_m = ce->cfsi_m; if (0) { - VG_(printf)("found cfsi_m (but printing fake base/len): "); + VG_(printf)("found cfsi_m (but printing fake base/len): "); ML_(ppDiCfSI)(di->cfsi_exprs, 0, 0, cfsi_m); } @@ -3848,11 +3848,11 @@ Bool VG_(use_FPO_info) ( /*MOD*/Addr* ipP, I don't know what happens when the compiler constructs an outgoing CALL. %esp could move if outgoing parameters are PUSHed, and this affects traceback for errors during the PUSHes. */ - + spHere = *spP; *ipP = ML_(read_Addr)((void *)(spHere + 4*(fpo->cbRegs + fpo->cdwLocals))); - *spP = spHere + 4*(fpo->cbRegs + fpo->cdwLocals + 1 + *spP = spHere + 4*(fpo->cbRegs + fpo->cdwLocals + 1 + fpo->cdwParams); *fpP = ML_(read_Addr)((void *)(spHere + 4*2)); return True; @@ -3950,7 +3950,7 @@ static Bool data_address_is_in_var ( /*OUT*/PtrdiffT* offset, VG_(printf)("\n"); } - if (res.kind == GXR_Addr + if (res.kind == GXR_Addr && res.word <= data_addr && data_addr < res.word + var_szB) { *offset = data_addr - res.word; @@ -3975,7 +3975,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, PtrdiffT var_offset, PtrdiffT residual_offset, const XArray* /*HChar*/ described, - Int frameNo, + Int frameNo, ThreadId tid ) { Bool have_descr, have_srcloc; @@ -4044,7 +4044,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, p2XA( dn2, "in frame #%d of thread %u", frameNo, tid ); } - } + } else if ( frameNo >= 0 && have_srcloc && (!have_descr) ) { /* no description: @@ -4065,7 +4065,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, TXTR( dn2 ); // FIXME: also do p2XA( dn2, - " %pS %d ", + " %pS %d ", fileName, var->lineNo ); XAGR( dn2 ); } else { @@ -4102,7 +4102,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, p2XA( dn2, "in frame #%d of thread %u", frameNo, tid ); } - } + } else if ( frameNo >= 0 && have_srcloc && have_descr ) { /* Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2, @@ -4152,7 +4152,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, "Location 0x%lx is %ld byte%s inside global var \"%s\"", data_addr, var_offset, vo_plural, var->name ); } - } + } else if ( frameNo >= -1 && have_srcloc && (!have_descr) ) { /* no description: @@ -4210,7 +4210,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, p2XA( dn2, "a global variable"); } - } + } else if ( frameNo >= -1 && have_srcloc && have_descr ) { /* Location 0x7fefff6cf is 2 bytes inside a[3].xyzzy[21].c2, @@ -4243,7 +4243,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, fileName, var->lineNo); } } - else + else vg_assert(0); /* Zero terminate both strings */ @@ -4264,7 +4264,7 @@ static void format_message ( /*MOD*/XArray* /* of HChar */ dn1, ends of DNAME{1,2}, which are XArray*s of HChar, that have been initialised by the caller, zero terminate both, and return True. If it's not a local variable in said frame, return False. */ -static +static Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1, /*MOD*/XArray* /* of HChar */ dname2, DiEpoch ep, @@ -4295,7 +4295,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1, if (di->text_avma <= ip && ip < di->text_avma + di->text_size) break; } - + /* Didn't find it. Strange -- means ip is a code address outside of any mapped text segment. Unlikely but not impossible -- app could be generating code to run. */ @@ -4304,7 +4304,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1, if (0 && ((n_search & 0x1) == 0)) VG_(printf)("consider_vars_in_frame: %u searches, " - "%u DebugInfos looked at\n", + "%u DebugInfos looked at\n", n_search, n_steps); /* Start of performance-enhancing hack: once every ??? (chosen hackily after profiling) successful searches, move the found @@ -4334,7 +4334,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1, XArray* vars; Word j; DiAddrRange* arange; - OSet* this_scope + OSet* this_scope = *(OSet**)VG_(indexXA)( di->varinfo, i ); if (debug) VG_(printf)("QQQQ: considering scope %ld\n", (Word)i); @@ -4343,7 +4343,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1, /* Find the set of variables in this scope that bracket the program counter. */ arange = VG_(OSetGen_LookupWithCmp)( - this_scope, &ip, + this_scope, &ip, ML_(cmp_for_DiAddrRange_range) ); if (!arange) @@ -4375,7 +4375,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1, data_addr, di )) { PtrdiffT residual_offset = 0; XArray* described = ML_(describe_type)( &residual_offset, - di->admin_tyents, + di->admin_tyents, var->typeR, offset ); format_message( dname1, dname2, data_addr, di, var, offset, residual_offset, @@ -4402,7 +4402,7 @@ Bool consider_vars_in_frame ( /*MOD*/XArray* /* of HChar */ dname1, using VG_(strlen) on the contents, rather than VG_(sizeXA) on the XArray itself. */ -Bool VG_(get_data_description)( +Bool VG_(get_data_description)( /*MOD*/ XArray* /* of HChar */ dname1, /*MOD*/ XArray* /* of HChar */ dname2, DiEpoch ep, Addr data_addr @@ -4452,7 +4452,7 @@ Bool VG_(get_data_description)( vg_assert(gs_size == 1); /* Fish out the global scope and check it is as expected. */ zero = 0; - global_arange + global_arange = VG_(OSetGen_Lookup)( global_scope, &zero ); /* The global range from (Addr)0 to ~(Addr)0 must exist */ vg_assert(global_arange); @@ -4475,8 +4475,8 @@ Bool VG_(get_data_description)( This means, if the evaluation of the location expression/list requires a register, we have to let it fail. */ - if (data_address_is_in_var( &offset, di->admin_tyents, var, - NULL/* RegSummary* */, + if (data_address_is_in_var( &offset, di->admin_tyents, var, + NULL/* RegSummary* */, data_addr, di )) { PtrdiffT residual_offset = 0; XArray* described = ML_(describe_type)( &residual_offset, @@ -4526,7 +4526,7 @@ Bool VG_(get_data_description)( for (j = 0; j < n_frames; j++) { if (consider_vars_in_frame( dname1, dname2, ep, data_addr, - ips[j], + ips[j], sps[j], fps[j], tid, j )) { zterm_XA( dname1 ); zterm_XA( dname2 ); @@ -4553,7 +4553,7 @@ Bool VG_(get_data_description)( if (j > 0 /* this is a non-innermost frame */ && consider_vars_in_frame( dname1, dname2, ep, data_addr, - ips[j] + 1, + ips[j] + 1, sps[j], fps[j], tid, j )) { zterm_XA( dname1 ); zterm_XA( dname2 ); @@ -4581,7 +4581,7 @@ Bool VG_(get_data_description)( it. If 'arrays_only' is True, also ignore it unless it has an array type. */ -static +static void analyse_deps ( /*MOD*/XArray* /* of FrameBlock */ blocks, const XArray* /* TyEnt */ tyents, Addr ip, const DebugInfo* di, const DiVariable* var, @@ -4739,7 +4739,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only ) if (di->text_avma <= ip && ip < di->text_avma + di->text_size) break; } - + /* Didn't find it. Strange -- means ip is a code address outside of any mapped text segment. Unlikely but not impossible -- app could be generating code to run. */ @@ -4748,7 +4748,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only ) if (0 && ((n_search & 0x1) == 0)) VG_(printf)("VG_(di_get_stack_blocks_at_ip): %u searches, " - "%u DebugInfos looked at\n", + "%u DebugInfos looked at\n", n_search, n_steps); /* Start of performance-enhancing hack: once every ??? (chosen hackily after profiling) successful searches, move the found @@ -4775,7 +4775,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only ) XArray* vars; Word j; DiAddrRange* arange; - OSet* this_scope + OSet* this_scope = *(OSet**)VG_(indexXA)( di->varinfo, i ); if (debug) VG_(printf)("QQQQ: considering scope %ld\n", (Word)i); @@ -4784,7 +4784,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only ) /* Find the set of variables in this scope that bracket the program counter. */ arange = VG_(OSetGen_LookupWithCmp)( - this_scope, &ip, + this_scope, &ip, ML_(cmp_for_DiAddrRange_range) ); if (!arange) @@ -4808,7 +4808,7 @@ VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only ) for (j = 0; j < VG_(sizeXA)( vars ); j++) { DiVariable* var = (DiVariable*)VG_(indexXA)( vars, j ); if (debug) - VG_(printf)("QQQQ: var:name=%s %#lx-%#lx %#lx\n", + VG_(printf)("QQQQ: var:name=%s %#lx-%#lx %#lx\n", var->name,arange->aMin,arange->aMax,ip); analyse_deps( res, di->admin_tyents, ip, di, var, arrays_only ); @@ -4968,32 +4968,32 @@ const DebugInfo* VG_(next_DebugInfo)(const DebugInfo* di) Addr VG_(DebugInfo_get_text_avma)(const DebugInfo* di) { - return di->text_present ? di->text_avma : 0; + return di->text_present ? di->text_avma : 0; } SizeT VG_(DebugInfo_get_text_size)(const DebugInfo* di) { - return di->text_present ? di->text_size : 0; + return di->text_present ? di->text_size : 0; } Addr VG_(DebugInfo_get_bss_avma)(const DebugInfo* di) { - return di->bss_present ? di->bss_avma : 0; + return di->bss_present ? di->bss_avma : 0; } SizeT VG_(DebugInfo_get_bss_size)(const DebugInfo* di) { - return di->bss_present ? di->bss_size : 0; + return di->bss_present ? di->bss_size : 0; } Addr VG_(DebugInfo_get_plt_avma)(const DebugInfo* di) { - return di->plt_present ? di->plt_avma : 0; + return di->plt_present ? di->plt_avma : 0; } SizeT VG_(DebugInfo_get_plt_size)(const DebugInfo* di) { - return di->plt_present ? di->plt_size : 0; + return di->plt_present ? di->plt_size : 0; } Addr VG_(DebugInfo_get_pltsec_avma)(const DebugInfo* di) @@ -5008,22 +5008,22 @@ SizeT VG_(DebugInfo_get_pltsec_size)(const DebugInfo* di) Addr VG_(DebugInfo_get_gotplt_avma)(const DebugInfo* di) { - return di->gotplt_present ? di->gotplt_avma : 0; + return di->gotplt_present ? di->gotplt_avma : 0; } SizeT VG_(DebugInfo_get_gotplt_size)(const DebugInfo* di) { - return di->gotplt_present ? di->gotplt_size : 0; + return di->gotplt_present ? di->gotplt_size : 0; } Addr VG_(DebugInfo_get_got_avma)(const DebugInfo* di) { - return di->got_present ? di->got_avma : 0; + return di->got_present ? di->got_avma : 0; } SizeT VG_(DebugInfo_get_got_size)(const DebugInfo* di) { - return di->got_present ? di->got_size : 0; + return di->got_present ? di->got_size : 0; } const HChar* VG_(DebugInfo_get_soname)(const DebugInfo* di) @@ -5046,7 +5046,7 @@ Int VG_(DebugInfo_syms_howmany) ( const DebugInfo *si ) return si->symtab_used; } -void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si, +void VG_(DebugInfo_syms_getidx) ( const DebugInfo *si, Int idx, /*OUT*/SymAVMAs* avmas, /*OUT*/UInt* size, diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 083263321..dce26ba91 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -7121,7 +7121,7 @@ POST(sys_getrlimitusage) break; case VKI_RLIMIT_STACK: /* - * The main client stack is quite different when running under Valgrind. + * The main client stack is quite different when running under Valgrind. * See aspacemg-linux.c for details, but in short on 64bit systems * the main stack starts with 128k reserved and a 512M limit. * Valgrind just has one value, 16M by default (can be changed with diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 3606bb9ad..e8b200385 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -130,7 +130,7 @@ static void run_a_thread_NORETURN ( Word tidW ) Int registered_vgstack_id; #endif - VG_(debugLog)(1, "syswrap-linux", + VG_(debugLog)(1, "syswrap-linux", "run_a_thread_NORETURN(tid=%u): pre-thread_wrapper\n", tid); @@ -146,14 +146,14 @@ static void run_a_thread_NORETURN ( Word tidW ) is the stack to use by the outer to e.g. do stacktraces. */ INNER_REQUEST - (registered_vgstack_id + (registered_vgstack_id = VALGRIND_STACK_REGISTER (tst->os_state.valgrind_stack_base, tst->os_state.valgrind_stack_init_SP)); - + /* Run the thread all the way through. */ - src = thread_wrapper(tid); + src = thread_wrapper(tid); - VG_(debugLog)(1, "syswrap-linux", + VG_(debugLog)(1, "syswrap-linux", "run_a_thread_NORETURN(tid=%u): post-thread_wrapper\n", tid); @@ -180,7 +180,7 @@ static void run_a_thread_NORETURN ( Word tidW ) "WARNING: of the VALGRIND_DISABLE_ERROR_REPORTING macros.\n" ); VG_(debugLog)( - 1, "syswrap-linux", + 1, "syswrap-linux", "run_a_thread_NORETURN(tid=%u): " "WARNING: exiting thread has err_disablement_level = %u\n", tid, tst->err_disablement_level @@ -190,18 +190,18 @@ static void run_a_thread_NORETURN ( Word tidW ) if (c == 1) { - VG_(debugLog)(1, "syswrap-linux", + VG_(debugLog)(1, "syswrap-linux", "run_a_thread_NORETURN(tid=%u): " "last one standing\n", tid); /* We are the last one standing. Keep hold of the lock and - carry on to show final tool results, then exit the entire system. + carry on to show final tool results, then exit the entire system. Use the continuation pointer set at startup in m_main. */ ( * VG_(address_of_m_main_shutdown_actions_NORETURN) ) (tid, src); } else { - VG_(debugLog)(1, "syswrap-linux", + VG_(debugLog)(1, "syswrap-linux", "run_a_thread_NORETURN(tid=%u): " "not last one standing\n", tid); @@ -371,10 +371,10 @@ Addr ML_(allocstack)(ThreadId tid) if (0) VG_(printf)( "stack for tid %u at %p; init_SP=%p\n", - tid, - (void*)tst->os_state.valgrind_stack_base, + tid, + (void*)tst->os_state.valgrind_stack_base, (void*)tst->os_state.valgrind_stack_init_SP ); - + return tst->os_state.valgrind_stack_init_SP; } @@ -386,7 +386,7 @@ Addr ML_(allocstack)(ThreadId tid) void VG_(main_thread_wrapper_NORETURN)(ThreadId tid) { Addr sp; - VG_(debugLog)(1, "syswrap-linux", + VG_(debugLog)(1, "syswrap-linux", "entering VG_(main_thread_wrapper_NORETURN)\n"); sp = ML_(allocstack)(tid); @@ -397,7 +397,7 @@ void VG_(main_thread_wrapper_NORETURN)(ThreadId tid) // reports 'write error' on the non registered stack. ThreadState* tst = VG_(get_ThreadState)(tid); INNER_REQUEST - ((void) + ((void) VALGRIND_STACK_REGISTER (tst->os_state.valgrind_stack_base, tst->os_state.valgrind_stack_init_SP)); } @@ -427,7 +427,7 @@ void VG_(main_thread_wrapper_NORETURN)(ThreadId tid) /* shouldn't be any other threads around yet */ vg_assert( VG_(count_living_threads)() == 1 ); - ML_(call_on_new_stack_0_1)( + ML_(call_on_new_stack_0_1)( (Addr)sp, /* stack */ 0, /* bogus return address */ run_a_thread_NORETURN, /* fn to call */ @@ -441,11 +441,11 @@ void VG_(main_thread_wrapper_NORETURN)(ThreadId tid) /* Clone a new thread. Note that in the clone syscalls, we hard-code tlsaddr argument as NULL : the guest TLS is emulated via guest registers, and Valgrind itself has no thread local storage. */ -static SysRes clone_new_thread ( Word (*fn)(void *), - void* stack, - Word flags, +static SysRes clone_new_thread ( Word (*fn)(void *), + void* stack, + Word flags, ThreadState* ctst, - Int* child_tidptr, + Int* child_tidptr, Int* parent_tidptr) { SysRes res; @@ -479,7 +479,7 @@ static SysRes clone_new_thread ( Word (*fn)(void *), /* High half word64 is syscall return value. Low half is the entire CR, from which we need to extract CR0.SO. */ /* VG_(printf)("word64 = 0x%llx\n", word64); */ - res = VG_(mk_SysRes_ppc32_linux)(/*val*/(UInt)(word64 >> 32), + res = VG_(mk_SysRes_ppc32_linux)(/*val*/(UInt)(word64 >> 32), /*errflag*/ (((UInt)word64) >> 28) & 1); #elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) ULong word64; @@ -496,7 +496,7 @@ static SysRes clone_new_thread ( Word (*fn)(void *), the entire CR, from which we need to extract CR0.SO. */ /* VG_(printf)("word64 = 0x%llx\n", word64); */ res = VG_(mk_SysRes_ppc64_linux) - (/*val*/(UInt)(word64 & 0xFFFFFFFFULL), + (/*val*/(UInt)(word64 & 0xFFFFFFFFULL), /*errflag*/ (UInt)((word64 >> (32+28)) & 1), flag); #elif defined(VGP_s390x_linux) ULong r2; @@ -535,7 +535,7 @@ static SysRes clone_new_thread ( Word (*fn)(void *), (ML_(start_thread_NORETURN), stack, flags, ctst, child_tidptr, parent_tidptr, NULL); /* High half word64 is syscall return value. Low half is - the entire CR, from which we need to extract CR0.SO. */ + the entire CR, from which we need to extract CR0.SO. */ res = VG_ (mk_SysRes_mips32_linux) (/*val */ ret, 0, /*errflag */ 0); #elif defined(VGP_nanomips_linux) UInt ret = 0; @@ -557,16 +557,16 @@ static SysRes clone_new_thread ( Word (*fn)(void *), return res; } -static void setup_child ( /*OUT*/ ThreadArchState *child, +static void setup_child ( /*OUT*/ ThreadArchState *child, /*IN*/ ThreadArchState *parent ) -{ +{ /* We inherit our parent's guest state. */ child->vex = parent->vex; child->vex_shadow1 = parent->vex_shadow1; child->vex_shadow2 = parent->vex_shadow2; #if defined(VGP_x86_linux) - extern void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child, + extern void ML_(x86_setup_LDT_GDT) ( /*OUT*/ ThreadArchState *child, /*IN*/ ThreadArchState *parent ); ML_(x86_setup_LDT_GDT)(child, parent); #endif @@ -587,7 +587,7 @@ static SysRes setup_child_tls (ThreadId ctid, Addr tlsaddr) if (debug) VG_(printf)("clone child has SETTLS: tls info at %p: idx=%u " "base=%#lx limit=%x; esp=%#x fs=%x gs=%x\n", - tlsinfo, tlsinfo->entry_number, + tlsinfo, tlsinfo->entry_number, tlsinfo->base_addr, tlsinfo->limit, ctst->arch.vex.guest_ESP, ctst->arch.vex.guest_FS, ctst->arch.vex.guest_GS); @@ -619,9 +619,9 @@ static SysRes setup_child_tls (ThreadId ctid, Addr tlsaddr) # error Unknown platform #endif return res; -} +} -/* +/* When a client clones, we need to keep track of the new thread. This means: 1. allocate a ThreadId+ThreadState+stack for the thread @@ -631,10 +631,10 @@ static SysRes setup_child_tls (ThreadId ctid, Addr tlsaddr) but using the scheduler entrypoint for EIP, and a separate stack for ESP. */ -static SysRes do_clone ( ThreadId ptid, - UWord flags, Addr sp, - Int* parent_tidptr, - Int* child_tidptr, +static SysRes do_clone ( ThreadId ptid, + UWord flags, Addr sp, + Int* parent_tidptr, + Int* child_tidptr, Addr tlsaddr) { ThreadId ctid = VG_(alloc_ThreadState)(); @@ -690,7 +690,7 @@ static SysRes do_clone ( ThreadId ptid, ctst->os_state.threadgroup = ptst->os_state.threadgroup; ML_(guess_and_register_stack) (sp, ctst); - + /* Assume the clone will succeed, and tell any tool that wants to know that this thread has come into existence. We cannot defer it beyond this point because setup_tls, just below, @@ -755,7 +755,7 @@ static SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, vki_sigset_t mask; SysRes res; - if (flags & (VKI_CLONE_SETTLS | VKI_CLONE_FS | VKI_CLONE_VM + if (flags & (VKI_CLONE_SETTLS | VKI_CLONE_FS | VKI_CLONE_VM | VKI_CLONE_FILES)) return VG_(mk_SysRes_Error)( VKI_EINVAL ); @@ -774,14 +774,14 @@ static SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, || defined(VGP_arm_linux) || defined(VGP_mips32_linux) \ || defined(VGP_mips64_linux) || defined(VGP_arm64_linux) \ || defined(VGP_nanomips_linux) || defined(VGP_riscv64_linux) - res = VG_(do_syscall5)( __NR_clone, flags, - (UWord)NULL, (UWord)parent_tidptr, + res = VG_(do_syscall5)( __NR_clone, flags, + (UWord)NULL, (UWord)parent_tidptr, (UWord)NULL, (UWord)child_tidptr ); #elif defined(VGP_amd64_linux) /* note that the last two arguments are the opposite way round to x86 and ppc32 as the amd64 kernel expects the arguments in a different order */ - res = VG_(do_syscall5)( __NR_clone, flags, - (UWord)NULL, (UWord)parent_tidptr, + res = VG_(do_syscall5)( __NR_clone, flags, + (UWord)NULL, (UWord)parent_tidptr, (UWord)child_tidptr, (UWord)NULL ); #elif defined(VGP_s390x_linux) /* Note that s390 has the stack first and then the flags */ @@ -799,8 +799,8 @@ static SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, /* restore signal mask */ VG_(sigprocmask)(VKI_SIG_SETMASK, &fork_saved_mask, NULL); - } - else + } + else if (!sr_isError(res) && sr_Res(res) > 0) { /* parent */ VG_(do_atfork_parent)(tid); @@ -877,7 +877,7 @@ PRE(sys_clone) PRA3("clone", int *, parent_tidptr); } PRE_MEM_WRITE("clone(parent_tidptr)", ARG3, sizeof(Int)); - if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), + if (!VG_(am_is_valid_for_client)(ARG3, sizeof(Int), VKI_PROT_WRITE)) { badarg = True; } @@ -891,7 +891,7 @@ PRE(sys_clone) ARG_TLS pointer if the type looks like a real type, i.e. sizeof > 1. */ if (sizeof(vki_modify_ldt_t) > 1) { PRE_MEM_READ("clone(tlsinfo)", ARG_TLS, sizeof(vki_modify_ldt_t)); - if (!VG_(am_is_valid_for_client)(ARG_TLS, sizeof(vki_modify_ldt_t), + if (!VG_(am_is_valid_for_client)(ARG_TLS, sizeof(vki_modify_ldt_t), VKI_PROT_READ)) { badarg = True; } @@ -902,7 +902,7 @@ PRE(sys_clone) PRA_CHILD_TIDPTR("clone", int *, child_tidptr); } PRE_MEM_WRITE("clone(child_tidptr)", ARG_CHILD_TIDPTR, sizeof(Int)); - if (!VG_(am_is_valid_for_client)(ARG_CHILD_TIDPTR, sizeof(Int), + if (!VG_(am_is_valid_for_client)(ARG_CHILD_TIDPTR, sizeof(Int), VKI_PROT_WRITE)) { badarg = True; } @@ -921,7 +921,7 @@ PRE(sys_clone) } /* Only look at the flags we really care about */ - switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS + switch (cloneflags & (VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES | VKI_CLONE_VFORK)) { case VKI_CLONE_VM | VKI_CLONE_FS | VKI_CLONE_FILES: /* thread creation */ @@ -1132,7 +1132,7 @@ PRE(sys_getresuid) { PRINT("sys_getresuid ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3); - PRE_REG_READ3(long, "getresuid", + PRE_REG_READ3(long, "getresuid", vki_uid_t *, ruid, vki_uid_t *, euid, vki_uid_t *, suid); PRE_MEM_WRITE( "getresuid(ruid)", ARG1, sizeof(vki_uid_t) ); PRE_MEM_WRITE( "getresuid(euid)", ARG2, sizeof(vki_uid_t) ); @@ -1153,7 +1153,7 @@ PRE(sys_setresgid16) PRINT("sys_setresgid16 ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3); PRE_REG_READ3(long, "setresgid16", - vki_old_gid_t, rgid, + vki_old_gid_t, rgid, vki_old_gid_t, egid, vki_old_gid_t, sgid); } @@ -1190,7 +1190,7 @@ PRE(sys_getresgid) { PRINT("sys_getresgid ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3); - PRE_REG_READ3(long, "getresgid", + PRE_REG_READ3(long, "getresgid", vki_gid_t *, rgid, vki_gid_t *, egid, vki_gid_t *, sgid); PRE_MEM_WRITE( "getresgid(rgid)", ARG1, sizeof(vki_gid_t) ); PRE_MEM_WRITE( "getresgid(egid)", ARG2, sizeof(vki_gid_t) ); @@ -1235,7 +1235,7 @@ PRE(sys_exit_group) syscall. */ for (t = 1; t < VG_N_THREADS; t++) { if ( /* not alive */ - VG_(threads)[t].status == VgTs_Empty + VG_(threads)[t].status == VgTs_Empty || /* not our group */ VG_(threads)[t].os_state.threadgroup != tst->os_state.threadgroup @@ -1248,12 +1248,12 @@ PRE(sys_exit_group) /* Indicate in all other threads that the process is exiting. Then wait using VG_(reap_threads) for these threads to disappear. - + Can this give a deadlock if another thread is calling exit in parallel and would then wait for this thread to disappear ? The answer is no: Other threads are either blocked in a syscall or have yielded the CPU. - + A thread that has yielded the CPU is trying to get the big lock in VG_(scheduler). This thread will get the CPU thanks to the call to VG_(reap_threads). The scheduler will then check for signals, @@ -1262,7 +1262,7 @@ PRE(sys_exit_group) the thread status is VG_(is_exiting), the scheduler exits the thread. So, a thread that has yielded the CPU does not have a chance to call exit => no deadlock for this thread. - + VG_(nuke_all_threads_except) will send the VG_SIGVGKILL signal to all threads blocked in a syscall. The syscall will be interrupted, and the control will go to the @@ -1395,7 +1395,7 @@ PRE(sys_syslog) case 2: case 3: case 4: PRE_MEM_WRITE( "syslog(bufp)", ARG2, ARG3); break; - default: + default: break; } } @@ -1440,7 +1440,7 @@ PRE(sys_sysctl) args = (struct __vki_sysctl_args *)(Addr)ARG1; PRE_REG_READ1(long, "sysctl", struct __sysctl_args *, args); PRE_MEM_WRITE( "sysctl(args)", ARG1, sizeof(struct __vki_sysctl_args) ); - if (!VG_(am_is_valid_for_client)(ARG1, sizeof(struct __vki_sysctl_args), + if (!VG_(am_is_valid_for_client)(ARG1, sizeof(struct __vki_sysctl_args), VKI_PROT_READ)) { SET_STATUS_Failure( VKI_EFAULT ); return; @@ -1690,7 +1690,7 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout, SyscallArgs* arrghs, SyscallStatus* status, UWord* flags, Bool is_time64 ) { - /* + /* arg param used by ops ARG1 - u32 *futex all @@ -1706,11 +1706,11 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout, case VKI_FUTEX_WAKE_OP: case VKI_FUTEX_CMP_REQUEUE_PI: if (is_time64) { - PRE_REG_READ6(long, "futex_time64", + PRE_REG_READ6(long, "futex_time64", vki_u32 *, futex, int, op, int, val, struct timespec64 *, utime, vki_u32 *, uaddr2, int, val3); } else { - PRE_REG_READ6(long, "futex", + PRE_REG_READ6(long, "futex", vki_u32 *, futex, int, op, int, val, struct timespec *, utime, vki_u32 *, uaddr2, int, val3); } @@ -1718,11 +1718,11 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout, case VKI_FUTEX_REQUEUE: case VKI_FUTEX_WAIT_REQUEUE_PI: if (is_time64) { - PRE_REG_READ5(long, "futex_time64", + PRE_REG_READ5(long, "futex_time64", vki_u32 *, futex, int, op, int, val, struct timespec64 *, utime, vki_u32 *, uaddr2); } else { - PRE_REG_READ5(long, "futex", + PRE_REG_READ5(long, "futex", vki_u32 *, futex, int, op, int, val, struct timespec *, utime, vki_u32 *, uaddr2); } @@ -1769,18 +1769,18 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout, case VKI_FUTEX_WAIT: case VKI_FUTEX_LOCK_PI: if (is_time64) { - PRE_REG_READ4(long, "futex_time64", + PRE_REG_READ4(long, "futex_time64", vki_u32 *, futex, int, op, int, val, struct timespec64 *, utime); } else { - PRE_REG_READ4(long, "futex", + PRE_REG_READ4(long, "futex", vki_u32 *, futex, int, op, int, val, struct timespec *, utime); } break; case VKI_FUTEX_WAKE: case VKI_FUTEX_FD: - PRE_REG_READ3(long, "futex", + PRE_REG_READ3(long, "futex", vki_u32 *, futex, int, op, int, val); break; case VKI_FUTEX_TRYLOCK_PI: @@ -1889,7 +1889,7 @@ PRE(sys_set_robust_list) { PRINT("sys_set_robust_list ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1, ARG2); - PRE_REG_READ2(long, "set_robust_list", + PRE_REG_READ2(long, "set_robust_list", struct vki_robust_list_head *, head, vki_size_t, len); /* Just check the robust_list_head structure is readable - don't @@ -1945,13 +1945,13 @@ static void pselect6_pre_helper ( ThreadId tid, SyscallArgLayout* layout, } // XXX: this possibly understates how much memory is read. if (ARG2 != 0) - PRE_MEM_READ( "pselect6(readfds)", + PRE_MEM_READ( "pselect6(readfds)", ARG2, ARG1/8 /* __FD_SETSIZE/8 */ ); if (ARG3 != 0) - PRE_MEM_READ( "pselect6(writefds)", + PRE_MEM_READ( "pselect6(writefds)", ARG3, ARG1/8 /* __FD_SETSIZE/8 */ ); if (ARG4 != 0) - PRE_MEM_READ( "pselect6(exceptfds)", + PRE_MEM_READ( "pselect6(exceptfds)", ARG4, ARG1/8 /* __FD_SETSIZE/8 */ ); if (ARG5 != 0) { if (is_time64) { @@ -2485,7 +2485,7 @@ PRE(sys_tkill) SET_STATUS_Failure( VKI_EINVAL ); return; } - + /* Check to see if this kill gave us a pending signal */ *flags |= SfPollAfter; @@ -2526,7 +2526,7 @@ PRE(sys_tgkill) SET_STATUS_Failure( VKI_EINVAL ); return; } - + /* Check to see if this kill gave us a pending signal */ *flags |= SfPollAfter; @@ -2607,7 +2607,7 @@ POST(sys_io_setup) { SizeT size; struct vki_aio_ring *r; - + size = VG_PGROUNDUP(sizeof(struct vki_aio_ring) + ARG1*sizeof(struct vki_io_event)); r = *(struct vki_aio_ring **)(Addr)ARG2; @@ -2631,7 +2631,7 @@ POST(sys_io_setup) PRE(sys_io_destroy) { SizeT size = 0; - + PRINT("sys_io_destroy ( %llu )", (ULong)ARG1); PRE_REG_READ1(long, "io_destroy", vki_aio_context_t, ctx); @@ -2639,20 +2639,20 @@ PRE(sys_io_destroy) // possible... if (ML_(safe_to_deref)( (void*)(Addr)ARG1, sizeof(struct vki_aio_ring))) { struct vki_aio_ring *r = (struct vki_aio_ring *)(Addr)ARG1; - size = VG_PGROUNDUP(sizeof(struct vki_aio_ring) + + size = VG_PGROUNDUP(sizeof(struct vki_aio_ring) + r->nr*sizeof(struct vki_io_event)); } SET_STATUS_from_SysRes( VG_(do_syscall1)(SYSNO, ARG1) ); - if (SUCCESS && RES == 0) { + if (SUCCESS && RES == 0) { Bool d = VG_(am_notify_munmap)( ARG1, size ); VG_TRACK( die_mem_munmap, ARG1, size ); if (d) - VG_(discard_translations)( (Addr)ARG1, (ULong)size, + VG_(discard_translations)( (Addr)ARG1, (ULong)size, "PRE(sys_io_destroy)" ); - } -} + } +} static void common_pre_io_getevents(ThreadId tid, UWord a1, UWord a2, UWord a3, UWord a4, UWord a5, UWord a6, UWord* flags, const HChar* funtion_name) @@ -2904,16 +2904,16 @@ PRE(sys_fanotify_mark) PRINT( "sys_fanotify_mark ( %ld, %" FMT_REGWORD "u, %llu, %ld, %#" FMT_REGWORD "x(%s))", SARG1, ARG2, MERGE64(ARG3,ARG4), SARG5, ARG6, (HChar *)(Addr)ARG6); - PRE_REG_READ6(long, "sys_fanotify_mark", + PRE_REG_READ6(long, "sys_fanotify_mark", int, fanotify_fd, unsigned int, flags, __vki_u32, mask0, __vki_u32, mask1, int, dfd, const char *, pathname); if (ARG6) PRE_MEM_RASCIIZ( "fanotify_mark(path)", ARG6); #elif VG_WORDSIZE == 8 - PRINT( "sys_fanotify_mark ( %ld, %lu, %lu, %ld, %#lx(%s))", + PRINT( "sys_fanotify_mark ( %ld, %lu, %lu, %ld, %#lx(%s))", SARG1, ARG2, ARG3, SARG4, ARG5, (HChar *)(Addr)ARG5); - PRE_REG_READ5(long, "sys_fanotify_mark", + PRE_REG_READ5(long, "sys_fanotify_mark", int, fanotify_fd, unsigned int, flags, __vki_u64, mask, int, dfd, const char *, pathname); @@ -3148,7 +3148,7 @@ PRE(sys_mq_getsetattr) if (ARG3 != 0) PRE_MEM_WRITE( "mq_getsetattr(omqstat)", ARG3, sizeof(struct vki_mq_attr) ); - } + } } POST(sys_mq_getsetattr) { @@ -3163,7 +3163,7 @@ POST(sys_mq_getsetattr) PRE(sys_clock_settime) { PRINT("sys_clock_settime( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2); - PRE_REG_READ2(long, "clock_settime", + PRE_REG_READ2(long, "clock_settime", vki_clockid_t, clk_id, const struct timespec *, tp); PRE_MEM_READ( "clock_settime(tp)", ARG2, sizeof(struct vki_timespec) ); } @@ -3179,7 +3179,7 @@ PRE(sys_clock_settime64) PRE(sys_clock_gettime) { PRINT("sys_clock_gettime( %ld, %#" FMT_REGWORD "x )" , SARG1, ARG2); - PRE_REG_READ2(long, "clock_gettime", + PRE_REG_READ2(long, "clock_gettime", vki_clockid_t, clk_id, struct timespec *, tp); PRE_MEM_WRITE( "clock_gettime(tp)", ARG2, sizeof(struct vki_timespec) ); } @@ -3206,7 +3206,7 @@ PRE(sys_clock_getres) PRINT("sys_clock_getres( %ld, %#" FMT_REGWORD "x )" , SARG1, ARG2); // Nb: we can't use "RES" as the param name because that's a macro // defined above! - PRE_REG_READ2(long, "clock_getres", + PRE_REG_READ2(long, "clock_getres", vki_clockid_t, clk_id, struct timespec *, res); if (ARG2 != 0) PRE_MEM_WRITE( "clock_getres(res)", ARG2, sizeof(struct vki_timespec) ); @@ -3309,7 +3309,7 @@ PRE(sys_timer_settime) { PRINT("sys_timer_settime( %ld, %ld, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", SARG1,SARG2,ARG3,ARG4); - PRE_REG_READ4(long, "timer_settime", + PRE_REG_READ4(long, "timer_settime", vki_timer_t, timerid, int, flags, const struct itimerspec *, value, struct itimerspec *, ovalue); @@ -3329,7 +3329,7 @@ PRE(sys_timer_settime64) { PRINT("sys_timer_settime64( %ld, %ld, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", SARG1,SARG2,ARG3,ARG4); - PRE_REG_READ4(long, "timer_settime64", + PRE_REG_READ4(long, "timer_settime64", vki_timer_t, timerid, int, flags, const struct vki_itimerspec64 *, value, struct vki_itimerspec64 *, ovalue); @@ -3348,7 +3348,7 @@ POST(sys_timer_settime64) PRE(sys_timer_gettime) { PRINT("sys_timer_gettime( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2); - PRE_REG_READ2(long, "timer_gettime", + PRE_REG_READ2(long, "timer_gettime", vki_timer_t, timerid, struct itimerspec *, value); PRE_MEM_WRITE( "timer_gettime(value)", ARG2, sizeof(struct vki_itimerspec)); @@ -3361,7 +3361,7 @@ POST(sys_timer_gettime) PRE(sys_timer_gettime64) { PRINT("sys_timer_gettime64( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2); - PRE_REG_READ2(long, "timer_gettime64", + PRE_REG_READ2(long, "timer_gettime64", vki_timer_t, timerid, struct vki_itimerspec64 *, value); PRE_MEM_WRITE( "timer_gettime64(value)", ARG2, sizeof(struct vki_itimerspec64)); @@ -3559,12 +3559,12 @@ POST(sys_timerfd_settime64) PRE(sys_capget) { PRINT("sys_capget ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2 ); - PRE_REG_READ2(long, "capget", + PRE_REG_READ2(long, "capget", vki_cap_user_header_t, header, vki_cap_user_data_t, data); - PRE_MEM_READ( "capget(header)", ARG1, + PRE_MEM_READ( "capget(header)", ARG1, sizeof(struct __vki_user_cap_header_struct) ); if (ARG2 != (Addr)NULL) - PRE_MEM_WRITE( "capget(data)", ARG2, + PRE_MEM_WRITE( "capget(data)", ARG2, sizeof(struct __vki_user_cap_data_struct) ); } POST(sys_capget) @@ -3576,12 +3576,12 @@ POST(sys_capget) PRE(sys_capset) { PRINT("sys_capset ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2 ); - PRE_REG_READ2(long, "capset", + PRE_REG_READ2(long, "capset", vki_cap_user_header_t, header, const vki_cap_user_data_t, data); - PRE_MEM_READ( "capset(header)", + PRE_MEM_READ( "capset(header)", ARG1, sizeof(struct __vki_user_cap_header_struct) ); - PRE_MEM_READ( "capset(data)", + PRE_MEM_READ( "capset(data)", ARG2, sizeof(struct __vki_user_cap_data_struct) ); } @@ -3874,7 +3874,7 @@ PRE(sys_fremovexattr) PRE(sys_sched_setparam) { PRINT("sched_setparam ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2 ); - PRE_REG_READ2(long, "sched_setparam", + PRE_REG_READ2(long, "sched_setparam", vki_pid_t, pid, struct sched_param *, p); PRE_MEM_READ( "sched_setparam(p)", ARG2, sizeof(struct vki_sched_param) ); } @@ -3886,7 +3886,7 @@ POST(sys_sched_setparam) PRE(sys_sched_getparam) { PRINT("sched_getparam ( %ld, %#" FMT_REGWORD "x )", SARG1, ARG2 ); - PRE_REG_READ2(long, "sched_getparam", + PRE_REG_READ2(long, "sched_getparam", vki_pid_t, pid, struct sched_param *, p); PRE_MEM_WRITE( "sched_getparam(p)", ARG2, sizeof(struct vki_sched_param) ); } @@ -3940,10 +3940,10 @@ PRE(sys_sched_setscheduler) { PRINT("sys_sched_setscheduler ( %ld, %ld, %#" FMT_REGWORD "x )", SARG1, SARG2, ARG3); - PRE_REG_READ3(long, "sched_setscheduler", + PRE_REG_READ3(long, "sched_setscheduler", vki_pid_t, pid, int, policy, struct sched_param *, p); if (ARG3 != 0) - PRE_MEM_READ( "sched_setscheduler(p)", + PRE_MEM_READ( "sched_setscheduler(p)", ARG3, sizeof(struct vki_sched_param)); } @@ -4001,7 +4001,7 @@ PRE(sys_sched_setaffinity) { PRINT("sched_setaffinity ( %ld, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", SARG1, ARG2, ARG3); - PRE_REG_READ3(long, "sched_setaffinity", + PRE_REG_READ3(long, "sched_setaffinity", vki_pid_t, pid, unsigned int, len, unsigned long *, mask); PRE_MEM_READ( "sched_setaffinity(mask)", ARG3, ARG2); } @@ -4010,7 +4010,7 @@ PRE(sys_sched_getaffinity) { PRINT("sched_getaffinity ( %ld, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", SARG1, ARG2, ARG3); - PRE_REG_READ3(long, "sched_getaffinity", + PRE_REG_READ3(long, "sched_getaffinity", vki_pid_t, pid, unsigned int, len, unsigned long *, mask); PRE_MEM_WRITE( "sched_getaffinity(mask)", ARG3, ARG2); } @@ -4268,7 +4268,7 @@ PRE(sys_getcpu) { PRINT("sys_getcpu ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )" , ARG1, ARG2, ARG3); - PRE_REG_READ3(int, "getcpu", + PRE_REG_READ3(int, "getcpu", unsigned *, cpu, unsigned *, node, struct vki_getcpu_cache *, tcache); if (ARG1 != 0) PRE_MEM_WRITE( "getcpu(cpu)", ARG1, sizeof(unsigned) ); @@ -4635,7 +4635,7 @@ PRE(sys_sigprocmask) vki_sigset_t bigger_oldset; PRINT("sys_sigprocmask ( %ld, %#lx, %#lx )", SARG1, ARG2, ARG3); - PRE_REG_READ3(long, "sigprocmask", + PRE_REG_READ3(long, "sigprocmask", int, how, vki_old_sigset_t *, set, vki_old_sigset_t *, oldset); if (ARG2 != 0) PRE_MEM_READ( "sigprocmask(set)", ARG2, sizeof(vki_old_sigset_t)); @@ -4653,7 +4653,7 @@ PRE(sys_sigprocmask) bigger_set.sig[0] = *(vki_old_sigset_t*)set; SET_STATUS_from_SysRes( - VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/, + VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/, set ? &bigger_set : NULL, oldset ? &bigger_oldset : NULL) ); @@ -4672,7 +4672,7 @@ POST(sys_sigprocmask) } /* Convert from non-RT to RT sigset_t's */ -static +static void convert_sigset_to_rt(const vki_old_sigset_t *oldset, vki_sigset_t *set) { VG_(sigemptyset)(set); @@ -4870,7 +4870,7 @@ PRE(sys_rt_sigprocmask) { PRINT("sys_rt_sigprocmask ( %ld, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG1, ARG2, ARG3, ARG4); - PRE_REG_READ4(long, "rt_sigprocmask", + PRE_REG_READ4(long, "rt_sigprocmask", int, how, vki_sigset_t *, set, vki_sigset_t *, oldset, vki_size_t, sigsetsize); if (ARG2 != 0) @@ -4901,8 +4901,8 @@ PRE(sys_rt_sigprocmask) } else { - SET_STATUS_from_SysRes( - VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/, + SET_STATUS_from_SysRes( + VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/, (vki_sigset_t*) (Addr)ARG2, (vki_sigset_t*) (Addr)ARG3 ) ); @@ -4921,7 +4921,7 @@ POST(sys_rt_sigprocmask) PRE(sys_rt_sigpending) { PRINT( "sys_rt_sigpending ( %#" FMT_REGWORD "x )", ARG1 ); - PRE_REG_READ2(long, "rt_sigpending", + PRE_REG_READ2(long, "rt_sigpending", vki_sigset_t *, set, vki_size_t, sigsetsize); PRE_MEM_WRITE( "rt_sigpending(set)", ARG1, sizeof(vki_sigset_t)); } @@ -4936,10 +4936,10 @@ PRE(sys_rt_sigtimedwait) PRINT("sys_rt_sigtimedwait ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3, ARG4); - PRE_REG_READ4(long, "rt_sigtimedwait", + PRE_REG_READ4(long, "rt_sigtimedwait", const vki_sigset_t *, set, vki_siginfo_t *, info, const struct timespec *, timeout, vki_size_t, sigsetsize); - if (ARG1 != 0) + if (ARG1 != 0) PRE_MEM_READ( "rt_sigtimedwait(set)", ARG1, sizeof(vki_sigset_t)); if (ARG2 != 0) PRE_MEM_WRITE( "rt_sigtimedwait(info)", ARG2, sizeof(vki_siginfo_t) ); @@ -4959,11 +4959,11 @@ PRE(sys_rt_sigtimedwait_time64) PRINT("sys_rt_sigtimedwait_time64 ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1, ARG2, ARG3, ARG4); - PRE_REG_READ4(long, "rt_sigtimedwait_time64", + PRE_REG_READ4(long, "rt_sigtimedwait_time64", const vki_sigset_t *, set, vki_siginfo_t *, info, const struct vki_timespec64 *, timeout, vki_size_t, sigsetsize); - if (ARG1 != 0) + if (ARG1 != 0) PRE_MEM_READ( "rt_sigtimedwait_time64(set)", ARG1, sizeof(vki_sigset_t) ); if (ARG2 != 0) PRE_MEM_WRITE( "rt_sigtimedwait_time64(info)", ARG2, @@ -4981,7 +4981,7 @@ PRE(sys_rt_sigqueueinfo) { PRINT("sys_rt_sigqueueinfo(%ld, %ld, %#" FMT_REGWORD "x)", SARG1, SARG2, ARG3); - PRE_REG_READ3(long, "rt_sigqueueinfo", + PRE_REG_READ3(long, "rt_sigqueueinfo", int, pid, int, sig, vki_siginfo_t *, uinfo); if (ARG2 != 0) PRE_MEM_READ( "rt_sigqueueinfo(uinfo)", ARG3, VKI_SI_MAX_SIZE ); @@ -5221,10 +5221,10 @@ PRE(sys_ipc) void *, ptr); Addr msgp; Word msgtyp; - + msgp = deref_Addr( tid, (Addr) (&((struct vki_ipc_kludge *)(Addr)ARG5)->msgp), "msgrcv(msgp)" ); - msgtyp = deref_Addr( tid, + msgtyp = deref_Addr( tid, (Addr) (&((struct vki_ipc_kludge *)(Addr)ARG5)->msgtyp), "msgrcv(msgp)" ); @@ -5615,12 +5615,12 @@ PRE(sys_socketcall) break; case VKI_SYS_BIND: - /* int bind(int sockfd, struct sockaddr *my_addr, + /* int bind(int sockfd, struct sockaddr *my_addr, int addrlen); */ PRE_MEM_READ_ef( "socketcall.bind(args)", ARG2, 3*sizeof(Addr) ); ML_(generic_PRE_sys_bind)( tid, ARG2_0, ARG2_1, ARG2_2 ); break; - + case VKI_SYS_LISTEN: /* int listen(int s, int backlog); */ PRE_MEM_READ_ef( "socketcall.listen(args)", ARG2, 2*sizeof(Addr) ); @@ -5639,11 +5639,11 @@ PRE(sys_socketcall) break; case VKI_SYS_SENDTO: - /* int sendto(int s, const void *msg, int len, - unsigned int flags, + /* int sendto(int s, const void *msg, int len, + unsigned int flags, const struct sockaddr *to, int tolen); */ PRE_MEM_READ_ef( "socketcall.sendto(args)", ARG2, 6*sizeof(Addr) ); - ML_(generic_PRE_sys_sendto)( tid, ARG2_0, ARG2_1, ARG2_2, + ML_(generic_PRE_sys_sendto)( tid, ARG2_0, ARG2_1, ARG2_2, ARG2_3, ARG2_4, ARG2_5 ); break; @@ -5657,10 +5657,10 @@ PRE(sys_socketcall) /* int recvfrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, int *fromlen); */ PRE_MEM_READ_ef( "socketcall.recvfrom(args)", ARG2, 6*sizeof(Addr) ); - ML_(generic_PRE_sys_recvfrom)( tid, ARG2_0, ARG2_1, ARG2_2, + ML_(generic_PRE_sys_recvfrom)( tid, ARG2_0, ARG2_1, ARG2_2, ARG2_3, ARG2_4, ARG2_5 ); break; - + case VKI_SYS_RECV: /* int recv(int s, void *buf, int len, unsigned int flags); */ /* man 2 recv says: @@ -5673,25 +5673,25 @@ PRE(sys_socketcall) break; case VKI_SYS_CONNECT: - /* int connect(int sockfd, + /* int connect(int sockfd, struct sockaddr *serv_addr, int addrlen ); */ PRE_MEM_READ_ef( "socketcall.connect(args)", ARG2, 3*sizeof(Addr) ); ML_(generic_PRE_sys_connect)( tid, ARG2_0, ARG2_1, ARG2_2 ); break; case VKI_SYS_SETSOCKOPT: - /* int setsockopt(int s, int level, int optname, + /* int setsockopt(int s, int level, int optname, const void *optval, int optlen); */ PRE_MEM_READ_ef( "socketcall.setsockopt(args)", ARG2, 5*sizeof(Addr) ); - ML_(linux_PRE_sys_setsockopt)( tid, ARG2_0, ARG2_1, ARG2_2, + ML_(linux_PRE_sys_setsockopt)( tid, ARG2_0, ARG2_1, ARG2_2, ARG2_3, ARG2_4 ); break; case VKI_SYS_GETSOCKOPT: - /* int getsockopt(int s, int level, int optname, + /* int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen); */ PRE_MEM_READ_ef( "socketcall.getsockopt(args)", ARG2, 5*sizeof(Addr) ); - ML_(linux_PRE_sys_getsockopt)( tid, ARG2_0, ARG2_1, ARG2_2, + ML_(linux_PRE_sys_getsockopt)( tid, ARG2_0, ARG2_1, ARG2_2, ARG2_3, ARG2_4 ); break; @@ -5718,7 +5718,7 @@ PRE(sys_socketcall) ML_(generic_PRE_sys_sendmsg)( tid, "msg", (struct vki_msghdr *)(Addr)ARG2_1 ); break; - + case VKI_SYS_RECVMSG: /* int recvmsg(int s, struct msghdr *msg, int flags); */ PRE_MEM_READ_ef("socketcall.recvmsg(args)", ARG2, 3*sizeof(Addr) ); @@ -5767,9 +5767,9 @@ POST(sys_socketcall) switch (ARG1 /* request */) { case VKI_SYS_SOCKETPAIR: - r = ML_(generic_POST_sys_socketpair)( - tid, VG_(mk_SysRes_Success)(RES), - ARG2_0, ARG2_1, ARG2_2, ARG2_3 + r = ML_(generic_POST_sys_socketpair)( + tid, VG_(mk_SysRes_Success)(RES), + ARG2_0, ARG2_1, ARG2_2, ARG2_3 ); SET_STATUS_from_SysRes(r); break; @@ -5780,10 +5780,10 @@ POST(sys_socketcall) break; case VKI_SYS_BIND: - /* int bind(int sockfd, struct sockaddr *my_addr, + /* int bind(int sockfd, struct sockaddr *my_addr, int addrlen); */ break; - + case VKI_SYS_LISTEN: /* int listen(int s, int backlog); */ break; @@ -5792,7 +5792,7 @@ POST(sys_socketcall) case VKI_SYS_ACCEPT4: /* int accept(int s, struct sockaddr *addr, int *addrlen); */ /* int accept4(int s, struct sockaddr *addr, int *addrlen, int flags); */ - r = ML_(generic_POST_sys_accept)( tid, VG_(mk_SysRes_Success)(RES), + r = ML_(generic_POST_sys_accept)( tid, VG_(mk_SysRes_Success)(RES), ARG2_0, ARG2_1, ARG2_2 ); SET_STATUS_from_SysRes(r); break; @@ -5821,7 +5821,7 @@ POST(sys_socketcall) case VKI_SYS_GETSOCKOPT: ML_(linux_POST_sys_getsockopt)( tid, VG_(mk_SysRes_Success)(RES), - ARG2_0, ARG2_1, + ARG2_0, ARG2_1, ARG2_2, ARG2_3, ARG2_4 ); break; @@ -5831,7 +5831,7 @@ POST(sys_socketcall) break; case VKI_SYS_GETPEERNAME: - ML_(generic_POST_sys_getpeername)( tid, VG_(mk_SysRes_Success)(RES), + ML_(generic_POST_sys_getpeername)( tid, VG_(mk_SysRes_Success)(RES), ARG2_0, ARG2_1, ARG2_2 ); break; @@ -5959,7 +5959,7 @@ PRE(sys_send) PRINT("sys_send ( %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", SARG1, ARG2, ARG3, ARG4); PRE_REG_READ4(long, "send", - int, s, const void *, msg, vki_size_t, len, + int, s, const void *, msg, vki_size_t, len, int, flags); ML_(generic_PRE_sys_send)( tid, ARG1, ARG2, ARG3 ); @@ -5972,13 +5972,13 @@ PRE(sys_sendto) FMT_REGWORD "u, %#" FMT_REGWORD "x, %ld )", SARG1, ARG2, ARG3, ARG4, ARG5, SARG6); PRE_REG_READ6(long, "sendto", - int, s, const void *, msg, vki_size_t, len, - unsigned int, flags, + int, s, const void *, msg, vki_size_t, len, + unsigned int, flags, const struct sockaddr *, to, int, tolen); ML_(generic_PRE_sys_sendto)(tid, ARG1,ARG2,ARG3,ARG4,ARG5,ARG6); } -PRE (sys_recv) +PRE (sys_recv) { *flags |= SfMayBlock; PRINT ("sys_recv ( %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" @@ -5986,12 +5986,12 @@ PRE (sys_recv) PRE_REG_READ4 (long, "recv", int, s, void *, buf, vki_size_t, len, unsigned int, flags); ML_ (generic_PRE_sys_recv) (tid, ARG1, ARG2, ARG3); -} +} -POST (sys_recv) +POST (sys_recv) { ML_ (generic_POST_sys_recv) (tid, RES, ARG1, ARG2, ARG3); -} +} PRE(sys_recvfrom) { @@ -6204,7 +6204,7 @@ PRE(sys_openat) VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)()); if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 + && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/cmdline") == 0)) { sres = VG_(dup)( VG_(cl_cmdline_fd) ); SET_STATUS_from_SysRes( sres ); @@ -6220,7 +6220,7 @@ PRE(sys_openat) VG_(sprintf)(name, "/proc/%d/auxv", VG_(getpid)()); if (ML_(safe_to_deref)( (void*)(Addr)ARG2, 1 ) - && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 + && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/auxv") == 0)) { sres = VG_(dup)( VG_(cl_auxv_fd) ); SET_STATUS_from_SysRes( sres ); @@ -6485,7 +6485,7 @@ POST(sys_readlinkat) && (VG_(strcmp)((HChar *)(Addr)ARG2, name) == 0 || VG_(strcmp)((HChar *)(Addr)ARG2, "/proc/self/exe") == 0)) { VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd)); - SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name, + SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name, ARG3, ARG4)); } @@ -6978,7 +6978,7 @@ PRE(sys_request_key) FMT_REGWORD "x(%s), %ld )", ARG1, (HChar*)(Addr)ARG1, ARG2, (HChar*)(Addr)ARG2, ARG3, (HChar*)(Addr)ARG3, SARG4); PRE_REG_READ4(long, "request_key", - const char *, type, const char *, description, + const char *, type, const char *, description, const char *, callout_info, vki_key_serial_t, keyring); PRE_MEM_RASCIIZ( "request_key(type)", ARG1); PRE_MEM_RASCIIZ( "request_key(description)", ARG2); @@ -6993,7 +6993,7 @@ PRE(sys_add_key) ARG2, (HChar*)(Addr)ARG2, ARG3, ARG4, SARG5); PRE_REG_READ5(long, "add_key", const char *, type, const char *, description, - const void *, payload, vki_size_t, plen, + const void *, payload, vki_size_t, plen, vki_key_serial_t, keyring); PRE_MEM_RASCIIZ( "add_key(type)", ARG1); PRE_MEM_RASCIIZ( "add_key(description)", ARG2); @@ -7073,7 +7073,7 @@ PRE(sys_keyctl) FMT_REGWORD "x(%s), %ld )", SARG2, ARG3, (HChar*)(Addr)ARG3, ARG4, (HChar*)(Addr)ARG4, SARG5); PRE_REG_READ5(long, "keyctl(KEYCTL_SEARCH)", - int, option, vki_key_serial_t, keyring, + int, option, vki_key_serial_t, keyring, const char *, type, const char *, description, vki_key_serial_t, destring); PRE_MEM_RASCIIZ("sys_keyctl(KEYCTL_SEARCH, type)", ARG3); @@ -7083,7 +7083,7 @@ PRE(sys_keyctl) PRINT("sys_keyctl ( KEYCTL_READ, %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", SARG2, ARG3, ARG4); PRE_REG_READ4(long, "keyctl(KEYCTL_READ)", - int, option, vki_key_serial_t, keyring, + int, option, vki_key_serial_t, keyring, char *, buffer, vki_size_t, buflen); if (ARG3 != (UWord)NULL) PRE_MEM_WRITE("keyctl(KEYCTL_READ, buffer)", ARG3, ARG4); @@ -7092,7 +7092,7 @@ PRE(sys_keyctl) PRINT("sys_keyctl ( KEYCTL_INSTANTIATE, %ld, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %ld )", SARG2, ARG3, ARG4, SARG5); PRE_REG_READ5(long, "keyctl(KEYCTL_INSTANTIATE)", - int, option, vki_key_serial_t, key, + int, option, vki_key_serial_t, key, char *, payload, vki_size_t, plen, vki_key_serial_t, keyring); if (ARG3 != (UWord)NULL) @@ -7102,7 +7102,7 @@ PRE(sys_keyctl) PRINT("sys_keyctl ( KEYCTL_NEGATE, %ld, %" FMT_REGWORD "u, %ld )", SARG2, ARG3, SARG4); PRE_REG_READ4(long, "keyctl(KEYCTL_NEGATE)", - int, option, vki_key_serial_t, key, + int, option, vki_key_serial_t, key, unsigned, timeout, vki_key_serial_t, keyring); break; case VKI_KEYCTL_SET_REQKEY_KEYRING: @@ -7564,7 +7564,7 @@ PRE(sys_fcntl64) PRE_MEM_WRITE("fcntl(F_GETOWN_EX)", ARG3, sizeof(struct vki_f_owner_ex)); break; } - + # if defined(VGP_x86_linux) if (ARG2 == VKI_F_SETLKW || ARG2 == VKI_F_SETLKW64) # else @@ -7660,7 +7660,7 @@ PRE(sys_ioctl) /* SCSI no operand */ case VKI_SCSI_IOCTL_DOORLOCK: case VKI_SCSI_IOCTL_DOORUNLOCK: - + /* CDROM stuff. */ case VKI_CDROM_DISC_STATUS: case VKI_CDROMSTOP: @@ -7774,7 +7774,7 @@ PRE(sys_ioctl) case VKI_TCSETSW: case VKI_TCSETSF: PRE_MEM_READ( "ioctl(TCSET{S,SW,SF})", ARG3, sizeof(struct vki_termios) ); - break; + break; case VKI_TCGETS: PRE_MEM_WRITE( "ioctl(TCGETS)", ARG3, sizeof(struct vki_termios) ); break; @@ -8126,7 +8126,7 @@ PRE(sys_ioctl) PRE_MEM_READ( "ioctl(SIOCGIFMIIREG)", (Addr)&((struct vki_mii_ioctl_data *)&((struct vki_ifreq *)(Addr)ARG3)->vki_ifr_data)->reg_num, sizeof(((struct vki_mii_ioctl_data *)&((struct vki_ifreq *)(Addr)ARG3)->vki_ifr_data)->reg_num)); - PRE_MEM_WRITE( "ioctl(SIOCGIFMIIREG)", ARG3, + PRE_MEM_WRITE( "ioctl(SIOCGIFMIIREG)", ARG3, sizeof(struct vki_ifreq)); break; case VKI_SIOCGIFCONF: /* get iface list */ @@ -8167,7 +8167,7 @@ PRE(sys_ioctl) case VKI_SIOCGARP: /* get ARP table entry */ PRE_MEM_WRITE( "ioctl(SIOCGARP)", ARG3, sizeof(struct vki_arpreq)); break; - + case VKI_SIOCSIFFLAGS: /* set flags */ PRE_MEM_RASCIIZ( "ioctl(SIOCSIFFLAGS)", (Addr)((struct vki_ifreq *)(Addr)ARG3)->vki_ifr_name ); @@ -8243,7 +8243,7 @@ PRE(sys_ioctl) /* Routing table calls. */ case VKI_SIOCADDRT: /* add routing table entry */ case VKI_SIOCDELRT: /* delete routing table entry */ - PRE_MEM_READ( "ioctl(SIOCADDRT/DELRT)", ARG3, + PRE_MEM_READ( "ioctl(SIOCADDRT/DELRT)", ARG3, sizeof(struct vki_rtentry)); break; @@ -8333,7 +8333,7 @@ PRE(sys_ioctl) case VKI_SOUND_PCM_READ_CHANNELS: case VKI_SOUND_PCM_READ_BITS: case VKI_SOUND_PCM_READ_FILTER: - PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOR, int))", + PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOR, int))", ARG3, sizeof(int)); break; case VKI_SNDCTL_SEQ_CTRLRATE: @@ -8351,9 +8351,9 @@ PRE(sys_ioctl) case VKI_SNDCTL_TMR_SOURCE: case VKI_SNDCTL_MIDI_PRETIME: case VKI_SNDCTL_MIDI_MPUMODE: - PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))", + PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))", ARG3, sizeof(int)); - PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))", + PRE_MEM_WRITE( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOWR, int))", ARG3, sizeof(int)); break; case VKI_SNDCTL_DSP_GETOSPACE: @@ -8364,7 +8364,7 @@ PRE(sys_ioctl) case VKI_SNDCTL_DSP_NONBLOCK: break; case VKI_SNDCTL_DSP_SETTRIGGER: - PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOW, int))", + PRE_MEM_READ( "ioctl(SNDCTL_XXX|SOUND_XXX (SIOW, int))", ARG3, sizeof(int)); break; @@ -8426,7 +8426,7 @@ PRE(sys_ioctl) break; case VKI_RTC_RD_TIME: case VKI_RTC_ALM_READ: - PRE_MEM_WRITE( "ioctl(RTC_RD_TIME/ALM_READ)", + PRE_MEM_WRITE( "ioctl(RTC_RD_TIME/ALM_READ)", ARG3, sizeof(struct vki_rtc_time)); break; case VKI_RTC_ALM_SET: @@ -8556,7 +8556,7 @@ PRE(sys_ioctl) PRE_MEM_READ( "ioctl(CDROMSUBCHNL (cdsc_format, char))", (Addr) &(((struct vki_cdrom_subchnl*) (Addr)ARG3)->cdsc_format), sizeof(((struct vki_cdrom_subchnl*) (Addr)ARG3)->cdsc_format)); - PRE_MEM_WRITE( "ioctl(CDROMSUBCHNL)", ARG3, + PRE_MEM_WRITE( "ioctl(CDROMSUBCHNL)", ARG3, sizeof(struct vki_cdrom_subchnl)); break; case VKI_CDROMREADMODE1: /*0x530d*/ @@ -8568,7 +8568,7 @@ PRE(sys_ioctl) PRE_MEM_WRITE("ioctl(CDROMREADMODE2)", ARG3, VKI_CD_FRAMESIZE_RAW0); break; case VKI_CDROMREADTOCHDR: - PRE_MEM_WRITE( "ioctl(CDROMREADTOCHDR)", ARG3, + PRE_MEM_WRITE( "ioctl(CDROMREADTOCHDR)", ARG3, sizeof(struct vki_cdrom_tochdr)); break; case VKI_CDROMREADTOCENTRY: @@ -8578,7 +8578,7 @@ PRE(sys_ioctl) PRE_MEM_READ( "ioctl(CDROMREADTOCENTRY (cdte_track, char))", (Addr) &(((struct vki_cdrom_tocentry*) (Addr)ARG3)->cdte_track), sizeof(((struct vki_cdrom_tocentry*) (Addr)ARG3)->cdte_track)); - PRE_MEM_WRITE( "ioctl(CDROMREADTOCENTRY)", ARG3, + PRE_MEM_WRITE( "ioctl(CDROMREADTOCENTRY)", ARG3, sizeof(struct vki_cdrom_tocentry)); break; case VKI_CDROMMULTISESSION: /* 0x5310 */ @@ -8603,7 +8603,7 @@ PRE(sys_ioctl) PRE_MEM_WRITE( "ioctl(CDROMREADAUDIO).buf", (Addr)(cra->buf), cra->nframes * VKI_CD_FRAMESIZE_RAW); } - break; + break; case VKI_CDROMPLAYMSF: PRE_MEM_READ( "ioctl(CDROMPLAYMSF)", ARG3, sizeof(struct vki_cdrom_msf)); break; @@ -8821,19 +8821,19 @@ PRE(sys_ioctl) break; case VKI_KDSKBMODE: break; - + case VKI_KDGKBMETA: PRE_MEM_WRITE( "ioctl(KDGKBMETA)", ARG3, sizeof(int) ); break; case VKI_KDSKBMETA: break; - + case VKI_KDGKBLED: PRE_MEM_WRITE( "ioctl(KDGKBLED)", ARG3, sizeof(char) ); break; case VKI_KDSKBLED: break; - + case VKI_KDGKBENT: PRE_MEM_READ( "ioctl(KDGKBENT).kb_table", (Addr)&((struct vki_kbentry *)(Addr)ARG3)->kb_table, @@ -8856,7 +8856,7 @@ PRE(sys_ioctl) (Addr)&((struct vki_kbentry *)(Addr)ARG3)->kb_value, sizeof(((struct vki_kbentry *)(Addr)ARG3)->kb_value) ); break; - + case VKI_KDGKBSENT: PRE_MEM_READ( "ioctl(KDGKBSENT).kb_func", (Addr)&((struct vki_kbsentry *)(Addr)ARG3)->kb_func, @@ -8872,14 +8872,14 @@ PRE(sys_ioctl) PRE_MEM_RASCIIZ( "ioctl(KDSKBSENT).kb_string", (Addr)((struct vki_kbsentry *)(Addr)ARG3)->kb_string ); break; - + case VKI_KDGKBDIACR: PRE_MEM_WRITE( "ioctl(KDGKBDIACR)", ARG3, sizeof(struct vki_kbdiacrs) ); break; case VKI_KDSKBDIACR: PRE_MEM_READ( "ioctl(KDSKBDIACR)", ARG3, sizeof(struct vki_kbdiacrs) ); break; - + case VKI_KDGETKEYCODE: PRE_MEM_READ( "ioctl(KDGETKEYCODE).scancode", (Addr)&((struct vki_kbkeycode *)(Addr)ARG3)->scancode, @@ -8896,7 +8896,7 @@ PRE(sys_ioctl) (Addr)((struct vki_kbkeycode *)(Addr)ARG3)->keycode, sizeof(((struct vki_kbkeycode *)(Addr)ARG3)->keycode) ); break; - + case VKI_KDSIGACCEPT: break; @@ -9096,7 +9096,7 @@ PRE(sys_ioctl) for (i=0; i < vkui->nmsgs; i++) { struct vki_i2c_msg *msg = vkui->msgs + i; PRE_MEM_READ("ioctl(I2C_RDWR).msgs", (Addr)msg, sizeof(struct vki_i2c_msg)); - if (msg->flags & VKI_I2C_M_RD) + if (msg->flags & VKI_I2C_M_RD) PRE_MEM_WRITE("ioctl(I2C_RDWR).msgs.buf", (Addr)msg->buf, msg->len); else PRE_MEM_READ("ioctl(I2C_RDWR).msgs.buf", (Addr)msg->buf, msg->len); @@ -9344,7 +9344,7 @@ PRE(sys_ioctl) dlr->dev_num * sizeof(struct vki_hci_dev_req)); } break; - + case VKI_HCIINQUIRY: if (ARG3) { struct vki_hci_inquiry_req* ir = @@ -10856,7 +10856,7 @@ PRE(sys_ioctl) break; } break; - } + } } POST(sys_ioctl) @@ -10894,7 +10894,7 @@ POST(sys_ioctl) at, it's possible to guess that the 7 word structure has this form - 0 1 2 3 4 5 6 + 0 1 2 3 4 5 6 ioctl-number 0x1C ptr1 ptr1size ptr2 ptr2size aBitMask Unfortunately that doesn't seem to work for some reason, @@ -10986,7 +10986,7 @@ POST(sys_ioctl) case VKI_TCSETSW: case VKI_TCSETSF: case VKI_IB_USER_MAD_ENABLE_PKEY: - break; + break; case VKI_TCGETS: POST_MEM_WRITE( ARG3, sizeof(struct vki_termios) ); break; @@ -11091,7 +11091,7 @@ POST(sys_ioctl) break; case VKI_SG_GET_SG_TABLESIZE: POST_MEM_WRITE(ARG3, sizeof(int)); - break; + break; case VKI_IIOCGETCPS: POST_MEM_WRITE( ARG3, VKI_ISDN_MAX_CHANNELS * 2 * sizeof(unsigned long) ); @@ -11288,7 +11288,7 @@ POST(sys_ioctl) case VKI_SIOCGARP: /* get ARP table entry */ POST_MEM_WRITE(ARG3, sizeof(struct vki_arpreq)); break; - + case VKI_SIOCSIFFLAGS: /* set flags */ case VKI_SIOCSIFMAP: /* Set device parameters */ case VKI_SIOCSHWTSTAMP: /* Set hardware time stamping */ @@ -11585,7 +11585,7 @@ POST(sys_ioctl) POST_MEM_WRITE( (Addr)(cra->buf), cra->nframes * VKI_CD_FRAMESIZE_RAW); break; } - + case VKI_CDROMPLAYMSF: break; /* The following two are probably bogus (should check args @@ -11740,46 +11740,46 @@ POST(sys_ioctl) break; case VKI_KDSKBMODE: break; - + case VKI_KDGKBMETA: POST_MEM_WRITE( ARG3, sizeof(int) ); break; case VKI_KDSKBMETA: break; - + case VKI_KDGKBLED: POST_MEM_WRITE( ARG3, sizeof(char) ); break; case VKI_KDSKBLED: break; - + case VKI_KDGKBENT: POST_MEM_WRITE( (Addr)&((struct vki_kbentry *)(Addr)ARG3)->kb_value, sizeof(((struct vki_kbentry *)(Addr)ARG3)->kb_value) ); break; case VKI_KDSKBENT: break; - + case VKI_KDGKBSENT: POST_MEM_WRITE( (Addr)((struct vki_kbsentry *)(Addr)ARG3)->kb_string, sizeof(((struct vki_kbsentry *)(Addr)ARG3)->kb_string) ); break; case VKI_KDSKBSENT: break; - + case VKI_KDGKBDIACR: POST_MEM_WRITE( ARG3, sizeof(struct vki_kbdiacrs) ); break; case VKI_KDSKBDIACR: break; - + case VKI_KDGETKEYCODE: POST_MEM_WRITE( (Addr)((struct vki_kbkeycode *)(Addr)ARG3)->keycode, sizeof(((struct vki_kbkeycode *)(Addr)ARG3)->keycode) ); break; case VKI_KDSETKEYCODE: break; - + case VKI_KDSIGACCEPT: break; @@ -11899,7 +11899,7 @@ POST(sys_ioctl) dir2 = _VKI_IOC_DIR(vkui->ioctl_code); size2 = _VKI_IOC_SIZE(vkui->ioctl_code); if (size2 > 0) { - if (dir2 & _VKI_IOC_READ) + if (dir2 & _VKI_IOC_READ) POST_MEM_WRITE((Addr)vkui->data, size2); } } @@ -11921,7 +11921,7 @@ POST(sys_ioctl) UInt i; for (i=0; i < vkui->nmsgs; i++) { struct vki_i2c_msg *msg = vkui->msgs + i; - if (msg->flags & VKI_I2C_M_RD) + if (msg->flags & VKI_I2C_M_RD) POST_MEM_WRITE((Addr)msg->buf, msg->len); } } @@ -13025,12 +13025,12 @@ POST(sys_ioctl) socketcall wrapper helpers ------------------------------------------------------------------ */ -void -ML_(linux_PRE_sys_getsockopt) ( ThreadId tid, +void +ML_(linux_PRE_sys_getsockopt) ( ThreadId tid, UWord arg0, UWord arg1, UWord arg2, UWord arg3, UWord arg4 ) { - /* int getsockopt(int s, int level, int optname, + /* int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen); */ Addr optval_p = arg3; Addr optlen_p = arg4; @@ -13040,7 +13040,7 @@ ML_(linux_PRE_sys_getsockopt) ( ThreadId tid, "socketcall.getsockopt(optval)", "socketcall.getsockopt(optlen)" ); if (arg1 == VKI_SOL_SCTP && - (arg2 == VKI_SCTP_GET_PEER_ADDRS || + (arg2 == VKI_SCTP_GET_PEER_ADDRS || arg2 == VKI_SCTP_GET_LOCAL_ADDRS)) { struct vki_sctp_getaddrs *ga = (struct vki_sctp_getaddrs*)arg3; @@ -13051,7 +13051,7 @@ ML_(linux_PRE_sys_getsockopt) ( ThreadId tid, } } -void +void ML_(linux_POST_sys_getsockopt) ( ThreadId tid, SysRes res, UWord arg0, UWord arg1, UWord arg2, @@ -13067,7 +13067,7 @@ ML_(linux_POST_sys_getsockopt) ( ThreadId tid, (arg2 == VKI_SCTP_GET_PEER_ADDRS || arg2 == VKI_SCTP_GET_LOCAL_ADDRS)) { - struct vki_sctp_getaddrs *ga = (struct vki_sctp_getaddrs*)arg3; + struct vki_sctp_getaddrs *ga = (struct vki_sctp_getaddrs*)arg3; struct vki_sockaddr *a = ga->addrs; int i; for (i = 0; i < ga->addr_num; i++) { @@ -13082,17 +13082,17 @@ ML_(linux_POST_sys_getsockopt) ( ThreadId tid, } a = (struct vki_sockaddr*)((char*)a + sl); } - POST_MEM_WRITE( (Addr)ga->addrs, (char*)a - (char*)ga->addrs ); + POST_MEM_WRITE( (Addr)ga->addrs, (char*)a - (char*)ga->addrs ); } } } -void -ML_(linux_PRE_sys_setsockopt) ( ThreadId tid, +void +ML_(linux_PRE_sys_setsockopt) ( ThreadId tid, UWord arg0, UWord arg1, UWord arg2, UWord arg3, UWord arg4 ) { - /* int setsockopt(int s, int level, int optname, + /* int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen); */ Addr optval_p = arg3; if (optval_p != (Addr)NULL) { diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 7f78e23ec..826c87937 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -363,7 +363,7 @@ asm( void VG_(cleanup_thread) ( ThreadArchState* arch ) { -} +} /* --------------------------------------------------------------------- PRE/POST wrappers for ppc64/Linux-specific syscalls @@ -399,7 +399,7 @@ PRE(sys_mmap) unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long, offset); - r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, + r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, (Off64T)ARG6 ); SET_STATUS_from_SysRes(r); } @@ -407,7 +407,7 @@ PRE(sys_mmap) //zz PRE(sys_mmap2) //zz { //zz SysRes r; -//zz +//zz //zz // Exactly like old_mmap() except: //zz // - the file offset is specified in 4K units rather than bytes, //zz // so that it can be used for files bigger than 2^32 bytes. @@ -417,12 +417,12 @@ PRE(sys_mmap) //zz unsigned long, start, unsigned long, length, //zz unsigned long, prot, unsigned long, flags, //zz unsigned long, fd, unsigned long, offset); -//zz -//zz r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, +//zz +//zz r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, //zz 4096 * (Off64T)ARG6 ); //zz SET_STATUS_from_SysRes(r); //zz } -//zz +//zz //zz // XXX: lstat64/fstat64/stat64 are generic, but not necessarily //zz // applicable to every architecture -- I think only to 32-bit archs. //zz // We're going to need something like linux/core_os32.h for such @@ -434,12 +434,12 @@ PRE(sys_mmap) //zz PRE_MEM_RASCIIZ( "stat64(file_name)", ARG1 ); //zz PRE_MEM_WRITE( "stat64(buf)", ARG2, sizeof(struct vki_stat64) ); //zz } -//zz +//zz //zz POST(sys_stat64) //zz { //zz POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); //zz } -//zz +//zz //zz PRE(sys_lstat64) //zz { //zz PRINT("sys_lstat64 ( %p(%s), %p )",ARG1,ARG1,ARG2); @@ -447,7 +447,7 @@ PRE(sys_mmap) //zz PRE_MEM_RASCIIZ( "lstat64(file_name)", ARG1 ); //zz PRE_MEM_WRITE( "lstat64(buf)", ARG2, sizeof(struct vki_stat64) ); //zz } -//zz +//zz //zz POST(sys_lstat64) //zz { //zz vg_assert(SUCCESS); @@ -455,14 +455,14 @@ PRE(sys_mmap) //zz POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); //zz } //zz } -//zz +//zz //zz PRE(sys_fstat64) //zz { //zz PRINT("sys_fstat64 ( %d, %p )",ARG1,ARG2); //zz PRE_REG_READ2(long, "fstat64", unsigned long, fd, struct stat64 *, buf); //zz PRE_MEM_WRITE( "fstat64(buf)", ARG2, sizeof(struct vki_stat64) ); //zz } -//zz +//zz //zz POST(sys_fstat64) //zz { //zz POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); @@ -588,7 +588,7 @@ POST(sys_ptrace) ------------------------------------------------------------------ */ /* Add an ppc64-linux specific wrapper to a syscall table. */ -#define PLAX_(sysno, name) WRAPPER_ENTRY_X_(ppc64_linux, sysno, name) +#define PLAX_(sysno, name) WRAPPER_ENTRY_X_(ppc64_linux, sysno, name) #define PLAXY(sysno, name) WRAPPER_ENTRY_XY(ppc64_linux, sysno, name) // This table maps from __NR_xxx syscall numbers (from @@ -713,7 +713,7 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_truncate, sys_truncate), // 92 GENX_(__NR_ftruncate, sys_ftruncate), // 93 GENX_(__NR_fchmod, sys_fchmod), // 94 - + GENX_(__NR_fchown, sys_fchown), // 95 GENX_(__NR_getpriority, sys_getpriority), // 96 GENX_(__NR_setpriority, sys_setpriority), // 97