#if defined(__ELF__) && !defined(OS_FREEBSD) #include #include #include #include #include #include #include #include namespace DB { namespace { class FunctionAddressToLine: public FunctionAddressToLineBase { public: static constexpr auto name = "addressToLine"; String getName() const override { return name; } static FunctionPtr create(ContextPtr context) { context->checkAccess(AccessType::addressToLine); return std::make_shared(); } protected: DataTypePtr getDataType() const override { return std::make_shared(); } ColumnPtr getResultColumn(const typename ColumnVector::Container & data, size_t input_rows_count) const override { auto result_column = ColumnString::create(); for (size_t i = 0; i < input_rows_count; ++i) { StringRef res_str = implCached(data[i]); result_column->insertData(res_str.data, res_str.size); } return result_column; } void setResult(StringRef & result, const Dwarf::LocationInfo & location, const std::vector &) const override { const char * arena_begin = nullptr; WriteBufferFromArena out(cache.arena, arena_begin); writeString(location.file.toString(), out); writeChar(':', out); writeIntText(location.line, out); result = out.complete(); } }; } REGISTER_FUNCTION(AddressToLine) { factory.registerFunction(); } } #endif