VecPtrAt
Description
Pointer to the element at idx. Use this rather than indexing data directly so the canonical element stride is used.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in | Vector to query. |
idx |
in | Index in [0, length). |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Foreach.h:85:
if ((ValidateVec(UNPL(pv)), 1) && UNPL(pv)->length > 0) \
for (u64 idx = 0, UNPL(d) = 1; UNPL(d); UNPL(d)--) \
for (VEC_DATATYPE(UNPL(pv)) *var = NULL; idx < UNPL(pv)->length && (var = VecPtrAt(UNPL(pv), idx), 1); \
idx++)- In
Foreach.h:112:
for (u64 idx = UNPL(pv)->length; idx-- > 0 && idx < UNPL(pv)->length;) \
for (u8 UNPL(run_once) = 1; UNPL(run_once); UNPL(run_once) = 0) \
for (VEC_DATATYPE(UNPL(pv)) *var = VecPtrAt(UNPL(pv), idx); UNPL(run_once); UNPL(run_once) = 0)
///
- In
Foreach.h:220:
idx >= UNPL(s) && idx < UNPL(e) && idx < UNPL(pv)->length && UNPL(s) <= UNPL(e); \
++idx, UNPL(d) = 1) \
for (VEC_DATATYPE(UNPL(pv)) *var = VecPtrAt(UNPL(pv), idx); UNPL(d); UNPL(d) = 0)
///
- In
Access.h:118:
/// TAGS: Str, Access, Index, Pointer
///
#define StrCharPtrAt(str, idx) VecPtrAt(str, idx)
///
- In
VecInt.c:326:
uint16_t idx = extract_u16(data, offset, data_size);
if (idx < VecLen(vec)) {
volatile i32 *ptr = VecPtrAt(vec, idx);
volatile i32 val = *ptr;
(void)val;- In
VecCharPtr.c:393:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
char **ptr = VecPtrAt(vec, index);
(void)ptr; // Use the result to avoid warnings
}- In
VecStr.c:381:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
Str *ptr = VecPtrAt(vec, index);
(void)ptr; // Use the result to avoid warnings
}- In
ArgParse.c:375:
for (u64 i = 0; i < n_specs; ++i) {
left_col[i] = StrInit(self->alloc);
left_w[i] = spec_format_left(VecPtrAt(&self->specs, i), &left_col[i]);
if (left_w[i] > max_w)
max_w = left_w[i];- In
ArgParse.c:384:
bool printed_options_header = false;
for (u64 i = 0; i < n_specs; ++i) {
ArgSpec *sp = VecPtrAt(&self->specs, i);
if (sp->role != ARG_ROLE_POSITIONAL)
continue;- In
ArgParse.c:400:
for (u64 i = 0; i < n_specs; ++i) {
ArgSpec *sp = VecPtrAt(&self->specs, i);
if (sp->role == ARG_ROLE_POSITIONAL)
continue;- In
Graph.c:57:
static GenericGraphSlot *graph_slot_ptr_raw(GenericGraph *graph, u32 index) {
return VecPtrAt(&graph->slots, index);
}- In
Graph.c:61:
static const GenericGraphSlot *graph_slot_ptr_const_raw(const GenericGraph *graph, u32 index) {
return VecPtrAt((GraphSlots *)&graph->slots, index);
}- In
Graph.c:225:
for (idx = 0; idx < VecLen(&graph->pending_edge_removals); idx++) {
const GraphPendingEdgeRemoval *pending =
VecPtrAt((GraphPendingEdgeRemovals *)&graph->pending_edge_removals, idx);
if ((pending->from == from) && (pending->to == to)) {
return idx;- In
Graph.c:356:
for (slot_index = 0; slot_index < VecLen(&graph->slots); slot_index++) {
const GenericGraphSlot *slot = VecPtrAt((GraphSlots *)&graph->slots, slot_index);
GraphNodeId self_id = graph_make_node_id((u32)slot_index, slot->generation);
u64 neighbor_i;- In
Graph.c:423:
}
if (graph_slot_is_occupied(VecPtrAt((GraphSlots *)&graph->slots, index))) {
LOG_FATAL("Graph free index points to an occupied slot");
}- In
Graph.c:430:
for (free_index_i = 0; free_index_i < VecLen(&graph->pending_edge_removals); free_index_i++) {
const GraphPendingEdgeRemoval *pending =
VecPtrAt((GraphPendingEdgeRemovals *)&graph->pending_edge_removals, free_index_i);
const GraphNeighbors *neighbors;- In
Graph.c:474:
for (slot_index = 0; slot_index < VecLen(&graph->slots); slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot)) {
graph_release_slot(graph, slot, item_size);- In
Graph.c:914:
explicit_edge_removal_count = VecLen(&graph->pending_edge_removals);
for (edge_idx = 0; edge_idx < VecLen(&graph->pending_edge_removals); edge_idx++) {
GraphPendingEdgeRemoval *pending = VecPtrAt(&graph->pending_edge_removals, edge_idx);
(void)graph_remove_edge_now(graph, pending->from, pending->to);
}- In
Graph.c:920:
for (slot_index = 0; slot_index < VecLen(&graph->slots); slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot) && graph_slot_is_marked(slot)) {
GraphNodeId marked_id = graph_make_node_id((u32)slot_index, slot->generation);- In
Graph.c:928:
for (slot_index = 0; slot_index < VecLen(&graph->slots); slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot) && !graph_slot_is_marked(slot)) {
GraphNodeId live_id = graph_make_node_id((u32)slot_index, slot->generation);- In
Graph.c:936:
for (slot_index = 0; slot_index < VecLen(&graph->slots); slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot) && graph_slot_is_marked(slot)) {
if (VecLen(&slot->out_neighbors) || VecLen(&slot->in_neighbors)) {- In
Graph.c:980:
while (iter->slot_index < VecLen(&iter->graph->slots)) {
u32 index = (u32)iter->slot_index;
GenericGraphSlot *slot = VecPtrAt(&iter->graph->slots, iter->slot_index);
iter->slot_index += 1;- In
Debug.c:211:
static const DebugFreedEntry *debug_freed_find(const DebugAllocator *dbg, void *ptr) {
for (u32 i = 0; i < VecLen(&dbg->freed); i++) {
if (VecPtrAt(&dbg->freed, i)->ptr == ptr)
return VecPtrAt(&dbg->freed, i);
}- In
Debug.c:212:
for (u32 i = 0; i < VecLen(&dbg->freed); i++) {
if (VecPtrAt(&dbg->freed, i)->ptr == ptr)
return VecPtrAt(&dbg->freed, i);
}
return NULL;- In
Dir.c:546:
bool trail_sep = (path_len > 0 && path[path_len - 1] == '/');
for (size i = 0; i < VecLen(&dc); ++i) {
DirEntry *e = VecPtrAt(&dc, i);
Zstr entry_nm = StrBegin(&e->name);
if (ZstrCompare(entry_nm, ".") == 0 || ZstrCompare(entry_nm, "..") == 0) { static ResolverCacheEntry *resolver_cache_find_or_open(SymbolResolver *self, Zstr path) {
for (u64 i = 0; i < VecLen(&self->cache); ++i) {
ResolverCacheEntry *e = VecPtrAt(&self->cache, i);
if (e->path == path) {
return e; return NULL;
}
return VecPtrAt(&self->cache, VecLen(&self->cache) - 1);
} return;
for (u64 i = 0; i < VecLen(&self->cache); ++i) {
ResolverCacheEntry *e = VecPtrAt(&self->cache, i);
#if FEATURE_PARSER_DWARF
if (e->dwarf_built && e->dwarf_ok) { const ElfSymbol *best = NULL;
for (u64 i = 0; i < VecLen(syms); ++i) {
const ElfSymbol *s = VecPtrAt(syms, i);
// Consider only real address symbols. Like llvm-symbolizer, keep
// NOTYPE/FUNC/OBJECT (NOTYPE covers hand-written asm) and drop
- In
PdbCache.c:95:
static PdbCacheEntry *cache_find_or_open(PdbCache *self, Zstr module_path) {
for (size i = 0; i < VecLen(&self->entries); ++i) {
PdbCacheEntry *e = VecPtrAt(&self->entries, i);
if (StrBegin(&e->module_path) && ZstrCompare(StrBegin(&e->module_path), module_path) == 0) {
return e;- In
PdbCache.c:111:
return NULL;
}
return VecPtrAt(&self->entries, VecLen(&self->entries) - 1);
}- In
PdbCache.c:122:
return;
for (size i = 0; i < VecLen(&self->entries); ++i) {
PdbCacheEntry *e = VecPtrAt(&self->entries, i);
if (e->pdb_open)
PdbDeinit(&e->pdb);- In
MachoCache.c:41:
static MachoCacheEntry *cache_find_or_create(MachoCache *self, Zstr module_path) {
for (size i = 0; i < VecLen(&self->entries); ++i) {
MachoCacheEntry *e = VecPtrAt(&self->entries, i);
if (StrBegin(&e->module_path) && ZstrCompare(StrBegin(&e->module_path), module_path) == 0) {
return e;- In
MachoCache.c:57:
return NULL;
}
return VecPtrAt(&self->entries, VecLen(&self->entries) - 1);
}- In
MachoCache.c:134:
return;
for (size i = 0; i < VecLen(&self->entries); ++i) {
MachoCacheEntry *e = VecPtrAt(&self->entries, i);
if (e->fns_built && e->fns_ok)
DwarfFunctionsDeinit(&e->fns);- In
Pe.c:581:
return NULL;
for (size i = 0; i < VecLen(&self->sections); ++i) {
const PeSection *s = VecPtrAt(&self->sections, i);
if (ZstrCompare(s->name, name) == 0) {
return s;- In
Pe.c:599:
return false;
for (size i = 0; i < VecLen(&self->sections); ++i) {
const PeSection *s = VecPtrAt(&self->sections, i);
// Compute the section end in u64; u32 + u32 can wrap.
u64 vstart = (u64)s->virtual_address;- In
DwarfInfo.c:99:
static void abbrev_table_deinit(AbbrevTable *t) {
for (size i = 0; i < VecLen(t); ++i) {
VecDeinit(&VecPtrAt(t, i)->attrs);
}
VecDeinit(t);- In
DwarfInfo.c:161:
static const AbbrevEntry *abbrev_table_find(const AbbrevTable *t, u64 code) {
for (size i = 0; i < VecLen(t); ++i) {
if (VecPtrAt(t, i)->code == code)
return VecPtrAt(t, i);
}- In
DwarfInfo.c:162:
for (size i = 0; i < VecLen(t); ++i) {
if (VecPtrAt(t, i)->code == code)
return VecPtrAt(t, i);
}
return NULL;- In
DwarfInfo.c:379:
for (size ai = 0; ai < VecLen(&e->attrs); ++ai) {
const AbbrevAttr *a = VecPtrAt(&e->attrs, ai);
AttrVal v;
if (!read_form(&cu_cur, a->form, addr_size, &v))- In
DwarfInfo.c:610:
// has stopped growing.
for (size i = 0; i < VecLen(&pending); ++i) {
const PendingFn *pf = VecPtrAt(&pending, i);
DwarfFunction f = {
.low_pc = pf->low_pc,- In
DwarfInfo.c:665:
while (lo < hi) {
size mid = lo + (hi - lo) / 2;
if (VecPtrAt(&self->entries, mid)->low_pc <= vaddr)
lo = mid + 1;
else- In
DwarfInfo.c:672:
if (lo == 0)
return NULL;
const DwarfFunction *e = VecPtrAt(&self->entries, lo - 1);
if (vaddr >= e->low_pc && vaddr < e->high_pc)
return e;- In
Pdb.c:665:
// sizes by next-rva diff.
for (size i = 0; i < VecLen(&pending); ++i) {
const PendingPub *pp = VecPtrAt(&pending, i);
PdbFunction f = {
.rva = pp->rva,- In
Pdb.c:677:
// order. If next.rva < f.rva (impossible today), leave
// size = 0 rather than wrap.
u32 next_rva = VecPtrAt(&pending, i + 1)->rva;
f.size = next_rva >= f.rva ? next_rva - f.rva : 0;
}- In
Pdb.c:784:
while (lo < hi) {
size mid = lo + (hi - lo) / 2;
if (((const PdbFunction *)VecPtrAt(&self->functions, mid))->rva <= rva)
lo = mid + 1;
else- In
Pdb.c:791:
if (lo == 0)
return NULL;
const PdbFunction *f = VecPtrAt(&self->functions, lo - 1);
// size == 0 means "until next entry"; we already accept that case.
// Widen to u64 to avoid u32 wrap: rva and size are both u32, so a
- In
ProcMaps.c:196:
// Cache the lowest mapped address so callers don't rescan the vector.
for (u64 i = 0; i < VecLen(&out->entries); ++i) {
const ProcMapEntry *e = VecPtrAt(&out->entries, i);
if (i == 0 || e->start < out->min_addr)
out->min_addr = e->start;- In
ProcMaps.c:306:
return NULL;
for (u64 i = 0; i < VecLen(&self->entries); ++i) {
const ProcMapEntry *e = VecPtrAt(&self->entries, i);
if (addr >= e->start && addr < e->end) {
return e; return NULL;
for (u64 i = 0; i < VecLen(&self->cies); ++i) {
if (VecPtrAt(&self->cies, i)->offset == cie_offset) {
return VecPtrAt(&self->cies, i);
} for (u64 i = 0; i < VecLen(&self->cies); ++i) {
if (VecPtrAt(&self->cies, i)->offset == cie_offset) {
return VecPtrAt(&self->cies, i);
}
} // Linear scan -- fine up to a few thousand FDEs.
for (u64 i = 0; i < VecLen(&self->fdes); ++i) {
const DwarfFde *f = VecPtrAt(&self->fdes, i);
if (vaddr >= f->pc_begin && vaddr < f->pc_begin + f->pc_range) {
return f;- In
MachO.c:488:
return NULL;
for (size i = 0; i < VecLen(&self->sections); ++i) {
const MachoSection *s = VecPtrAt(&self->sections, i);
if (ZstrCompare(s->segment, segment) == 0 && ZstrCompare(s->section, section) == 0) {
return s;- In
MachO.c:513:
for (size i = 0; i < VecLen(&self->symbols); ++i) {
const MachoSymbol *s = VecPtrAt(&self->symbols, i);
if (s->type & N_STAB_MASK)
continue; // any high bit set => STAB (debug) entry
- In
Elf.c:321:
return false;
}
const ElfSection *strtab = VecPtrAt(&self->sections, strtab_idx);
if (!elf_range_ok(self, strtab->offset, strtab->size)) {
LOG_ERROR("Elf: strtab out of range");- In
Elf.c:369:
for (u64 i = 0; i < VecLen(&self->sections); ++i) {
const ElfSection *s = VecPtrAt(&self->sections, i);
if (s->type == ELF_SECTION_TYPE_SYMTAB) {
symtab = s;- In
Elf.c:556:
const ElfSymbol *best = NULL;
for (u64 i = 0; i < VecLen(syms); ++i) {
const ElfSymbol *s = VecPtrAt(syms, i);
if (s->size == 0) {
// Some symbols (e.g. labels) have zero size — only match
- In
Elf.c:589:
return NULL;
for (u64 i = 0; i < VecLen(&self->sections); ++i) {
const ElfSection *s = VecPtrAt(&self->sections, i);
if (s->name && ZstrCompare(s->name, name) == 0) {
return s;- In
Dwarf.c:643:
u64 fo = VecAt(&pending_file_offsets, i);
u64 dofs = VecAt(&pending_dir_offsets, i);
VecPtrAt(&out->entries, i)->file = fo ? (Zstr)(StrBegin(&out->string_pool) + fo) : NULL;
VecPtrAt(&out->entries, i)->dir = dofs ? (Zstr)(StrBegin(&out->string_pool) + dofs) : NULL;
}- In
Dwarf.c:644:
u64 dofs = VecAt(&pending_dir_offsets, i);
VecPtrAt(&out->entries, i)->file = fo ? (Zstr)(StrBegin(&out->string_pool) + fo) : NULL;
VecPtrAt(&out->entries, i)->dir = dofs ? (Zstr)(StrBegin(&out->string_pool) + dofs) : NULL;
}
}- In
Dwarf.c:681:
const DwarfLineEntry *seq_open = NULL;
for (u64 i = 0; i < VecLen(&self->entries); ++i) {
const DwarfLineEntry *e = VecPtrAt(&self->entries, i);
if (e->end_sequence) {
// Sequence ends at this row's address (exclusive upper).
- In
AllocDebug.c:187:
// `DebugFreedEntry` structs with no public accessor; reach in to
// confirm each entry carries the ptr + both traces.
ok = ok && (VecPtrAt(&dbg.freed, 0)->ptr == p1) && (VecPtrAt(&dbg.freed, 0)->requested_size == 16);
ok = ok && (VecPtrAt(&dbg.freed, 0)->alloc_trace_n > 0) && (VecPtrAt(&dbg.freed, 0)->free_trace_n > 0);
ok = ok && (VecPtrAt(&dbg.freed, 2)->ptr == p3) && (VecPtrAt(&dbg.freed, 2)->requested_size == 64);- In
AllocDebug.c:188:
// confirm each entry carries the ptr + both traces.
ok = ok && (VecPtrAt(&dbg.freed, 0)->ptr == p1) && (VecPtrAt(&dbg.freed, 0)->requested_size == 16);
ok = ok && (VecPtrAt(&dbg.freed, 0)->alloc_trace_n > 0) && (VecPtrAt(&dbg.freed, 0)->free_trace_n > 0);
ok = ok && (VecPtrAt(&dbg.freed, 2)->ptr == p3) && (VecPtrAt(&dbg.freed, 2)->requested_size == 64);- In
AllocDebug.c:189:
ok = ok && (VecPtrAt(&dbg.freed, 0)->ptr == p1) && (VecPtrAt(&dbg.freed, 0)->requested_size == 16);
ok = ok && (VecPtrAt(&dbg.freed, 0)->alloc_trace_n > 0) && (VecPtrAt(&dbg.freed, 0)->free_trace_n > 0);
ok = ok && (VecPtrAt(&dbg.freed, 2)->ptr == p3) && (VecPtrAt(&dbg.freed, 2)->requested_size == 64);
DebugAllocatorDeinit(&dbg);- In
AllocDebug.c:380:
AllocatorFree(adbg, p);
ok = ok && (DebugAllocatorFreedCount(&dbg) == 1);
ok = ok && (VecPtrAt(&dbg.freed, 0)->alloc_trace_n == live_n);
DebugAllocatorDeinit(&dbg);- In
AllocDebug.c:409:
ok = ok && (DebugAllocatorFreedCount(&dbg) == 1);
const DebugFreedEntry *fe = VecPtrAt(&dbg.freed, 0);
bool match = ok;
for (u32 i = 0; ok && i < n; i++) {- In
AllocDebug.c:438:
ok = ok && (DebugAllocatorFreedCount(&dbg) == 1);
ok = ok && (VecPtrAt(&dbg.freed, 0)->free_trace_n == 0);
DebugAllocatorDeinit(&dbg);- In
AllocDebug.c:464:
ok = ok && (DebugAllocatorFreedCount(&dbg) == 1);
ok = ok && (VecPtrAt(&dbg.freed, 0)->free_trace_n == 2);
DebugAllocatorDeinit(&dbg);- In
AllocDebug.c:489:
ok = ok && (DebugAllocatorFreedCount(&dbg) == 1);
ok = ok && (VecPtrAt(&dbg.freed, 0)->free_trace_n <= DEBUG_ALLOCATOR_MAX_TRACE);
DebugAllocatorDeinit(&dbg); // overshoots from this deep stack.
if (ok) {
u32 n = VecPtrAt(&dbg.freed, 0)->free_trace_n;
ok = ok && (n > 0) && (n <= DEBUG_ALLOCATOR_MAX_TRACE);
}- In
Ops.c:632:
// logical lengths to 0 (stale b remains in a.out's buffer at index 0) so
// the graph looks edge-free while the pending removal still names a->b.
GenericGraphSlot *slot_a = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(a));
GenericGraphSlot *slot_b = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(b));
slot_a->out_neighbors.length = 0;- In
Ops.c:633:
// the graph looks edge-free while the pending removal still names a->b.
GenericGraphSlot *slot_a = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(a));
GenericGraphSlot *slot_b = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(b));
slot_a->out_neighbors.length = 0;
slot_b->in_neighbors.length = 0;- In
Init.c:61:
// `graph.slots` is the typed `Vec(GraphSlot(int))`, so iterate via
// the runtime-shared layout to avoid an anonymous-struct annotation.
GenericGraphSlot *slot = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, slot_index);
result = result && (slot->data == NULL);
result = result && (slot->visit_count == 0);- In
Init.c:69:
}
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(first_id))->generation == (first_generation + 1));
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(second_id))->generation == (second_generation + 1));
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(third_id))->generation == (third_generation + 1));- In
Init.c:70:
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(first_id))->generation == (first_generation + 1));
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(second_id))->generation == (second_generation + 1));
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(third_id))->generation == (third_generation + 1));- In
Init.c:71:
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(first_id))->generation == (first_generation + 1));
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(second_id))->generation == (second_generation + 1));
result = result && (VecPtrAt(&graph.slots, GraphNodeIdIndex(third_id))->generation == (third_generation + 1));
GraphDeinit(&graph);- In
Type.c:12:
static GenericGraphSlot *mutant_slot(void *graph_handle, GraphNodeId id) {
GenericGraph *g = GENERIC_GRAPH(graph_handle);
return (GenericGraphSlot *)VecPtrAt(&g->slots, GraphNodeIdIndex(id));
}- In
Type.c:250:
GenericGraphSlot *b_slot = mutant_slot(&graph, b);
// b.in_neighbors is [a, c]; overwrite the 'a' entry with 'c' -> [c, c].
*VecPtrAt(&b_slot->in_neighbors, 0) = c;
MAGIC_MARK_DIRTY(GENERIC_GRAPH(&graph));- In
Type.c:282:
GenericGraphSlot *c_slot = mutant_slot(&graph, c);
// c.in_neighbors is [a, b]; overwrite the 'a' entry with 'b' -> [b, b].
*VecPtrAt(&c_slot->in_neighbors, 0) = b;
MAGIC_MARK_DIRTY(GENERIC_GRAPH(&graph));- In
Type.c:316:
GenericGraphSlot *b_slot = mutant_slot(&graph, b);
// b.out_neighbors is [a, c]; overwrite the 'a' entry with 'c' -> [c, c].
*VecPtrAt(&b_slot->out_neighbors, 0) = c;
MAGIC_MARK_DIRTY(GENERIC_GRAPH(&graph));- In
Type.c:348:
GenericGraphSlot *c_slot = mutant_slot(&graph, c);
// c.out_neighbors is [a, b]; overwrite the 'a' entry with 'b' -> [b, b].
*VecPtrAt(&c_slot->out_neighbors, 0) = b;
MAGIC_MARK_DIRTY(GENERIC_GRAPH(&graph));- In
Type.c:381:
GenericGraph *g = GENERIC_GRAPH(&graph);
// free_indices now holds b's old slot index; redirect it to a (occupied).
*VecPtrAt(&g->free_indices, 0) = GraphNodeIdIndex(a);
MAGIC_MARK_DIRTY(g);- In
Type.c:411:
GenericGraph *g = GENERIC_GRAPH(&graph);
// Point the free index exactly one past the last slot.
*VecPtrAt(&g->free_indices, 0) = (u32)VecLen(&g->slots);
MAGIC_MARK_DIRTY(g);- In
Type.c:443:
// free_indices now holds two freed indices; redirect the last to a
// (occupied) so only a loop that reaches the last entry catches it.
*VecPtrAt(&g->free_indices, VecLen(&g->free_indices) - 1) = GraphNodeIdIndex(a);
MAGIC_MARK_DIRTY(g);- In
Type.c:476:
GenericGraph *g = GENERIC_GRAPH(&graph);
// pending_edge_removals = [{a, b}]; redirect 'to' to d (no a->d edge).
VecPtrAt(&g->pending_edge_removals, 0)->to = d;
MAGIC_MARK_DIRTY(g);- In
Type.c:509:
GenericGraph *g = GENERIC_GRAPH(&graph);
// pending_edge_removals = [{a, b}, {a, c}]; break the second one.
VecPtrAt(&g->pending_edge_removals, 1)->to = d;
MAGIC_MARK_DIRTY(g);- In
Type.c:543:
// node but not an out-neighbor of `a`, so the recorded removal now refers
// to a non-existent edge.
VecPtrAt(&graph.pending_edge_removals, 0)->to = c;
// Re-arm the memoized deep validation so the next ValidateGraph re-walks
- In
Foreach.c:382:
// neighbor id so its generation is 0 (an always-invalid generation),
// without bumping the mutation epoch or re-flagging the validated bit.
GenericGraphSlot *slot_a = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(a));
GraphNodeId *entry = VecPtrAt(&slot_a->out_neighbors, 0);
*entry = (GraphNodeId)GraphNodeIdIndex(b);- In
Foreach.c:383:
// without bumping the mutation epoch or re-flagging the validated bit.
GenericGraphSlot *slot_a = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(a));
GraphNodeId *entry = VecPtrAt(&slot_a->out_neighbors, 0);
*entry = (GraphNodeId)GraphNodeIdIndex(b);- In
Foreach.c:415:
// Intentional bypass: rewrite `b`'s sole in-neighbor (a) so its generation
// is 0, leaving the epoch and validated bit untouched.
GenericGraphSlot *slot_b = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(b));
GraphNodeId *entry = VecPtrAt(&slot_b->in_neighbors, 0);
*entry = (GraphNodeId)GraphNodeIdIndex(a);- In
Foreach.c:416:
// is 0, leaving the epoch and validated bit untouched.
GenericGraphSlot *slot_b = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, GraphNodeIdIndex(b));
GraphNodeId *entry = VecPtrAt(&slot_b->in_neighbors, 0);
*entry = (GraphNodeId)GraphNodeIdIndex(a);- In
Remove.c:1114:
// Length is now 3; the raw slot at index 4 was part of the vacated tail
// and must read back zero.
bool result = (VecLen(&vec) == 3) && (*VecPtrAt(&vec, 4) == 0);
VecDeinit(&vec);- In
Remove.c:1135:
VecDeleteRangeFast(&vec, 0, 2);
bool result = (VecLen(&vec) == 3) && (*VecPtrAt(&vec, 4) == 0);
VecDeinit(&vec);- In
Remove.c:1329:
// Dead slot 9 (previously a duplicate of 9) must be zeroed.
bool result = (VecLen(&vec) == 8 && *VecPtrAt(&vec, 9) == 0);
VecDeinit(&vec);- In
Remove.c:1348:
// Dead slot 9 must be zeroed, not left as a stale duplicate.
bool result = (VecLen(&vec) == 8 && *VecPtrAt(&vec, 9) == 0);
VecDeinit(&vec);- In
Access.c:65:
// Test VecPtrAt function
bool test_vec_ptr_at(void) {
WriteFmt("Testing VecPtrAt\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Access.c:79:
// Get pointers to elements
int *ptr0 = VecPtrAt(&vec, 0);
int *ptr1 = VecPtrAt(&vec, 1);
int *ptr2 = VecPtrAt(&vec, 2);- In
Access.c:80:
// Get pointers to elements
int *ptr0 = VecPtrAt(&vec, 0);
int *ptr1 = VecPtrAt(&vec, 1);
int *ptr2 = VecPtrAt(&vec, 2);- In
Access.c:81:
int *ptr0 = VecPtrAt(&vec, 0);
int *ptr1 = VecPtrAt(&vec, 1);
int *ptr2 = VecPtrAt(&vec, 2);
// Check values through pointers
WriteFmt("Testing BitVecPrefixMatch(NULL, patterns, 1) - should fatal\n");
BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
BitVecPush(VecPtrAt(&vp, 0), true);
BitVecPrefixMatch(NULL, &vp);
VecDeinit(&vp); WriteFmt("Testing BitVecSuffixMatch(NULL, patterns, 1) - should fatal\n");
BitVecs vp = VecInitWithDeepCopy(NULL, BitVecDeinit, ALLOCATOR_OF(&alloc));
BitVecPush(VecPtrAt(&vp, 0), true);
BitVecSuffixMatch(NULL, &vp);
VecDeinit(&vp); result = result && VecLen(&runs) == 5;
if (result) {
result = result && VecPtrAt(&runs, 0)->length == 3 && VecPtrAt(&runs, 0)->value == true;
result = result && VecPtrAt(&runs, 1)->length == 2 && VecPtrAt(&runs, 1)->value == false;
result = result && VecPtrAt(&runs, 2)->length == 1 && VecPtrAt(&runs, 2)->value == true; if (result) {
result = result && VecPtrAt(&runs, 0)->length == 3 && VecPtrAt(&runs, 0)->value == true;
result = result && VecPtrAt(&runs, 1)->length == 2 && VecPtrAt(&runs, 1)->value == false;
result = result && VecPtrAt(&runs, 2)->length == 1 && VecPtrAt(&runs, 2)->value == true;
result = result && VecPtrAt(&runs, 3)->length == 1 && VecPtrAt(&runs, 3)->value == false; result = result && VecPtrAt(&runs, 0)->length == 3 && VecPtrAt(&runs, 0)->value == true;
result = result && VecPtrAt(&runs, 1)->length == 2 && VecPtrAt(&runs, 1)->value == false;
result = result && VecPtrAt(&runs, 2)->length == 1 && VecPtrAt(&runs, 2)->value == true;
result = result && VecPtrAt(&runs, 3)->length == 1 && VecPtrAt(&runs, 3)->value == false;
result = result && VecPtrAt(&runs, 4)->length == 1 && VecPtrAt(&runs, 4)->value == true; result = result && VecPtrAt(&runs, 1)->length == 2 && VecPtrAt(&runs, 1)->value == false;
result = result && VecPtrAt(&runs, 2)->length == 1 && VecPtrAt(&runs, 2)->value == true;
result = result && VecPtrAt(&runs, 3)->length == 1 && VecPtrAt(&runs, 3)->value == false;
result = result && VecPtrAt(&runs, 4)->length == 1 && VecPtrAt(&runs, 4)->value == true;
} result = result && VecPtrAt(&runs, 2)->length == 1 && VecPtrAt(&runs, 2)->value == true;
result = result && VecPtrAt(&runs, 3)->length == 1 && VecPtrAt(&runs, 3)->value == false;
result = result && VecPtrAt(&runs, 4)->length == 1 && VecPtrAt(&runs, 4)->value == true;
} BitVecPush(&source, true);
BitVec *p0 = VecPtrAt(&patterns, 0);
BitVec *p1 = VecPtrAt(&patterns, 1);
BitVec *p2 = VecPtrAt(&patterns, 2);
BitVec *p0 = VecPtrAt(&patterns, 0);
BitVec *p1 = VecPtrAt(&patterns, 1);
BitVec *p2 = VecPtrAt(&patterns, 2); BitVec *p0 = VecPtrAt(&patterns, 0);
BitVec *p1 = VecPtrAt(&patterns, 1);
BitVec *p2 = VecPtrAt(&patterns, 2);
*p0 = BitVecInit(ALLOCATOR_OF(&alloc)); BitVecPush(&source, true);
BitVec *p0 = VecPtrAt(&patterns, 0);
BitVec *p1 = VecPtrAt(&patterns, 1);
BitVec *p2 = VecPtrAt(&patterns, 2);
BitVec *p0 = VecPtrAt(&patterns, 0);
BitVec *p1 = VecPtrAt(&patterns, 1);
BitVec *p2 = VecPtrAt(&patterns, 2); BitVec *p0 = VecPtrAt(&patterns, 0);
BitVec *p1 = VecPtrAt(&patterns, 1);
BitVec *p2 = VecPtrAt(&patterns, 2);
*p0 = BitVecInit(ALLOCATOR_OF(&alloc));- In
Ops.c:213:
bool result = (VecLen(&split) == 3);
if (VecLen(&split) >= 3) {
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 0)), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 1)), "World") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 2)), "Test") == 0);- In
Ops.c:214:
if (VecLen(&split) >= 3) {
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 0)), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 1)), "World") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 2)), "Test") == 0);
}- In
Ops.c:215:
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 0)), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 1)), "World") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 2)), "Test") == 0);
}- In
Ops.c:228:
// (the base-pointer of an Iter range is the Iter contract --
// direct read is the documented usage for view types).
StrIter *iter1 = VecPtrAt(&iters, 0);
char buffer1[10] = {0};
MemCopy(buffer1, iter1->data, StrIterLength(iter1));- In
Ops.c:233:
result = result && (ZstrCompare(buffer1, "Hello") == 0);
StrIter *iter2 = VecPtrAt(&iters, 1);
char buffer2[10] = {0};
MemCopy(buffer2, iter2->data, StrIterLength(iter2));- In
Ops.c:238:
result = result && (ZstrCompare(buffer2, "World") == 0);
StrIter *iter3 = VecPtrAt(&iters, 2);
char buffer3[10] = {0};
MemCopy(buffer3, iter3->data, StrIterLength(iter3));- In
Ops.c:490:
bool result = (VecLen(&iters) == 3);
if (VecLen(&iters) == 3) {
result = result && (StrIterLength(VecPtrAt(&iters, 0)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 1)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 2)) == 0);- In
Ops.c:491:
if (VecLen(&iters) == 3) {
result = result && (StrIterLength(VecPtrAt(&iters, 0)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 1)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 2)) == 0);
}- In
Ops.c:492:
result = result && (StrIterLength(VecPtrAt(&iters, 0)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 1)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 2)) == 0);
}- In
Ops.c:932:
Str s = StrInitFromZstr("a,b,c", &alloc);
Strs strs = StrSplit(&s, ",");
GENERIC_VEC(VecPtrAt(&strs, 0))->__magic ^= 0x1;
ValidateStrs(&strs);- In
Ops.c:935:
ValidateStrs(&strs);
GENERIC_VEC(VecPtrAt(&strs, 0))->__magic ^= 0x1;
VecDeinit(&strs);
StrDeinit(&s);- In
SysDns.c:134:
return false;
}
Str s = SocketAddrFormat(VecPtrAt(&r->nameservers, i), a);
bool ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), expect) == 0;
StrDeinit(&s);- In
SysDns.c:220:
bool got = DnsResolve(&r, "203.0.113.7:9999", SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && VecPtrAt(&out, 0)->family == SOCKET_FAMILY_INET;
if (ok) {
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);- In
SysDns.c:222:
bool ok = got && VecLen(&out) == 1 && VecPtrAt(&out, 0)->family == SOCKET_FAMILY_INET;
if (ok) {
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "203.0.113.7:9999") == 0;
StrDeinit(&s);- In
SysDns.c:244:
bool got = DnsResolve(&r, "[::1]:443", SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && VecPtrAt(&out, 0)->family == SOCKET_FAMILY_INET6;
if (ok) {
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);- In
SysDns.c:246:
bool ok = got && VecLen(&out) == 1 && VecPtrAt(&out, 0)->family == SOCKET_FAMILY_INET6;
if (ok) {
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "[::1]:443") == 0;
StrDeinit(&s);- In
SysDns.c:796:
DnsResolverAddResolvPath(&r, &path);
bool ok = VecLen(&r.nameservers) == 1 && VecPtrAt(&r.nameservers, 0)->family == SOCKET_FAMILY_INET6 &&
ns_fmt_is(&r, 0, a, "[::1]:53");- In
SysDns.c:1027:
bool got = dns_resolve_5_zstr(&r, "A@Z", 80, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "10.0.0.1:80");
VecDeinit(&out);- In
SysDns.c:1047:
bool got = dns_resolve_5_zstr(&r, "HOST...", 80, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "10.0.0.2:80");
VecDeinit(&out);- In
SysDns.c:1067:
bool got = dns_resolve_5_zstr(&r, "A.B.C.", 80, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "10.0.0.3:80");
VecDeinit(&out);- In
SysDns.c:1117:
bool ok = got && VecLen(&out) == 1;
if (ok) {
const SocketAddr *ad = VecPtrAt(&out, 0);
ok = ad->family == SOCKET_FAMILY_INET && ad->length == 16u;
// Network byte order: port bytes are 0x12 then 0x34 at raw[2..4].
- In
SysDns.c:1152:
bool ok = got && VecLen(&out) == 1;
if (ok) {
const SocketAddr *ad = VecPtrAt(&out, 0);
ok = ad->family == SOCKET_FAMILY_INET6 && ad->length == 28u;
// sin6_port at raw[2..4], network order.
- In
SysDns.c:1499:
bool got = dns_resolve_5_zstr(&r, "single", 80, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "1.2.3.4:80");
VecDeinit(&out);- In
SysDns.c:1517:
bool got = dns_resolve_5_zstr(&r, "multi", 1234, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:1234") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:1234");- In
SysDns.c:1518:
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:1234") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:1234");
VecDeinit(&out);- In
SysDns.c:1536:
bool got = dns_resolve_5_zstr(&r, "both", 443, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "1.1.1.1:443") &&
v6_is(VecPtrAt(&out, 1), a, "[2606::1]:443");- In
SysDns.c:1537:
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "1.1.1.1:443") &&
v6_is(VecPtrAt(&out, 1), a, "[2606::1]:443");
VecDeinit(&out);- In
SysDns.c:1555:
bool got = dns_resolve_5_zstr(&r, "v6name", 53, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v6_is(VecPtrAt(&out, 0), a, "[::1]:53");
VecDeinit(&out);- In
SysDns.c:1573:
bool got = dns_resolve_5_zstr(&r, "SINGLE.", 80, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "1.2.3.4:80");
VecDeinit(&out);- In
SysDns.c:1669:
bool got = dns_resolve_5_zstr(&r, name, 80, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "1.2.3.4:80");
VecDeinit(&out);- In
SysDns.c:1707:
bool got = dns_resolve_5_str(&r, &name, 7000, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:7000") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:7000");- In
SysDns.c:1708:
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:7000") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:7000");
StrDeinit(&name);- In
SysDns.c:1727:
bool got = dns_resolve_4_vec_zstr(&r, "single:80", SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "1.2.3.4:80");
VecDeinit(&out);- In
SysDns.c:1745:
bool got = dns_resolve_4_vec_zstr(&r, "multi:9090", SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:9090") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:9090");- In
SysDns.c:1746:
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:9090") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:9090");
VecDeinit(&out);- In
SysDns.c:1764:
bool got = dns_resolve_4_vec_zstr(&r, "203.0.113.7:9999", SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "203.0.113.7:9999");
VecDeinit(&out);- In
SysDns.c:1836:
bool got = dns_resolve_4_vec_zstr(&r, "single:65535", SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 1 && v4_is(VecPtrAt(&out, 0), a, "1.2.3.4:65535");
VecDeinit(&out);- In
SysDns.c:1900:
bool got = dns_resolve_4_vec_str(&r, &spec, SOCKET_KIND_TCP, &out);
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:8080") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:8080");- In
SysDns.c:1901:
bool ok = got && VecLen(&out) == 2 && v4_is(VecPtrAt(&out, 0), a, "5.6.7.8:8080") &&
v4_is(VecPtrAt(&out, 1), a, "9.10.11.12:8080");
StrDeinit(&spec); if (ProcMapsLoad(&maps, ALLOCATOR_OF(&a))) {
for (u64 i = 0; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *m = VecPtrAt(&maps.entries, i);
if (m->path && m->path[0] == '/' && (m->perms & PROC_MAP_PERM_EXEC) &&
ZstrCompare(m->path, self_path) != 0) {- In
Bias.c:36:
if (ProcMapsLoad(&maps, ALLOCATOR_OF(&a))) {
for (u64 i = 0; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *m = VecPtrAt(&maps.entries, i);
if (m->path && ZstrCompare(m->path, path) == 0 && (m->perms & PROC_MAP_PERM_WRITE) && addr >= m->start &&
addr < m->end) {- In
Pe.c:495:
ok = pe.machine == PE_MACHINE_X86_64 && pe.is_pe32_plus && pe.image_base == 0x140000000ull;
ok = ok && VecLen(&pe.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".debug") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == SECTION_VA;
ok = ok && pe.codeview.present;- In
Pe.c:496:
ok = ok && VecLen(&pe.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".debug") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == SECTION_VA;
ok = ok && pe.codeview.present;
ok = ok && pe.codeview.age == 0x2a;- In
Pe.c:1280:
bool ok = VecLen(&pe.sections) == 2;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 1)->name, ".rdata") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == 0x1000;- In
Pe.c:1281:
bool ok = VecLen(&pe.sections) == 2;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 1)->name, ".rdata") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == 0x1000;
ok = ok && VecPtrAt(&pe.sections, 1)->virtual_address == 0x2000;- In
Pe.c:1282:
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 1)->name, ".rdata") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == 0x1000;
ok = ok && VecPtrAt(&pe.sections, 1)->virtual_address == 0x2000;- In
Pe.c:1283:
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 1)->name, ".rdata") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == 0x1000;
ok = ok && VecPtrAt(&pe.sections, 1)->virtual_address == 0x2000;
PeDeinit(&pe);- In
Pe.c:1340:
return false;
}
const PeSection *s = VecPtrAt(&pe.sections, 0);
bool ok = VecLen(&pe.sections) == 1;
ok = ok && ZstrLen(s->name) == 8;- In
Pe.c:1669:
if (ok) {
ok = pe.machine == PE_MACHINE_X86_64 && VecLen(&pe.sections) == 1 &&
ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".text") == 0;
PeDeinit(&pe);
}- In
Dns.c:161:
if (match) {
DnsRecord *r0 = VecPtrAt(&resp.answers, 0);
match = r0->type == DNS_TYPE_A && r0->ttl == 300 && r0->ipv4[0] == 93 && r0->ipv4[1] == 184 &&
r0->ipv4[2] == 216 && r0->ipv4[3] == 34 && ZstrCompare(StrBegin(&r0->name), "example.com") == 0;- In
Dns.c:166:
}
if (match) {
DnsRecord *r1 = VecPtrAt(&resp.answers, 1);
match = r1->type == DNS_TYPE_AAAA && r1->ipv6[0] == 0x26 && r1->ipv6[1] == 0x06 && r1->ipv6[14] == 0x19 &&
r1->ipv6[15] == 0x46;- In
Dns.c:295:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_CNAME && ZstrCompare(StrBegin(&r->target), "example.com") == 0;
}- In
Dns.c:566:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && r->ttl == 300 && r->ipv4[0] == 0x0a && r->ipv4[1] == 0x0b &&
r->ipv4[2] == 0x0c && r->ipv4[3] == 0x0d && ZstrCompare(StrBegin(&r->name), "www.example.com") == 0;- In
Dns.c:741:
bool match = ok && q2_off == 256 && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && ZstrCompare(StrBegin(&r->name), "zz") == 0;
}- In
Dns.c:808:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match =
r->type == DNS_TYPE_A && r->ttl == 2 && ZstrCompare(StrBegin(&r->name), "abc.de") == 0 && r->ipv4[0] == 9;- In
Dns.c:1082:
bool match = ok && VecLen(&resp.answers) == 2;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && r->rclass == 1 && r->ttl == 0x01020304u && r->ipv4[0] == 8 &&
r->ipv4[1] == 8 && r->ipv4[2] == 4 && r->ipv4[3] == 4 && r->ipv6[0] == 0 &&- In
Dns.c:1110:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->rclass == 0x00FE;
}- In
Dns.c:1135:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->ttl == 0x80112233u;
}- In
Dns.c:1221:
bool match = ok && VecLen(&resp.answers) == 2;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_AAAA && r->ttl == 10 && VecLen(&r->target) == 0;
static const u8 ip6[] =- In
Dns.c:1306:
bool match = ok && VecLen(&resp.answers) == 2;
if (match) {
DnsRecord *r0 = VecPtrAt(&resp.answers, 0);
DnsRecord *r1 = VecPtrAt(&resp.answers, 1);
match = ZstrCompare(StrBegin(&r0->name), "x") == 0 && r0->ttl == 1 && r0->ipv4[0] == 1 && r0->ipv4[3] == 4 &&- In
Dns.c:1307:
if (match) {
DnsRecord *r0 = VecPtrAt(&resp.answers, 0);
DnsRecord *r1 = VecPtrAt(&resp.answers, 1);
match = ZstrCompare(StrBegin(&r0->name), "x") == 0 && r0->ttl == 1 && r0->ipv4[0] == 1 && r0->ipv4[3] == 4 &&
ZstrCompare(StrBegin(&r1->name), "y") == 0 && r1->ttl == 2 && r1->ipv4[0] == 5 && r1->ipv4[3] == 8;- In
Dns.c:1402:
bool match = ok && VecLen(&resp.answers) == 1 && VecLen(&resp.authority) == 1 && VecLen(&resp.additional) == 1;
if (match) {
DnsRecord *an = VecPtrAt(&resp.answers, 0);
DnsRecord *ns = VecPtrAt(&resp.authority, 0);
DnsRecord *ar = VecPtrAt(&resp.additional, 0);- In
Dns.c:1403:
if (match) {
DnsRecord *an = VecPtrAt(&resp.answers, 0);
DnsRecord *ns = VecPtrAt(&resp.authority, 0);
DnsRecord *ar = VecPtrAt(&resp.additional, 0);
match = ZstrCompare(StrBegin(&an->name), "an") == 0 && an->ipv4[0] == 11 &&- In
Dns.c:1404:
DnsRecord *an = VecPtrAt(&resp.answers, 0);
DnsRecord *ns = VecPtrAt(&resp.authority, 0);
DnsRecord *ar = VecPtrAt(&resp.additional, 0);
match = ZstrCompare(StrBegin(&an->name), "an") == 0 && an->ipv4[0] == 11 &&
ZstrCompare(StrBegin(&ns->name), "ns") == 0 && ns->ipv4[0] == 22 &&- In
Dns.c:1469:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = ZstrCompare(StrBegin(&r->name), "q") == 0 && r->ipv4[0] == 9 && r->ttl == 5;
}- In
Dns.c:1521:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_CNAME && ZstrCompare(StrBegin(&r->target), "to") == 0;
}- In
Dns.c:1828:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && r->ipv4[0] == 1 && r->ipv4[3] == 4;
}- In
Dns.c:2048:
bool match = ok && VecLen(&resp.answers) == 1;
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && r->ttl == 7 && ZstrCompare(StrBegin(&r->name), "zz") == 0;
}- In
Dns.c:2084:
bool ok = DnsParseResponse(&resp, wire, sizeof(wire), adbg);
ok = ok && (VecLen(&resp.answers) == 1);
DnsRecord *r = ok ? VecPtrAt(&resp.answers, 0) : NULL;
ok = ok && (r->type == DNS_TYPE_CNAME);
// Heap-backed target ("example.com") -- the Str the dropped StrDeinit leaks.
- In
Pdb.c:298:
ok = VecLen(&pdb.functions) == 1;
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = ok && f->rva == 0x1100 && f->name && ZstrCompare(f->name, "my_function") == 0;
}- In
Pdb.c:446:
// Functions are stored sorted by RVA regardless of input order.
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);- In
Pdb.c:447:
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_alpha") == 0;- In
Pdb.c:448:
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_alpha") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_beta") == 0;- In
Pdb.c:682:
int n = (int)VecLen(&pdb.functions);
if (n >= 1 && out_rva0)
*out_rva0 = ((const PdbFunction *)VecPtrAt(&pdb.functions, 0))->rva;
PdbDeinit(&pdb);
return n;- In
Pdb.c:1684:
ok = VecLen(&pdb.functions) == 4;
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);- In
Pdb.c:1685:
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
const PdbFunction *f3 = VecPtrAt(&pdb.functions, 3);- In
Pdb.c:1686:
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
const PdbFunction *f3 = VecPtrAt(&pdb.functions, 3);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_one") == 0;- In
Pdb.c:1687:
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
const PdbFunction *f3 = VecPtrAt(&pdb.functions, 3);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_one") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_two") == 0;- In
Pdb.c:1697:
if (ok) {
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "data_sym") == 0) {
ok = false;- In
Pdb.c:1745:
if (ok) {
// sorted: 0x1040 (text) then 0x8010 (rdata)
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1040 && ZstrCompare(f0->name, "in_text") == 0;- In
Pdb.c:1746:
// sorted: 0x1040 (text) then 0x8010 (rdata)
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1040 && ZstrCompare(f0->name, "in_text") == 0;
ok = ok && f1->rva == 0x8010 && ZstrCompare(f1->name, "in_rdata") == 0;- In
Pdb.c:1802:
ok = VecLen(&pdb.functions) == 2;
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "valid_fn") == 0;- In
Pdb.c:1803:
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "valid_fn") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "valid_fn2") == 0;- In
Pdb.c:1809:
if (ok) {
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "bad_seg_fn") == 0) {
ok = false;- In
Pdb.c:1857:
ok = VecLen(&pdb.functions) == 3;
if (ok) {
const PdbFunction *a = VecPtrAt(&pdb.functions, 0);
const PdbFunction *b = VecPtrAt(&pdb.functions, 1);
const PdbFunction *c = VecPtrAt(&pdb.functions, 2);- In
Pdb.c:1858:
if (ok) {
const PdbFunction *a = VecPtrAt(&pdb.functions, 0);
const PdbFunction *b = VecPtrAt(&pdb.functions, 1);
const PdbFunction *c = VecPtrAt(&pdb.functions, 2);
ok = ok && a->rva == 0x1100 && a->size == 0x200; // 0x1300 - 0x1100
- In
Pdb.c:1859:
const PdbFunction *a = VecPtrAt(&pdb.functions, 0);
const PdbFunction *b = VecPtrAt(&pdb.functions, 1);
const PdbFunction *c = VecPtrAt(&pdb.functions, 2);
ok = ok && a->rva == 0x1100 && a->size == 0x200; // 0x1300 - 0x1100
ok = ok && b->rva == 0x1300 && b->size == 0x80; // 0x1380 - 0x1300
- In
Pdb.c:1928:
u32 prev = 0;
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (i > 0 && !(f->rva > prev)) {
ok = false;- In
Pdb.c:1939:
// would flip these.
if (ok) {
const PdbFunction *first = VecPtrAt(&pdb.functions, 0);
const PdbFunction *last = VecPtrAt(&pdb.functions, 4);
ok = ok && first->rva == 0x1100 && ZstrCompare(first->name, "a") == 0;- In
Pdb.c:1940:
if (ok) {
const PdbFunction *first = VecPtrAt(&pdb.functions, 0);
const PdbFunction *last = VecPtrAt(&pdb.functions, 4);
ok = ok && first->rva == 0x1100 && ZstrCompare(first->name, "a") == 0;
ok = ok && last->rva == 0x1500 && ZstrCompare(last->name, "e") == 0;- In
Pdb.c:1987:
ok = VecLen(&pdb.functions) == 2;
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_keep") == 0;- In
Pdb.c:1988:
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_keep") == 0;
ok = ok && f1->rva == 0x1300 && ZstrCompare(f1->name, "fn_keep2") == 0;- In
Pdb.c:1995:
if (ok) {
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "AAAAAAAA") == 0) {
ok = false;- In
Pdb.c:2044:
ok = VecLen(&pdb.functions) == 2;
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x2050u && ZstrCompare(f0->name, "fn_low") == 0;- In
Pdb.c:2045:
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x2050u && ZstrCompare(f0->name, "fn_low") == 0;
ok = ok && f1->rva == 0xFFFFFFFFu && ZstrCompare(f1->name, "fn_max") == 0;- In
Pdb.c:2051:
if (ok) {
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "fn_ovf") == 0) {
ok = false;- In
Pdb.c:2238:
ok = VecLen(&pdb.functions) == 2;
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0); // rva 0x2000
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1); // rva 0x3000
ok = ok && f0->rva == 0x2000 && ZstrCompare(f0->name, "second_block_function") == 0;- In
Pdb.c:2239:
if (ok) {
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0); // rva 0x2000
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1); // rva 0x3000
ok = ok && f0->rva == 0x2000 && ZstrCompare(f0->name, "second_block_function") == 0;
ok = ok && f1->rva == 0x3000 && ZstrCompare(f1->name, "straddling_boundary_function") == 0;- In
Pdb.c:2691:
ok = VecLen(&pdb.functions) == 1;
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x6010 && ZstrCompare(f->name, "sixth") == 0;
}- In
Pdb.c:2756:
ok = VecLen(&pdb.functions) == 1;
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1040 && ZstrCompare(f->name, "good") == 0;
}- In
Pdb.c:2788:
ok = VecLen(&pdb.functions) == 3;
if (ok) {
const PdbFunction *a = VecPtrAt(&pdb.functions, 0); // alpha 0x1100
const PdbFunction *b = VecPtrAt(&pdb.functions, 1); // beta 0x1200
const PdbFunction *c = VecPtrAt(&pdb.functions, 2); // gamma 0x1300
- In
Pdb.c:2789:
if (ok) {
const PdbFunction *a = VecPtrAt(&pdb.functions, 0); // alpha 0x1100
const PdbFunction *b = VecPtrAt(&pdb.functions, 1); // beta 0x1200
const PdbFunction *c = VecPtrAt(&pdb.functions, 2); // gamma 0x1300
ok = ok && a->rva == 0x1100 && a->size == 0x100;- In
Pdb.c:2790:
const PdbFunction *a = VecPtrAt(&pdb.functions, 0); // alpha 0x1100
const PdbFunction *b = VecPtrAt(&pdb.functions, 1); // beta 0x1200
const PdbFunction *c = VecPtrAt(&pdb.functions, 2); // gamma 0x1300
ok = ok && a->rva == 0x1100 && a->size == 0x100;
ok = ok && b->rva == 0x1200 && b->size == 0x100;- In
Pdb.c:2819:
ok = VecLen(&pdb.functions) == 1;
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1010 && ZstrCompare(f->name, "named_fn") == 0;
}- In
Pdb.c:3039:
bool ok = VecLen(&pdb.functions) == 1;
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1100 && ZstrCompare(f->name, "deepblk") == 0;
}- In
Pdb.c:3079:
bool ok = opened && VecLen(&pdb.functions) == 1 && pdb.num_streams == N;
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1100 && ZstrCompare(f->name, "deepfn") == 0;
}- In
Pdb.c:3120:
bool ok = opened && VecLen(&pdb.functions) == 1;
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1100 && ZstrCompare(f->name, "fn") == 0;
}- In
ProcMaps.c:42:
bool any_exec = false;
for (u64 i = 0; i < VecLen(&maps.entries); ++i) {
if (VecPtrAt(&maps.entries, i)->perms & PROC_MAP_PERM_EXEC) {
any_exec = true;
break;- In
ProcMaps.c:176:
const ProcMapEntry *region = NULL;
for (u64 i = 0; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *cand = VecPtrAt(&maps.entries, i);
if (cand->end > cand->start) {
region = cand;- In
ProcMaps.c:213:
if (ok) {
// The entry with the highest `end` -- `end` itself maps to nothing.
const ProcMapEntry *top = VecPtrAt(&maps.entries, 0);
for (u64 i = 1; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *cand = VecPtrAt(&maps.entries, i);- In
ProcMaps.c:215:
const ProcMapEntry *top = VecPtrAt(&maps.entries, 0);
for (u64 i = 1; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *cand = VecPtrAt(&maps.entries, i);
if (cand->end > top->end)
top = cand;- In
ProcMaps.c:281:
bool found_gap = false;
for (u64 i = 0; i < VecLen(&maps.entries) && !found_gap; ++i) {
u64 hole = VecPtrAt(&maps.entries, i)->end;
// Is `hole` inside any region?
bool inside = false;- In
ProcMaps.c:285:
bool inside = false;
for (u64 j = 0; j < VecLen(&maps.entries); ++j) {
const ProcMapEntry *e = VecPtrAt(&maps.entries, j);
if (hole >= e->start && hole < e->end) {
inside = true;- In
ProcMaps.c:400:
bool ok = VecLen(&maps.entries) > 0;
if (ok) {
u64 lowest = VecPtrAt(&maps.entries, 0)->start;
for (u64 i = 1; i < VecLen(&maps.entries); ++i) {
u64 start = VecPtrAt(&maps.entries, i)->start;- In
ProcMaps.c:402:
u64 lowest = VecPtrAt(&maps.entries, 0)->start;
for (u64 i = 1; i < VecLen(&maps.entries); ++i) {
u64 start = VecPtrAt(&maps.entries, i)->start;
if (start < lowest)
lowest = start;- In
ProcMaps.c:437:
bool ok = VecLen(&m.entries) == 1;
if (ok) {
const ProcMapEntry *e = VecPtrAt(&m.entries, 0);
ok = e->start == 0x1000ULL && e->end == 0x2000ULL && e->file_offset == 0xdeadULL &&
e->perms == (u32)(PROC_MAP_PERM_READ | PROC_MAP_PERM_EXEC | PROC_MAP_PERM_PRIVATE) &&- In
ProcMaps.c:462:
bool ok = VecLen(&m.entries) == 1;
if (ok) {
const ProcMapEntry *e = VecPtrAt(&m.entries, 0);
ok = e->start == 0xABCDEFULL && e->end == 0xFEDCBAULL && e->file_offset == 0xCA00ULL;
}- In
ProcMaps.c:484:
bool ok = VecLen(&m.entries) == 1;
if (ok) {
const ProcMapEntry *e = VecPtrAt(&m.entries, 0);
ok = e->start == 0x9ULL && e->end == 0x1990ULL;
}- In
ProcMaps.c:527:
bool ok = VecLen(&m.entries) == 2;
if (ok) {
const ProcMapEntry *e0 = VecPtrAt(&m.entries, 0);
const ProcMapEntry *e1 = VecPtrAt(&m.entries, 1);
ok = e0->start == 0x5000ULL && e1->start == 0x1000ULL && m.min_addr == 0x1000ULL;- In
ProcMaps.c:528:
if (ok) {
const ProcMapEntry *e0 = VecPtrAt(&m.entries, 0);
const ProcMapEntry *e1 = VecPtrAt(&m.entries, 1);
ok = e0->start == 0x5000ULL && e1->start == 0x1000ULL && m.min_addr == 0x1000ULL;
}- In
ProcMaps.c:552:
bool ok = VecLen(&m.entries) == 1;
if (ok) {
const ProcMapEntry *e = VecPtrAt(&m.entries, 0);
ok = e->start == 0x3000ULL && e->end == 0x4000ULL && ZstrCompare(e->path, "/good") == 0;
}- In
MachO.c:361:
ok = ok && m.has_uuid && MemCompare(m.uuid, kUuid, 16) == 0;
ok = ok && VecLen(&m.segments) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "__TEXT") == 0;
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "__text") == 0;- In
MachO.c:363:
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "__TEXT") == 0;
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "__text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "__TEXT") == 0;
ok = ok && VecLen(&m.symbols) == 1;- In
MachO.c:364:
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "__text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "__TEXT") == 0;
ok = ok && VecLen(&m.symbols) == 1;
ok = ok && VecPtrAt(&m.symbols, 0)->name && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "my_function") == 0;- In
MachO.c:366:
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "__TEXT") == 0;
ok = ok && VecLen(&m.symbols) == 1;
ok = ok && VecPtrAt(&m.symbols, 0)->name && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "my_function") == 0;
ok = ok && VecPtrAt(&m.symbols, 0)->value == 0x100000010ull;- In
MachO.c:367:
ok = ok && VecLen(&m.symbols) == 1;
ok = ok && VecPtrAt(&m.symbols, 0)->name && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "my_function") == 0;
ok = ok && VecPtrAt(&m.symbols, 0)->value == 0x100000010ull;
MachoDeinit(&m);- In
MachO.c:658:
ok = ok && VecLen(&m.symbols) == 1;
if (VecLen(&m.symbols) == 1)
ok = ok && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "fn_a") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:715:
ok = ok && VecLen(&m.symbols) == 2;
if (VecLen(&m.symbols) == 2) {
const MachoSymbol *s0 = VecPtrAt(&m.symbols, 0);
const MachoSymbol *s1 = VecPtrAt(&m.symbols, 1);
ok = ok && ZstrCompare(s0->name, "alpha") == 0 && s0->value == 0x100000010ull && s0->type == 0x0F &&- In
MachO.c:716:
if (VecLen(&m.symbols) == 2) {
const MachoSymbol *s0 = VecPtrAt(&m.symbols, 0);
const MachoSymbol *s1 = VecPtrAt(&m.symbols, 1);
ok = ok && ZstrCompare(s0->name, "alpha") == 0 && s0->value == 0x100000010ull && s0->type == 0x0F &&
s0->section_index == 1;- In
MachO.c:745:
Macho m;
bool ok = open_blob(&m, b, BUF, &alloc);
ok = ok && VecLen(&m.symbols) == 1 && VecPtrAt(&m.symbols, 0)->section_index == 5;
if (ok)
MachoDeinit(&m);- In
MachO.c:775:
Macho m;
bool ok = open_blob(&m, b, BUF, &alloc); // real: accepts
ok = ok && VecLen(&m.symbols) == 1 && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "fit") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:802:
Macho m;
bool ok = open_blob(&m, b, BUF, &alloc);
ok = ok && VecLen(&m.symbols) == 1 && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "edge") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:1165:
bool ok = MachoOpenFromMemoryCopy(&m, buf, sizeof(buf), base);
ok = ok && VecLen(&m.segments) == 1 && VecLen(&m.sections) == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "__TEXT") == 0;
ok = ok && VecPtrAt(&m.segments, 0)->vmaddr == 0x1000;
if (ok)- In
MachO.c:1166:
ok = ok && VecLen(&m.segments) == 1 && VecLen(&m.sections) == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "__TEXT") == 0;
ok = ok && VecPtrAt(&m.segments, 0)->vmaddr == 0x1000;
if (ok)
MachoDeinit(&m);- In
MachO.c:1197:
bool ok = MachoOpenFromMemoryCopy(&m, buf, sizeof(buf), base);
ok = ok && VecLen(&m.segments) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "ABCDEFGHIJKLMNOP") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:1218:
bool ok = MachoOpenFromMemoryCopy(&m, buf, len, base);
ok = ok && VecLen(&m.segments) == 1 && VecLen(&m.sections) == 2;
ok = ok && VecPtrAt(&m.sections, 0)->addr == 0x100000000ull;
ok = ok && VecPtrAt(&m.sections, 1)->addr == 0x100001000ull;
if (ok)- In
MachO.c:1219:
ok = ok && VecLen(&m.segments) == 1 && VecLen(&m.sections) == 2;
ok = ok && VecPtrAt(&m.sections, 0)->addr == 0x100000000ull;
ok = ok && VecPtrAt(&m.sections, 1)->addr == 0x100001000ull;
if (ok)
MachoDeinit(&m);- In
MachO.c:1259:
bool ok = MachoOpenFromMemoryCopy(&m, buf, sizeof(buf), base);
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "abcdefghijklmnop") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "QRSTUVWXYZ012345") == 0;
if (ok)- In
MachO.c:1260:
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "abcdefghijklmnop") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "QRSTUVWXYZ012345") == 0;
if (ok)
MachoDeinit(&m);- In
Elf.c:324:
bool ok = false;
for (u64 i = 0; i < VecLen(&elf.symbols); ++i) {
const ElfSymbol *s = VecPtrAt(&elf.symbols, i);
if (s->type == ELF_SYMBOL_TYPE_FUNC && s->size > 0 && s->name && s->name[0] != '\0') {
ok = true;- In
Elf.c:371:
bool found_func = false;
for (u64 i = 0; i < VecLen(&elf.symbols); ++i) {
const ElfSymbol *s = VecPtrAt(&elf.symbols, i);
if (s->name && ZstrCompare(s->name, "my_func") == 0) {
found_func = s->value == FUNC_VADDR && s->size == FUNC_SIZE && s->type == ELF_SYMBOL_TYPE_FUNC &&- In
Elf.c:398:
ok = VecLen(&elf.segments) == 2;
if (ok) {
const ElfSegment *s0 = VecPtrAt(&elf.segments, 0);
const ElfSegment *s1 = VecPtrAt(&elf.segments, 1);
ok = s0->type == ELF_PT_LOAD && s0->flags == SEG0_FLAGS && s0->offset == SEG0_OFF &&- In
Elf.c:399:
if (ok) {
const ElfSegment *s0 = VecPtrAt(&elf.segments, 0);
const ElfSegment *s1 = VecPtrAt(&elf.segments, 1);
ok = s0->type == ELF_PT_LOAD && s0->flags == SEG0_FLAGS && s0->offset == SEG0_OFF &&
s0->vaddr == SEG0_VADDR && s0->filesz == SEG0_FILESZ && s0->memsz == SEG0_MEMSZ &&- In
Elf.c:755:
// First section is the NULL section (name ""), last is .strtab.
const ElfSection *first = VecPtrAt(&elf.sections, 0);
const ElfSection *last = VecPtrAt(&elf.sections, N_SECTIONS - 1);
ok = ok && first->name && first->name[0] == '\0' && first->type == ELF_SECTION_TYPE_NULL;- In
Elf.c:756:
// First section is the NULL section (name ""), last is .strtab.
const ElfSection *first = VecPtrAt(&elf.sections, 0);
const ElfSection *last = VecPtrAt(&elf.sections, N_SECTIONS - 1);
ok = ok && first->name && first->name[0] == '\0' && first->type == ELF_SECTION_TYPE_NULL;
ok = ok && last->name && ZstrCompare(last->name, ".strtab") == 0 && last->type == ELF_SECTION_TYPE_STRTAB &&- In
Elf.c:995:
// Section 1's name idx points at "AB" with no terminator inside the
// declared strtab size => real decodes "".
const ElfSection *s1 = VecPtrAt(&elf.sections, 1);
bool ok = VecLen(&elf.sections) == 2 && s1->name != NULL && s1->name[0] == '\0';- In
Elf.c:1053:
}
const ElfSection *s1 = VecPtrAt(&elf.sections, 1);
bool ok = VecLen(&elf.sections) == 2 && s1->name != NULL && s1->name[0] == '\0';- In
Elf.c:1112:
}
const ElfSection *s1 = VecPtrAt(&elf.sections, 1);
bool ok = VecLen(&elf.sections) == 2 && s1->name != NULL && ZstrCompare(s1->name, "XYZ") == 0;- In
Elf.c:1162:
// .strtab is the final section in the table.
const ElfSection *last = ElfFindSection(&elf, ".strtab");
const ElfSection *expected = VecPtrAt(&elf.sections, N_SECTIONS - 1);
bool ok = last != NULL && last == expected;- In
Elf.c:1704:
return false;
}
const ElfSymbol *a = VecPtrAt(&elf.symbols, 1);
const ElfSymbol *b = VecPtrAt(&elf.symbols, 3);
const ElfSymbol *l = VecPtrAt(&elf.symbols, 4);- In
Elf.c:1705:
}
const ElfSymbol *a = VecPtrAt(&elf.symbols, 1);
const ElfSymbol *b = VecPtrAt(&elf.symbols, 3);
const ElfSymbol *l = VecPtrAt(&elf.symbols, 4);
bool ok = a->name && ZstrCompare(a->name, "alpha") == 0 && b->name && ZstrCompare(b->name, "beta") == 0 &&- In
Elf.c:1706:
const ElfSymbol *a = VecPtrAt(&elf.symbols, 1);
const ElfSymbol *b = VecPtrAt(&elf.symbols, 3);
const ElfSymbol *l = VecPtrAt(&elf.symbols, 4);
bool ok = a->name && ZstrCompare(a->name, "alpha") == 0 && b->name && ZstrCompare(b->name, "beta") == 0 &&
l->name && ZstrCompare(l->name, "local") == 0;- In
Elf.c:1722:
return false;
}
const ElfSymbol *a = VecPtrAt(&elf.symbols, 1);
bool ok = a->value == SF_ALPHA_VADDR && a->size == SF_ALPHA_SIZE && a->type == ELF_SYMBOL_TYPE_FUNC &&
a->bind == ELF_SYMBOL_BIND_GLOBAL && a->section_index == SF_SEC_TEXT;- In
Elf.c:1742:
bool ok = VecLen(&elf.dynamic_symbols) == 2;
if (ok) {
const ElfSymbol *d = VecPtrAt(&elf.dynamic_symbols, 1);
ok = d->name && ZstrCompare(d->name, "dyn_sym") == 0 && d->value == SF_DYN_VADDR;
}- In
RoundTrip.c:428:
if (strings_match) {
for (size i = 0; i < VecLen(&original_strings); i++) {
if (StrLen(VecPtrAt(&original_strings, i)) != StrLen(VecPtrAt(&parsed_strings, i)) ||
(StrLen(VecPtrAt(&original_strings, i)) &&
StrCmp(VecPtrAt(&original_strings, i), VecPtrAt(&parsed_strings, i)) != 0)) {- In
RoundTrip.c:429:
for (size i = 0; i < VecLen(&original_strings); i++) {
if (StrLen(VecPtrAt(&original_strings, i)) != StrLen(VecPtrAt(&parsed_strings, i)) ||
(StrLen(VecPtrAt(&original_strings, i)) &&
StrCmp(VecPtrAt(&original_strings, i), VecPtrAt(&parsed_strings, i)) != 0)) {
strings_match = false;- In
RoundTrip.c:430:
if (StrLen(VecPtrAt(&original_strings, i)) != StrLen(VecPtrAt(&parsed_strings, i)) ||
(StrLen(VecPtrAt(&original_strings, i)) &&
StrCmp(VecPtrAt(&original_strings, i), VecPtrAt(&parsed_strings, i)) != 0)) {
strings_match = false;
break;
Last updated on