Lines Matching full:stack
245 case DW_OP_pick: // 0x15 1 1-byte stack index
490 // by a file address on the stack. We assume that DW_OP_const4u or
531 static llvm::Error Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
541 // constant literal, or a spilled stack value) in the parent frame.
581 // 1. Find the function which pushed the current frame onto the stack.
598 // If this is null, we're at the end of the stack.
717 stack.push_back(*maybe_result);
831 std::vector<Value> stack;
846 stack.push_back(*initial_value_ptr);
859 // TODO: Implement a real typed stack, and store the genericness of the value
878 size_t count = stack.size();
879 LLDB_LOGF(log, "Stack before operation has %" PRIu64 " values:",
884 stack[i].Dump(&new_value);
893 if (stack.size() < *arity)
895 "%s needs at least %d stack entries (stack has %d entries)",
896 DW_OP_value_to_name(op), *arity, stack.size());
903 stack.push_back(Scalar(opcodes.GetAddress(&offset)));
908 stack.back().SetValueType(Value::ValueType::LoadAddress);
910 stack.back().SetValueType(Value::ValueType::FileAddress);
935 // stack.push_back(load_addr);
953 // DESCRIPTION: Pops the top stack entry and treats it as an address.
958 if (stack.empty())
960 "expression stack empty for DW_OP_deref");
961 Value::ValueType value_type = stack.back().GetValueType();
964 void *src = (void *)stack.back().GetScalar().ULongLong();
967 stack.back().GetScalar() = ptr;
968 stack.back().ClearContext();
971 auto file_addr = stack.back().GetScalar().ULongLong(
981 stack.back().GetScalar() = *maybe_load_addr;
987 stack.back().SetValueType(Value::ValueType::LoadAddress);
993 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
1000 stack.back().GetScalar() = pointer_value;
1001 stack.back().ClearContext();
1027 // stack entry and treats it as an address. The value retrieved from that
1034 // expression stack.
1036 if (stack.empty()) {
1038 "expression stack empty for DW_OP_deref_size");
1045 Value::ValueType value_type = stack.back().GetValueType();
1048 void *src = (void *)stack.back().GetScalar().ULongLong();
1084 stack.back().GetScalar() = ptr;
1085 stack.back().ClearContext();
1089 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
1109 stack.back().GetScalar() = DerefSizeExtractDataHelper(
1111 stack.back().ClearContext();
1120 stack.back().GetScalar() = load_addr;
1130 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
1136 stack.back().GetScalar() =
1139 stack.back().ClearContext();
1167 // the top of the stack is treated as an address. The second stack entry is
1169 // support multiple address spaces. The top two stack elements are popped,
1171 // calculation and pushed as the new stack top. In the DW_OP_xderef_size
1177 // pushed on the expression stack.
1183 // the top of the stack is treated as an address. The second stack entry is
1185 // support multiple address spaces. The top two stack elements are popped,
1187 // calculation and pushed as the new stack top. The size of the data
1207 stack.push_back(to_generic(opcodes.GetU8(&offset)));
1210 stack.push_back(to_generic((int8_t)opcodes.GetU8(&offset)));
1213 stack.push_back(to_generic(opcodes.GetU16(&offset)));
1216 stack.push_back(to_generic((int16_t)opcodes.GetU16(&offset)));
1219 stack.push_back(to_generic(opcodes.GetU32(&offset)));
1222 stack.push_back(to_generic((int32_t)opcodes.GetU32(&offset)));
1225 stack.push_back(to_generic(opcodes.GetU64(&offset)));
1228 stack.push_back(to_generic((int64_t)opcodes.GetU64(&offset)));
1233 stack.push_back(Scalar(opcodes.GetULEB128(&offset)));
1236 stack.push_back(Scalar(opcodes.GetSLEB128(&offset)));
1241 // DESCRIPTION: duplicates the value at the top of the stack
1243 if (stack.empty()) {
1244 return llvm::createStringError("expression stack empty for DW_OP_dup");
1246 stack.push_back(stack.back());
1251 // DESCRIPTION: pops the value at the top of the stack
1253 if (stack.empty()) {
1254 return llvm::createStringError("expression stack empty for DW_OP_drop");
1256 stack.pop_back();
1261 // DESCRIPTION: Duplicates the entry currently second in the stack at
1262 // the top of the stack.
1264 stack.push_back(stack[stack.size() - 2]);
1268 // OPERANDS: uint8_t index into the current stack
1269 // DESCRIPTION: The stack entry with the specified index (0 through 255,
1270 // inclusive) is pushed on the stack
1273 if (pick_idx < stack.size())
1274 stack.push_back(stack[stack.size() - 1 - pick_idx]);
1283 // DESCRIPTION: swaps the top two stack entries. The entry at the top
1284 // of the stack becomes the second stack entry, and the second entry
1285 // becomes the top of the stack
1287 tmp = stack.back();
1288 stack.back() = stack[stack.size() - 2];
1289 stack[stack.size() - 2] = tmp;
1294 // DESCRIPTION: Rotates the first three stack entries. The entry at
1295 // the top of the stack becomes the third stack entry, the second entry
1296 // becomes the top of the stack, and the third entry becomes the second
1299 size_t last_idx = stack.size() - 1;
1300 Value old_top = stack[last_idx];
1301 stack[last_idx] = stack[last_idx - 1];
1302 stack[last_idx - 1] = stack[last_idx - 2];
1303 stack[last_idx - 2] = old_top;
1308 // DESCRIPTION: pops the top stack entry, interprets it as a signed
1312 if (!stack.back().ResolveValue(exe_ctx).AbsoluteValue()) {
1314 "failed to take the absolute value of the first stack item");
1320 // DESCRIPTION: pops the top two stack values, performs a bitwise and
1323 tmp = stack.back();
1324 stack.pop_back();
1325 stack.back().ResolveValue(exe_ctx) =
1326 stack.back().ResolveValue(exe_ctx) & tmp.ResolveValue(exe_ctx);
1331 // DESCRIPTION: pops the top two stack values, divides the former second
1332 // entry by the former top of the stack using signed division, and pushes
1335 tmp = stack.back();
1339 stack.pop_back();
1342 dividend = stack.back().ResolveValue(exe_ctx);
1345 stack.back() = dividend / divisor;
1347 if (!stack.back().ResolveValue(exe_ctx).IsValid())
1353 // DESCRIPTION: pops the top two stack values, subtracts the former top
1354 // of the stack from the former second entry, and pushes the result.
1356 tmp = stack.back();
1357 stack.pop_back();
1358 stack.back().ResolveValue(exe_ctx) =
1359 stack.back().ResolveValue(exe_ctx) - tmp.ResolveValue(exe_ctx);
1364 // DESCRIPTION: pops the top two stack values and pushes the result of
1365 // the calculation: former second stack entry modulo the former top of the
1366 // stack.
1368 tmp = stack.back();
1369 stack.pop_back();
1370 stack.back().ResolveValue(exe_ctx) =
1371 stack.back().ResolveValue(exe_ctx) % tmp.ResolveValue(exe_ctx);
1376 // DESCRIPTION: pops the top two stack entries, multiplies them
1379 tmp = stack.back();
1380 stack.pop_back();
1381 stack.back().ResolveValue(exe_ctx) =
1382 stack.back().ResolveValue(exe_ctx) * tmp.ResolveValue(exe_ctx);
1387 // DESCRIPTION: pops the top stack entry, and pushes its negation.
1389 if (!stack.back().ResolveValue(exe_ctx).UnaryNegate())
1395 // DESCRIPTION: pops the top stack entry, and pushes its bitwise
1398 if (!stack.back().ResolveValue(exe_ctx).OnesComplement())
1404 // DESCRIPTION: pops the top two stack entries, performs a bitwise or
1407 tmp = stack.back();
1408 stack.pop_back();
1409 stack.back().ResolveValue(exe_ctx) =
1410 stack.back().ResolveValue(exe_ctx) | tmp.ResolveValue(exe_ctx);
1415 // DESCRIPTION: pops the top two stack entries, adds them together, and
1418 tmp = stack.back();
1419 stack.pop_back();
1420 stack.back().GetScalar() += tmp.GetScalar();
1425 // DESCRIPTION: pops the top stack entry, adds it to the unsigned LEB128
1430 stack.back().GetScalar() += uconst_value;
1431 if (!stack.back().GetScalar().IsValid())
1437 // DESCRIPTION: pops the top two stack entries, shifts the former
1439 // the stack, and pushes the result.
1441 tmp = stack.back();
1442 stack.pop_back();
1443 stack.back().ResolveValue(exe_ctx) <<= tmp.ResolveValue(exe_ctx);
1448 // DESCRIPTION: pops the top two stack entries, shifts the former second
1450 // specified by the former top of the stack, and pushes the result.
1452 tmp = stack.back();
1453 stack.pop_back();
1454 if (!stack.back().ResolveValue(exe_ctx).ShiftRightLogical(
1461 // DESCRIPTION: pops the top two stack entries, shifts the former second
1464 // of the stack, and pushes the result.
1466 tmp = stack.back();
1467 stack.pop_back();
1468 stack.back().ResolveValue(exe_ctx) >>= tmp.ResolveValue(exe_ctx);
1473 // DESCRIPTION: pops the top two stack entries, performs the bitwise
1476 tmp = stack.back();
1477 stack.pop_back();
1478 stack.back().ResolveValue(exe_ctx) =
1479 stack.back().ResolveValue(exe_ctx) ^ tmp.ResolveValue(exe_ctx);
1506 // signed integer constant. This operation pops the top of stack. If the
1511 tmp = stack.back();
1512 stack.pop_back();
1532 // DESCRIPTION: pops the top two stack values, compares using the
1534 // STACK RESULT: push the constant value 1 onto the stack if the result
1538 tmp = stack.back();
1539 stack.pop_back();
1540 stack.back().ResolveValue(exe_ctx) =
1541 stack.back().ResolveValue(exe_ctx) == tmp.ResolveValue(exe_ctx);
1546 // DESCRIPTION: pops the top two stack values, compares using the
1548 // STACK RESULT: push the constant value 1 onto the stack if the result
1552 tmp = stack.back();
1553 stack.pop_back();
1554 stack.back().ResolveValue(exe_ctx) =
1555 stack.back().ResolveValue(exe_ctx) >= tmp.ResolveValue(exe_ctx);
1560 // DESCRIPTION: pops the top two stack values, compares using the
1562 // STACK RESULT: push the constant value 1 onto the stack if the result
1566 tmp = stack.back();
1567 stack.pop_back();
1568 stack.back().ResolveValue(exe_ctx) =
1569 stack.back().ResolveValue(exe_ctx) > tmp.ResolveValue(exe_ctx);
1574 // DESCRIPTION: pops the top two stack values, compares using the
1576 // STACK RESULT: push the constant value 1 onto the stack if the result
1580 tmp = stack.back();
1581 stack.pop_back();
1582 stack.back().ResolveValue(exe_ctx) =
1583 stack.back().ResolveValue(exe_ctx) <= tmp.ResolveValue(exe_ctx);
1588 // DESCRIPTION: pops the top two stack values, compares using the
1590 // STACK RESULT: push the constant value 1 onto the stack if the result
1594 tmp = stack.back();
1595 stack.pop_back();
1596 stack.back().ResolveValue(exe_ctx) =
1597 stack.back().ResolveValue(exe_ctx) < tmp.ResolveValue(exe_ctx);
1602 // DESCRIPTION: pops the top two stack values, compares using the
1604 // STACK RESULT: push the constant value 1 onto the stack if the result
1608 tmp = stack.back();
1609 stack.pop_back();
1610 stack.back().ResolveValue(exe_ctx) =
1611 stack.back().ResolveValue(exe_ctx) != tmp.ResolveValue(exe_ctx);
1617 // STACK RESULT: push the unsigned literal constant value onto the top
1618 // of the stack.
1651 stack.push_back(to_generic(op - DW_OP_lit0));
1656 // DESCRIPTION: Push the value in register n on the top of the stack.
1695 stack.push_back(tmp);
1700 // DESCRIPTION: Push the value in register on the top of the stack.
1708 stack.push_back(tmp);
1756 stack.push_back(tmp);
1757 stack.back().SetValueType(Value::ValueType::LoadAddress);
1774 stack.push_back(tmp);
1775 stack.back().SetValueType(Value::ValueType::LoadAddress);
1786 stack.push_back(value);
1787 stack.back().SetValueType(Value::ValueType::LoadAddress);
1792 "invalid stack frame in context for DW_OP_fbreg opcode");
1803 // DESCRIPTION: A place holder. It has no effect on the location stack
1813 // of the stack. If the piece is located in a register, but does not occupy
1831 if (stack.empty()) {
1847 Value curr_piece_source_value(stack.back());
1848 stack.pop_back();
1915 // This is the first piece, we should push it back onto the stack
1923 // the stack.
1927 " but top of stack is of size %" PRIu64,
1940 if (stack.size() < 1) {
1946 "expression stack needs at least 1 item for DW_OP_bit_piece");
1949 log, dwarf_cu, dwarf4_location_description_kind, &stack.back());
1954 switch (stack.back().GetValueType()) {
1959 if (!stack.back().GetScalar().ExtractBitfield(piece_bit_size,
1965 (uint64_t)(stack.back().GetScalar().GetByteSize() * 8));
2000 stack.push_back(result);
2020 stack.push_back(*object_address_ptr);
2040 // stack. Execution returns to the point following the call when the end of
2041 // the attribute is reached. Values on the stack at the time of the call
2043 // the stack by the called expression may be used as return values by prior
2061 // stack. Execution returns to the point following the call when the end of
2062 // the attribute is reached. Values on the stack at the time of the call
2064 // the stack by the called expression may be used as return values by prior
2072 // rather is a constant value. The value from the top of the stack is the
2076 stack.back().SetValueType(Value::ValueType::Scalar);
2084 // DESCRIPTION: Pop the top stack element, convert it to a
2131 Scalar &top = stack.back().ResolveValue(exe_ctx);
2144 // is commonly evaluated with a valid stack frame.
2148 stack.push_back(Scalar(cfa));
2149 stack.back().SetValueType(Value::ValueType::LoadAddress);
2152 "stack frame does not include a canonical "
2157 return llvm::createStringError("unvalid stack frame in context for "
2165 // DESCRIPTION: Pops a TLS offset from the stack, converts it to
2167 // pushes it on the stack.
2170 if (stack.size() < 1) {
2188 stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
2196 stack.back().GetScalar() = tls_load_addr;
2197 stack.back().SetValueType(Value::ValueType::LoadAddress);
2203 // DESCRIPTION: Pushes an address to the stack from the .debug_addr
2213 stack.push_back(Scalar(value));
2218 stack.back().SetValueType(Value::ValueType::LoadAddress);
2220 stack.back().SetValueType(Value::ValueType::FileAddress);
2228 // the stack from the .debug_addr section with the base address specified
2238 stack.push_back(Scalar(value));
2243 if (llvm::Error err = Evaluate_DW_OP_entry_value(stack, exe_ctx, reg_ctx,
2254 op, opcodes, offset, stack)) {
2263 if (stack.empty()) {
2264 // Nothing on the stack, check if we created a piece value from DW_OP_piece
2269 return llvm::createStringError("stack empty after evaluation");
2273 log, dwarf_cu, dwarf4_location_description_kind, &stack.back());
2276 size_t count = stack.size();
2278 "Stack after operation has %" PRIu64 " values:", (uint64_t)count);
2282 stack[i].Dump(&new_value);
2286 return stack.back();