void AMXStackFramePrinter::PrintArgumentValue(const AMXStackFrame &frame,
                                              int index) {
  cell value = GetArgumentValue(frame.amx(), frame.address(), index);
  char old_fill = stream_->fill('0');
  *stream_ << std::hex << "0x" << std::setw(kCellWidthChars)
           << value << std::dec;
  stream_->fill(old_fill);
}
void AMXStackFramePrinter::PrintArgumentValue(const AMXStackFrame &frame,
                                              const AMXDebugSymbol &arg,
                                              int index) {
  std::string tag_name = debug_info_->GetTagName(arg.GetTag());
  cell value = GetArgumentValue(frame.amx(), frame.address(), index);

  if (arg.IsVariable()) {
    if (tag_name == "bool") {
      *stream_ << (value ? "true" : "false");
    } else if (tag_name == "Float") {
      *stream_ << std::fixed << std::setprecision(5) << amx_ctof(value);
    } else {
      *stream_ << value;
    }
  } else {
    std::vector<AMXDebugSymbolDim> dims = arg.GetDims();

    // For arrays/references we just output their AMX address.
    char old_fill = stream_->fill('0');
    *stream_ << "@0x" << std::hex << std::setw(kCellWidthChars)
             << value << std::dec;
    stream_->fill(old_fill);

    if ((arg.IsArray() || arg.IsArrayRef())
        && dims.size() == 1
        && tag_name == "_"
        && debug_info_->GetTagName(dims[0].GetTag()) == "_")
    {
      std::string string;
      bool packed;
      
      GetStringContents(frame.amx(), value, dims[0].GetSize(), string, packed);
      *stream_ << (packed ? " !" : " ");
      
      static const std::size_t kMaxString = 30;
      if (string.length() > kMaxString) {
        string.replace(kMaxString, string.length() - kMaxString, "...");
      }
      
      *stream_ << "\"" << string << "\"";
    }
  }
}