Lines Matching full:stack

271   case DW_OP_pick:        // 0x15 1 1-byte stack index
543 // by a file address on the stack. We assume that DW_OP_const4u or
584 static llvm::Error Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
594 // constant literal, or a spilled stack value) in the parent frame.
634 // 1. Find the function which pushed the current frame onto the stack.
651 // If this is null, we're at the end of the stack.
770 stack.push_back(*maybe_result);
884 std::vector<Value> stack;
899 stack.push_back(*initial_value_ptr);
912 // TODO: Implement a real typed stack, and store the genericness of the value
933 size_t count = stack.size();
934 LLDB_LOGF(log, "Stack before operation has %" PRIu64 " values:",
939 stack[i].Dump(&new_value);
948 if (stack.size() < *arity)
950 "%s needs at least %d stack entries (stack has %d entries)",
951 DW_OP_value_to_name(op), *arity, stack.size());
958 stack.push_back(Scalar(opcodes.GetAddress(&offset)));
963 stack.back().SetValueType(Value::ValueType::LoadAddress);
965 stack.back().SetValueType(Value::ValueType::FileAddress);
990 // stack.push_back(load_addr);
1008 // DESCRIPTION: Pops the top stack entry and treats it as an address.
1013 if (stack.empty())
1015 "expression stack empty for DW_OP_deref");
1016 Value::ValueType value_type = stack.back().GetValueType();
1019 void *src = (void *)stack.back().GetScalar().ULongLong();
1022 stack.back().GetScalar() = ptr;
1023 stack.back().ClearContext();
1026 auto file_addr = stack.back().GetScalar().ULongLong(
1036 stack.back().GetScalar() = *maybe_load_addr;
1042 stack.back().SetValueType(Value::ValueType::LoadAddress);
1048 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
1055 stack.back().GetScalar() = pointer_value;
1056 stack.back().ClearContext();
1082 // stack entry and treats it as an address. The value retrieved from that
1089 // expression stack.
1091 if (stack.empty()) {
1093 "expression stack empty for DW_OP_deref_size");
1100 Value::ValueType value_type = stack.back().GetValueType();
1103 void *src = (void *)stack.back().GetScalar().ULongLong();
1139 stack.back().GetScalar() = ptr;
1140 stack.back().ClearContext();
1144 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
1164 stack.back().GetScalar() = DerefSizeExtractDataHelper(
1166 stack.back().ClearContext();
1175 stack.back().GetScalar() = load_addr;
1185 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
1191 stack.back().GetScalar() =
1194 stack.back().ClearContext();
1222 // the top of the stack is treated as an address. The second stack entry is
1224 // support multiple address spaces. The top two stack elements are popped,
1226 // calculation and pushed as the new stack top. In the DW_OP_xderef_size
1232 // pushed on the expression stack.
1238 // the top of the stack is treated as an address. The second stack entry is
1240 // support multiple address spaces. The top two stack elements are popped,
1242 // calculation and pushed as the new stack top. The size of the data
1262 stack.push_back(to_generic(opcodes.GetU8(&offset)));
1265 stack.push_back(to_generic((int8_t)opcodes.GetU8(&offset)));
1268 stack.push_back(to_generic(opcodes.GetU16(&offset)));
1271 stack.push_back(to_generic((int16_t)opcodes.GetU16(&offset)));
1274 stack.push_back(to_generic(opcodes.GetU32(&offset)));
1277 stack.push_back(to_generic((int32_t)opcodes.GetU32(&offset)));
1280 stack.push_back(to_generic(opcodes.GetU64(&offset)));
1283 stack.push_back(to_generic((int64_t)opcodes.GetU64(&offset)));
1288 stack.push_back(Scalar(opcodes.GetULEB128(&offset)));
1291 stack.push_back(Scalar(opcodes.GetSLEB128(&offset)));
1296 // DESCRIPTION: duplicates the value at the top of the stack
1298 if (stack.empty()) {
1299 return llvm::createStringError("expression stack empty for DW_OP_dup");
1301 stack.push_back(stack.back());
1306 // DESCRIPTION: pops the value at the top of the stack
1308 if (stack.empty()) {
1309 return llvm::createStringError("expression stack empty for DW_OP_drop");
1311 stack.pop_back();
1316 // DESCRIPTION: Duplicates the entry currently second in the stack at
1317 // the top of the stack.
1319 stack.push_back(stack[stack.size() - 2]);
1323 // OPERANDS: uint8_t index into the current stack
1324 // DESCRIPTION: The stack entry with the specified index (0 through 255,
1325 // inclusive) is pushed on the stack
1328 if (pick_idx < stack.size())
1329 stack.push_back(stack[stack.size() - 1 - pick_idx]);
1338 // DESCRIPTION: swaps the top two stack entries. The entry at the top
1339 // of the stack becomes the second stack entry, and the second entry
1340 // becomes the top of the stack
1342 tmp = stack.back();
1343 stack.back() = stack[stack.size() - 2];
1344 stack[stack.size() - 2] = tmp;
1349 // DESCRIPTION: Rotates the first three stack entries. The entry at
1350 // the top of the stack becomes the third stack entry, the second entry
1351 // becomes the top of the stack, and the third entry becomes the second
1354 size_t last_idx = stack.size() - 1;
1355 Value old_top = stack[last_idx];
1356 stack[last_idx] = stack[last_idx - 1];
1357 stack[last_idx - 1] = stack[last_idx - 2];
1358 stack[last_idx - 2] = old_top;
1363 // DESCRIPTION: pops the top stack entry, interprets it as a signed
1367 if (!stack.back().ResolveValue(exe_ctx).AbsoluteValue()) {
1369 "failed to take the absolute value of the first stack item");
1375 // DESCRIPTION: pops the top two stack values, performs a bitwise and
1378 tmp = stack.back();
1379 stack.pop_back();
1380 stack.back().ResolveValue(exe_ctx) =
1381 stack.back().ResolveValue(exe_ctx) & tmp.ResolveValue(exe_ctx);
1386 // DESCRIPTION: pops the top two stack values, divides the former second
1387 // entry by the former top of the stack using signed division, and pushes
1390 tmp = stack.back();
1394 stack.pop_back();
1397 dividend = stack.back().ResolveValue(exe_ctx);
1400 stack.back() = dividend / divisor;
1402 if (!stack.back().ResolveValue(exe_ctx).IsValid())
1408 // DESCRIPTION: pops the top two stack values, subtracts the former top
1409 // of the stack from the former second entry, and pushes the result.
1411 tmp = stack.back();
1412 stack.pop_back();
1413 stack.back().ResolveValue(exe_ctx) =
1414 stack.back().ResolveValue(exe_ctx) - tmp.ResolveValue(exe_ctx);
1419 // DESCRIPTION: pops the top two stack values and pushes the result of
1420 // the calculation: former second stack entry modulo the former top of the
1421 // stack.
1423 tmp = stack.back();
1424 stack.pop_back();
1425 stack.back().ResolveValue(exe_ctx) =
1426 stack.back().ResolveValue(exe_ctx) % tmp.ResolveValue(exe_ctx);
1431 // DESCRIPTION: pops the top two stack entries, multiplies them
1434 tmp = stack.back();
1435 stack.pop_back();
1436 stack.back().ResolveValue(exe_ctx) =
1437 stack.back().ResolveValue(exe_ctx) * tmp.ResolveValue(exe_ctx);
1442 // DESCRIPTION: pops the top stack entry, and pushes its negation.
1444 if (!stack.back().ResolveValue(exe_ctx).UnaryNegate())
1450 // DESCRIPTION: pops the top stack entry, and pushes its bitwise
1453 if (!stack.back().ResolveValue(exe_ctx).OnesComplement())
1459 // DESCRIPTION: pops the top two stack entries, performs a bitwise or
1462 tmp = stack.back();
1463 stack.pop_back();
1464 stack.back().ResolveValue(exe_ctx) =
1465 stack.back().ResolveValue(exe_ctx) | tmp.ResolveValue(exe_ctx);
1470 // DESCRIPTION: pops the top two stack entries, adds them together, and
1473 tmp = stack.back();
1474 stack.pop_back();
1475 stack.back().GetScalar() += tmp.GetScalar();
1480 // DESCRIPTION: pops the top stack entry, adds it to the unsigned LEB128
1485 stack.back().GetScalar() += uconst_value;
1486 if (!stack.back().GetScalar().IsValid())
1492 // DESCRIPTION: pops the top two stack entries, shifts the former
1494 // the stack, and pushes the result.
1496 tmp = stack.back();
1497 stack.pop_back();
1498 stack.back().ResolveValue(exe_ctx) <<= tmp.ResolveValue(exe_ctx);
1503 // DESCRIPTION: pops the top two stack entries, shifts the former second
1505 // specified by the former top of the stack, and pushes the result.
1507 tmp = stack.back();
1508 stack.pop_back();
1509 if (!stack.back().ResolveValue(exe_ctx).ShiftRightLogical(
1516 // DESCRIPTION: pops the top two stack entries, shifts the former second
1519 // of the stack, and pushes the result.
1521 tmp = stack.back();
1522 stack.pop_back();
1523 stack.back().ResolveValue(exe_ctx) >>= tmp.ResolveValue(exe_ctx);
1528 // DESCRIPTION: pops the top two stack entries, performs the bitwise
1531 tmp = stack.back();
1532 stack.pop_back();
1533 stack.back().ResolveValue(exe_ctx) =
1534 stack.back().ResolveValue(exe_ctx) ^ tmp.ResolveValue(exe_ctx);
1561 // signed integer constant. This operation pops the top of stack. If the
1566 tmp = stack.back();
1567 stack.pop_back();
1587 // DESCRIPTION: pops the top two stack values, compares using the
1589 // STACK RESULT: push the constant value 1 onto the stack if the result
1593 tmp = stack.back();
1594 stack.pop_back();
1595 stack.back().ResolveValue(exe_ctx) =
1596 stack.back().ResolveValue(exe_ctx) == tmp.ResolveValue(exe_ctx);
1601 // DESCRIPTION: pops the top two stack values, compares using the
1603 // STACK RESULT: push the constant value 1 onto the stack if the result
1607 tmp = stack.back();
1608 stack.pop_back();
1609 stack.back().ResolveValue(exe_ctx) =
1610 stack.back().ResolveValue(exe_ctx) >= tmp.ResolveValue(exe_ctx);
1615 // DESCRIPTION: pops the top two stack values, compares using the
1617 // STACK RESULT: push the constant value 1 onto the stack if the result
1621 tmp = stack.back();
1622 stack.pop_back();
1623 stack.back().ResolveValue(exe_ctx) =
1624 stack.back().ResolveValue(exe_ctx) > tmp.ResolveValue(exe_ctx);
1629 // DESCRIPTION: pops the top two stack values, compares using the
1631 // STACK RESULT: push the constant value 1 onto the stack if the result
1635 tmp = stack.back();
1636 stack.pop_back();
1637 stack.back().ResolveValue(exe_ctx) =
1638 stack.back().ResolveValue(exe_ctx) <= tmp.ResolveValue(exe_ctx);
1643 // DESCRIPTION: pops the top two stack values, compares using the
1645 // STACK RESULT: push the constant value 1 onto the stack if the result
1649 tmp = stack.back();
1650 stack.pop_back();
1651 stack.back().ResolveValue(exe_ctx) =
1652 stack.back().ResolveValue(exe_ctx) < tmp.ResolveValue(exe_ctx);
1657 // DESCRIPTION: pops the top two stack values, compares using the
1659 // STACK RESULT: push the constant value 1 onto the stack if the result
1663 tmp = stack.back();
1664 stack.pop_back();
1665 stack.back().ResolveValue(exe_ctx) =
1666 stack.back().ResolveValue(exe_ctx) != tmp.ResolveValue(exe_ctx);
1672 // STACK RESULT: push the unsigned literal constant value onto the top
1673 // of the stack.
1706 stack.push_back(to_generic(op - DW_OP_lit0));
1711 // DESCRIPTION: Push the value in register n on the top of the stack.
1750 stack.push_back(tmp);
1755 // DESCRIPTION: Push the value in register on the top of the stack.
1763 stack.push_back(tmp);
1811 stack.push_back(tmp);
1812 stack.back().SetValueType(Value::ValueType::LoadAddress);
1829 stack.push_back(tmp);
1830 stack.back().SetValueType(Value::ValueType::LoadAddress);
1841 stack.push_back(value);
1842 stack.back().SetValueType(Value::ValueType::LoadAddress);
1845 "invalid stack frame in context for DW_OP_fbreg opcode");
1856 // DESCRIPTION: A place holder. It has no effect on the location stack
1866 // of the stack. If the piece is located in a register, but does not occupy
1884 if (stack.empty()) {
1900 Value curr_piece_source_value(stack.back());
1901 stack.pop_back();
1981 // This is the first piece, we should push it back onto the stack
1989 // the stack.
1993 " but top of stack is of size %" PRIu64,
2006 if (stack.size() < 1) {
2012 "expression stack needs at least 1 item for DW_OP_bit_piece");
2015 log, dwarf_cu, dwarf4_location_description_kind, &stack.back());
2020 switch (stack.back().GetValueType()) {
2025 if (!stack.back().GetScalar().ExtractBitfield(piece_bit_size,
2031 (uint64_t)(stack.back().GetScalar().GetByteSize() * 8));
2066 stack.push_back(result);
2086 stack.push_back(*object_address_ptr);
2106 // stack. Execution returns to the point following the call when the end of
2107 // the attribute is reached. Values on the stack at the time of the call
2109 // the stack by the called expression may be used as return values by prior
2127 // stack. Execution returns to the point following the call when the end of
2128 // the attribute is reached. Values on the stack at the time of the call
2130 // the stack by the called expression may be used as return values by prior
2138 // rather is a constant value. The value from the top of the stack is the
2142 stack.back().SetValueType(Value::ValueType::Scalar);
2150 // DESCRIPTION: Pop the top stack element, convert it to a
2197 Scalar &top = stack.back().ResolveValue(exe_ctx);
2210 // is commonly evaluated with a valid stack frame.
2214 stack.push_back(Scalar(cfa));
2215 stack.back().SetValueType(Value::ValueType::LoadAddress);
2218 "stack frame does not include a canonical "
2223 return llvm::createStringError("unvalid stack frame in context for "
2231 // DESCRIPTION: Pops a TLS offset from the stack, converts it to
2233 // pushes it on the stack.
2236 if (stack.size() < 1) {
2254 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
2262 stack.back().GetScalar() = tls_load_addr;
2263 stack.back().SetValueType(Value::ValueType::LoadAddress);
2269 // DESCRIPTION: Pushes an address to the stack from the .debug_addr
2279 stack.push_back(Scalar(value));
2284 stack.back().SetValueType(Value::ValueType::LoadAddress);
2286 stack.back().SetValueType(Value::ValueType::FileAddress);
2294 // the stack from the .debug_addr section with the base address specified
2304 stack.push_back(Scalar(value));
2309 if (llvm::Error err = Evaluate_DW_OP_entry_value(stack, exe_ctx, reg_ctx,
2320 op, opcodes, offset, stack)) {
2329 if (stack.empty()) {
2330 // Nothing on the stack, check if we created a piece value from DW_OP_piece
2335 return llvm::createStringError("stack empty after evaluation");
2339 log, dwarf_cu, dwarf4_location_description_kind, &stack.back());
2342 size_t count = stack.size();
2344 "Stack after operation has %" PRIu64 " values:", (uint64_t)count);
2348 stack[i].Dump(&new_value);
2352 return stack.back();