compilerplugins/clang/unusedmethods.results | 98 ++---- compilerplugins/clang/unusedmethods.unused-returns.results | 14 include/ucbhelper/interceptedinteraction.hxx | 15 sal/osl/unx/backtrace.c | 210 ------------- sal/osl/unx/backtrace_bsd.c | 105 ++++++ sal/osl/unx/backtrace_other.c | 39 ++ sal/osl/unx/backtrace_solaris.c | 134 ++++++++ sc/inc/tablink.hxx | 1 sc/source/ui/docshell/tablink.cxx | 8 solenv/clang-format/excludelist | 3 ucbhelper/source/client/interceptedinteraction.cxx | 4 11 files changed, 331 insertions(+), 300 deletions(-)
New commits: commit 6056a0e320f0aabbde7adb28c42e00ed72ef2e5b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Oct 11 11:25:12 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Oct 12 16:11:29 2023 +0200 loplugin:unusedmethods Change-Id: I27782fb4b912d8b0d5f19cbe296c2a3b98b2bfd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157818 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/compilerplugins/clang/unusedmethods.results b/compilerplugins/clang/unusedmethods.results index 0ed5031af7c3..5927b7e5845f 100644 --- a/compilerplugins/clang/unusedmethods.results +++ b/compilerplugins/clang/unusedmethods.results @@ -380,11 +380,11 @@ include/basegfx/tuple/Size2D.hxx:100 Size2D<type-parameter-?-?> basegfx::operator*(const Size2D<type-parameter-?-?> &,const Size2D<type-parameter-?-?> &) include/basegfx/tuple/Size2D.hxx:108 Size2D<type-parameter-?-?> basegfx::operator/(const Size2D<type-parameter-?-?> &,const Size2D<type-parameter-?-?> &) -include/basegfx/tuple/Tuple2D.hxx:83 +include/basegfx/tuple/Tuple2D.hxx:72 _Bool basegfx::Tuple2D::equal(const basegfx::Tuple2D<double> &) const -include/basegfx/tuple/Tuple2D.hxx:83 +include/basegfx/tuple/Tuple2D.hxx:72 _Bool basegfx::Tuple2D::equal(const basegfx::Tuple2D<int> &) const -include/basegfx/tuple/Tuple2D.hxx:83 +include/basegfx/tuple/Tuple2D.hxx:72 _Bool basegfx::Tuple2D::equal(const basegfx::Tuple2D<long> &) const include/basegfx/utils/b2dclipstate.hxx:72 _Bool basegfx::utils::B2DClipState::operator!=(const basegfx::utils::B2DClipState &) const @@ -442,14 +442,22 @@ include/comphelper/configuration.hxx:270 void comphelper::ConfigurationLocalizedProperty::set(const type-parameter-?-? &,const std::shared_ptr<comphelper::ConfigurationChanges> &) include/comphelper/configuration.hxx:305 com::sun::star::uno::Reference<com::sun::star::container::XHierarchicalNameReplace> comphelper::ConfigurationGroup::get(const std::shared_ptr<comphelper::ConfigurationChanges> &) -include/comphelper/errcode.hxx:84 +include/comphelper/errcode.hxx:91 _Bool ErrCode::operator<(const ErrCode &) const -include/comphelper/errcode.hxx:85 +include/comphelper/errcode.hxx:92 _Bool ErrCode::operator<=(const ErrCode &) const -include/comphelper/errcode.hxx:86 +include/comphelper/errcode.hxx:93 _Bool ErrCode::operator>(const ErrCode &) const -include/comphelper/errcode.hxx:87 +include/comphelper/errcode.hxx:94 _Bool ErrCode::operator>=(const ErrCode &) const +include/comphelper/errcode.hxx:188 + ErrCodeMsg::ErrCodeMsg(ErrCode,const rtl::OUString &,const rtl::OUString &,struct std::experimental::source_location) +include/comphelper/errcode.hxx:215 + const std::optional<struct std::experimental::source_location> & ErrCodeMsg::GetSourceLocation() const +include/comphelper/errcode.hxx:224 + _Bool ErrCodeMsg::operator==(const ErrCodeMsg &) const +include/comphelper/errcode.hxx:225 + _Bool ErrCodeMsg::operator!=(const ErrCodeMsg &) const include/comphelper/flagguard.hxx:33 ValueRestorationGuard_Impl<T> comphelper::<deduction guide for ValueRestorationGuard_Impl>(ValueRestorationGuard_Impl<T>) include/comphelper/flagguard.hxx:37 @@ -1060,7 +1068,7 @@ include/oox/export/drawingml.hxx:363 _Bool oox::drawingml::DrawingML::WriteCharColor(const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> &) include/oox/export/drawingml.hxx:504 Color oox::drawingml::DrawingML::ColorWithIntensity(unsigned int,unsigned int) -include/oox/helper/attributelist.hxx:69 +include/oox/helper/attributelist.hxx:68 long oox::AttributeConversion::decodeHyper(std::basic_string_view<char16_t>) include/oox/helper/containerhelper.hxx:51 _Bool oox::ValueRange::operator!=(const struct oox::ValueRange &) const @@ -1104,10 +1112,10 @@ include/sfx2/infobar.hxx:104 void SfxInfoBarWindow::SetCommandHandler(weld::Button &,const rtl::OUString &) include/sfx2/lokcomponenthelpers.hxx:49 void LokChartHelper::Invalidate() -include/sfx2/msg.hxx:120 +include/sfx2/msg.hxx:119 const std::type_info * SfxType0::Type() const -include/sfx2/sidebar/FocusManager.hxx:128 - _Bool sfx2::sidebar::FocusManager::MoveFocusInsideDeckTitle(const sfx2::sidebar::FocusManager::FocusLocation &,const int) +include/sfx2/sidebar/FocusManager.hxx:110 + _Bool sfx2::sidebar::FocusManager::IsPanelTitleVisible(const int) const include/sfx2/viewsh.hxx:466 enum LOKDeviceFormFactor SfxViewShell::GetLOKDeviceFormFactor() const include/svl/itemiter.hxx:44 @@ -1120,17 +1128,17 @@ include/svl/itempool.hxx:158 const type-parameter-?-? * SfxItemPool::GetItem2Default(TypedWhichId<type-parameter-?-?>) const include/svl/itempool.hxx:199 void SfxItemPool::dumpAsXml(struct _xmlTextWriter *) const -include/svl/itemset.hxx:72 +include/svl/itemset.hxx:70 _Bool SfxItemSet::empty() const -include/svl/itemset.hxx:73 +include/svl/itemset.hxx:71 int SfxItemSet::size() const -include/svl/itemset.hxx:74 +include/svl/itemset.hxx:72 const SfxPoolItem * SfxItemSet::operator[](int) const include/svl/lockfilecommon.hxx:60 void svt::LockFileCommon::SetURL(const rtl::OUString &) include/svl/ondemand.hxx:346 const CharClass & OnDemandCharClass::operator*() const -include/svl/poolitem.hxx:198 +include/svl/poolitem.hxx:208 type-parameter-?-? * SfxPoolItem::DynamicWhichCast(TypedWhichId<type-parameter-?-?>) include/svl/typedwhich.hxx:31 TypedWhichId::TypedWhichId(TypedWhichId<type-parameter-?-?>,typename enable_if<std::is_base_of_v<CntUInt16Item, derived_type>, int>::type) @@ -2002,7 +2010,7 @@ include/svx/dlgctrl.hxx:263 void SvxLineEndLB::set_active_text(const rtl::OUString &) include/svx/framelink.hxx:168 _Bool svx::frame::operator>(const svx::frame::Style &,const svx::frame::Style &) -include/svx/hlnkitem.hxx:104 +include/svx/hlnkitem.hxx:103 void SvxHyperlinkItem::SetReplacementText(const rtl::OUString &) include/svx/langbox.hxx:95 void SvxLanguageBox::set_size_request(int,int) @@ -2196,6 +2204,10 @@ include/tools/weakbase.h:151 struct tools::WeakConnection * tools::WeakBase::getWeakConnection() include/tools/XmlWriter.hxx:63 void tools::XmlWriter::element(const char *) +include/ucbhelper/interceptedinteraction.hxx:87 + ucbhelper::InterceptedInteraction::InterceptedRequest::InterceptedRequest() +include/ucbhelper/interceptedinteraction.hxx:142 + ucbhelper::InterceptedInteraction::InterceptedInteraction() include/unotest/directories.hxx:46 rtl::OUString test::Directories::getPathFromWorkdir(std::basic_string_view<char16_t>) const include/unotools/charclass.hxx:101 @@ -2222,13 +2234,13 @@ include/vcl/animate/Animation.hxx:42 _Bool Animation::operator!=(const Animation &) const include/vcl/animate/AnimationFrame.hxx:77 _Bool AnimationFrame::operator!=(const struct AnimationFrame &) const -include/vcl/bitmap.hxx:570 +include/vcl/bitmap.hxx:575 const basegfx::SystemDependentDataHolder * Bitmap::accessSystemDependentDataHolder() const include/vcl/BitmapBasicMorphologyFilter.hxx:63 BitmapDilateFilter::BitmapDilateFilter(int,unsigned char) -include/vcl/BitmapReadAccess.hxx:87 +include/vcl/BitmapReadAccess.hxx:86 BitmapColor BitmapReadAccess::GetPixel(const Point &) const -include/vcl/BitmapReadAccess.hxx:107 +include/vcl/BitmapReadAccess.hxx:110 unsigned char BitmapReadAccess::GetPixelIndex(const Point &) const include/vcl/builder.hxx:107 const rtl::OUString & VclBuilder::getUIFile() const @@ -2662,10 +2674,10 @@ sc/inc/stlalgorithm.hxx:61 _Bool sc::AlignedAllocator::operator!=(const AlignedAllocator<T, Alignment> &) const sc/inc/table.hxx:352 _Bool ScTable::IsColRowTabValid(const short,const int,const short) const -sc/inc/table.hxx:752 +sc/inc/table.hxx:756 const type-parameter-?-? * ScTable::GetAttr(short,int,TypedWhichId<type-parameter-?-?>,int &,int &) const -sc/inc/tablink.hxx:66 - void ScTableLink::LinkStubRefreshHdl(void *,Timer *) +sc/inc/tablink.hxx:89 + rtl::OUString ScDocumentLoader::GetTitle() const sc/qa/unit/helper/qahelper.hxx:77 std::basic_ostream<char> & operator<<(std::basic_ostream<char> &,const enum OpCode &) sc/qa/unit/helper/qahelper.hxx:83 @@ -2788,40 +2800,8 @@ sd/inc/sddll.hxx:47 SdDLL::SdDLL() sd/source/filter/eppt/epptooxml.hxx:93 void oox::core::PowerPointExport::WriteDefaultColorSchemes(const std::shared_ptr<sax_fastparser::FastSerializerHelper> &) -sd/source/filter/html/buttonset.hxx:34 - ButtonSet::ButtonSet() -sd/source/filter/html/buttonset.hxx:37 - int ButtonSet::getCount() const -sd/source/filter/html/buttonset.hxx:39 - _Bool ButtonSet::getPreview(int,const std::vector<rtl::OUString> &,Image &) -sd/source/filter/html/buttonset.hxx:40 - _Bool ButtonSet::exportButton(int,const rtl::OUString &,const rtl::OUString &) -sd/source/filter/html/htmlattr.hxx:31 - SdHtmlAttrPreview::SdHtmlAttrPreview() -sd/source/filter/html/htmlattr.hxx:36 - void SdHtmlAttrPreview::SetColors(const Color &,const Color &,const Color &,const Color &,const Color &) sd/source/filter/ppt/pptinanimations.hxx:107 void ppt::AnimationImporter::dump(const char *,long) -sd/source/ui/inc/assclass.hxx:46 - Assistent::Assistent(int) -sd/source/ui/inc/assclass.hxx:48 - _Bool Assistent::IsEnabled(int) const -sd/source/ui/inc/assclass.hxx:49 - void Assistent::EnablePage(int) -sd/source/ui/inc/assclass.hxx:50 - void Assistent::DisablePage(int) -sd/source/ui/inc/assclass.hxx:53 - _Bool Assistent::InsertControl(int,weld::Widget *) -sd/source/ui/inc/assclass.hxx:55 - void Assistent::NextPage() -sd/source/ui/inc/assclass.hxx:57 - void Assistent::PreviousPage() -sd/source/ui/inc/assclass.hxx:61 - _Bool Assistent::IsLastPage() const -sd/source/ui/inc/assclass.hxx:63 - _Bool Assistent::IsFirstPage() const -sd/source/ui/inc/assclass.hxx:65 - int Assistent::GetCurrentPage() const sd/source/ui/inc/filedlg.hxx:54 _Bool SdOpenSoundFileDialog::IsInsertAsLinkSelected() const sd/source/ui/inc/GraphicViewShell.hxx:43 @@ -3026,11 +3006,11 @@ starmath/inc/parse.hxx:31 AbstractSmParser * starmathdatabase::GetDefaultSmParser() starmath/inc/smmod.hxx:55 rtl::OUString SmLocalizedSymbolData::GetExportSymbolName(std::basic_string_view<char16_t>) -starmath/inc/token.hxx:180 +starmath/inc/token.hxx:181 SmColorTokenTableEntry::SmColorTokenTableEntry(const std::unique_ptr<struct SmColorTokenTableEntry>) -starmath/inc/token.hxx:201 +starmath/inc/token.hxx:202 _Bool SmColorTokenTableEntry::equals(std::basic_string_view<char16_t>) const -starmath/inc/token.hxx:208 +starmath/inc/token.hxx:209 _Bool SmColorTokenTableEntry::equals(Color) const svgio/inc/svgstyleattributes.hxx:354 svgio::svgreader::SvgNumber svgio::svgreader::SvgStyleAttributes::getStrokeDashOffset() const @@ -3206,7 +3186,7 @@ sw/inc/shellio.hxx:89 void SwAsciiOptions::SetIncludeHidden(_Bool) sw/inc/swabstdlg.hxx:417 std::optional<SwLanguageListItem> AbstractSwTranslateLangSelectDlg::GetSelectedLanguage() -sw/inc/swatrset.hxx:236 +sw/inc/swatrset.hxx:237 const SvxNoHyphenItem & SwAttrSet::GetNoHyphenHere(_Bool) const sw/inc/swcrsr.hxx:309 SwTableCursor * SwTableCursor::GetNext() @@ -3224,7 +3204,7 @@ sw/inc/swrect.hxx:152 _Bool SwRect::OverStepTop(long) const sw/inc/textboxhelper.hxx:256 _Bool SwTextBoxNode::IsGroupTextBox() const -sw/inc/view.hxx:473 +sw/inc/view.hxx:476 void SwView::LinkStubMoveNavigationHdl(void *,void *) sw/inc/viewopt.hxx:311 const struct SwViewColors & SwViewOption::GetColorConfig() const diff --git a/compilerplugins/clang/unusedmethods.unused-returns.results b/compilerplugins/clang/unusedmethods.unused-returns.results index a56415705608..eae501882b38 100644 --- a/compilerplugins/clang/unusedmethods.unused-returns.results +++ b/compilerplugins/clang/unusedmethods.unused-returns.results @@ -36,7 +36,7 @@ include/basegfx/vector/b3dvector.hxx:144 basegfx::B3DVector & basegfx::B3DVector::setLength(double) include/basegfx/vector/b3dvector.hxx:169 basegfx::B3DVector & basegfx::B3DVector::normalize() -include/basic/sbstar.hxx:62 +include/basic/sbstar.hxx:63 _Bool StarBASIC::RTError(ErrCode,const rtl::OUString &,int,int,int) include/comphelper/backupfilehelper.hxx:205 _Bool comphelper::BackupFileHelper::tryPush_extensionInfo(std::basic_string_view<char16_t>) @@ -180,9 +180,9 @@ include/unotools/localedatawrapper.hxx:163 const com::sun::star::uno::Sequence<struct com::sun::star::lang::Locale> & LocaleDataWrapper::getAllInstalledLocaleNames() const include/vcl/BinaryDataContainer.hxx:61 unsigned long BinaryDataContainer::writeToStream(SvStream &) const -include/vcl/bitmap.hxx:263 +include/vcl/bitmap.hxx:268 _Bool Bitmap::Blend(const AlphaMask &,const Color &) -include/vcl/bitmap.hxx:431 +include/vcl/bitmap.hxx:436 _Bool Bitmap::Replace(const AlphaMask &,const Color &) include/vcl/bitmapex.hxx:227 _Bool BitmapEx::Rotate(struct o3tl::strong_int<short, struct FractionTag<10> >,const Color &) @@ -190,7 +190,7 @@ include/vcl/filter/SvmReader.hxx:36 SvStream & SvmReader::Read(GDIMetaFile &,struct ImplMetaReadData *) include/vcl/filter/SvmWriter.hxx:37 SvStream & SvmWriter::Write(const GDIMetaFile &) -include/vcl/formatter.hxx:219 +include/vcl/formatter.hxx:225 _Bool Formatter::SetFormat(const rtl::OUString &,struct o3tl::strong_int<unsigned short, struct LanguageTypeTag>) include/vcl/graphicfilter.hxx:259 ErrCode GraphicFilter::ExportGraphic(const Graphic &,const INetURLObject &,unsigned short,const com::sun::star::uno::Sequence<struct com::sun::star::beans::PropertyValue> *) @@ -280,6 +280,8 @@ sc/source/ui/vba/vbaformat.hxx:151 com::sun::star::uno::Any ScVbaFormat::getReadingOrder() sd/source/filter/eppt/pptx-epptooxml.cxx:136 oox::drawingml::ShapeExport & oox::core::PowerPointShapeExport::WritePageShape(const com::sun::star::uno::Reference<com::sun::star::drawing::XShape> &,enum PageType,_Bool) +sd/source/filter/html/htmlex.hxx:74 + _Bool HtmlExport::WriteHtml(const rtl::OUString &,_Bool,std::basic_string_view<char16_t>) sd/source/ui/inc/DrawViewShell.hxx:253 _Bool sd::DrawViewShell::SelectPage(unsigned short,unsigned short) sd/source/ui/inc/navigatr.hxx:120 @@ -340,9 +342,9 @@ sw/source/uibase/inc/fldmgr.hxx:118 const com::sun::star::uno::Reference<com::sun::star::text::XNumberingTypeInfo> & SwFieldMgr::GetNumberingInfo() const sw/source/uibase/inc/mailmergewizard.hxx:78 _Bool SwMailMergeWizard::skipUntil(unsigned short) -sw/source/uibase/inc/wrtsh.hxx:427 +sw/source/uibase/inc/wrtsh.hxx:429 _Bool SwWrtShell::GotoFieldmark(const sw::mark::IFieldmark *const) -sw/source/uibase/inc/wrtsh.hxx:435 +sw/source/uibase/inc/wrtsh.hxx:437 _Bool SwWrtShell::GotoContentControl(const SwFormatContentControl &,_Bool) ucb/source/ucp/webdav-curl/ContentProperties.hxx:160 _Bool http_dav_ucp::CachableContentProperties::containsAllNames(const com::sun::star::uno::Sequence<struct com::sun::star::beans::Property> &,std::vector<rtl::OUString> &) const diff --git a/include/ucbhelper/interceptedinteraction.hxx b/include/ucbhelper/interceptedinteraction.hxx index 3c343b38b748..b7ac77068c14 100644 --- a/include/ucbhelper/interceptedinteraction.hxx +++ b/include/ucbhelper/interceptedinteraction.hxx @@ -78,16 +78,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public InterceptedInteraction sal_Int32 Handle; - /** @short default ctor. - - @descr Such constructed object can't be used really. - Might it will crash if it's used! - Don't forget to initialize all(!) members... - */ - InterceptedRequest() - { - Handle = INVALID_HANDLE; - } InterceptedRequest(css::uno::Any Request_, css::uno::Type Continuation_, sal_Int32 Handle_) : Request(std::move(Request_)), Continuation(std::move(Continuation_)), Handle(Handle_) { @@ -136,11 +126,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public InterceptedInteraction // native interface public: - - /** @short initialize a new instance with default values. - */ - InterceptedInteraction(); - /** @short initialise with a list of intercepted interactions. @attention If the interface method handle() will be overwritten by diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx index a97f1027cc4f..63eba3b2efa9 100644 --- a/sc/inc/tablink.hxx +++ b/sc/inc/tablink.hxx @@ -86,7 +86,6 @@ public: ScDocument* GetDocument(); ScDocShell* GetDocShell() { return pDocShell; } bool IsError() const; - OUString GetTitle() const; void ReleaseDocRef(); // without calling DoClose diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 711434298ebd..affcbb5c7fb8 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -558,12 +558,4 @@ bool ScDocumentLoader::IsError() const return true; } -OUString ScDocumentLoader::GetTitle() const -{ - if ( pDocShell ) - return pDocShell->GetTitle(); - else - return OUString(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucbhelper/source/client/interceptedinteraction.cxx b/ucbhelper/source/client/interceptedinteraction.cxx index e7413feecac9..15b1b318bdac 100644 --- a/ucbhelper/source/client/interceptedinteraction.cxx +++ b/ucbhelper/source/client/interceptedinteraction.cxx @@ -23,10 +23,6 @@ namespace ucbhelper{ -InterceptedInteraction::InterceptedInteraction() -{ -} - InterceptedInteraction::InterceptedInteraction(std::span< const InterceptedRequest > lInterceptions) : m_lInterceptions(lInterceptions) { commit ff5863d46c1730c65f27f3f6234d71b727af5ca9 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Oct 12 11:00:48 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Oct 12 16:11:16 2023 +0200 split up the backtrace implementations into separate files Because I cannot keep what is inside what #ifdef straight in my head Change-Id: Ie986a6928df179fc0e30ca12c6d2a6866ed82078 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157861 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index f7bd01c334aa..f757c8506688 100644 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -25,219 +25,15 @@ #ifdef __sun /* Solaris */ -#include <dlfcn.h> -#include <pthread.h> -#include <setjmp.h> -#include <stdio.h> -#include <sys/frame.h> - -#if defined(SPARC) - -#if defined IS_LP64 - -#define FRAME_PTR_OFFSET 1 -#define FRAME_OFFSET 0 -#define STACK_BIAS 0x7ff - -#else - -#define FRAME_PTR_OFFSET 1 -#define FRAME_OFFSET 0 -#define STACK_BIAS 0 - -#endif - -#elif defined( INTEL ) - -#define FRAME_PTR_OFFSET 3 -#define FRAME_OFFSET 0 -#define STACK_BIAS 0 - -#else - -#error Unknown Solaris target platform. - -#endif /* defined SPARC or INTEL */ - -int backtrace( void **buffer, int max_frames ) -{ - jmp_buf ctx; - long fpval; - struct frame *fp; - int i; - - /* flush register windows */ -#ifdef SPARC - asm("ta 3"); -#endif - - /* get stack- and framepointer */ - setjmp(ctx); - - fpval = ((long*)(ctx))[FRAME_PTR_OFFSET]; - fp = (struct frame*)((char*)(fpval) + STACK_BIAS); - - for (i = 0; (i < FRAME_OFFSET) && (fp != 0); i++) - fp = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); - - /* iterate through backtrace */ - for (i = 0; (fp != 0) && (fp->fr_savpc != 0) && (i < max_frames); i++) - { - /* saved (prev) frame */ - struct frame * prev = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); - - /* store frame */ - *(buffer++) = (void*)(fp->fr_savpc); - - /* prev frame (w/ stack growing top down) */ - fp = (prev > fp) ? prev : 0; - } - - /* return number of frames stored */ - return i; -} - -char ** backtrace_symbols(void * const * buffer, int size) -{ - (void)buffer; (void)size; - return NULL; /*TODO*/ -} - -void backtrace_symbols_fd( void **buffer, int size, int fd ) -{ - FILE *fp = fdopen( fd, "w" ); - - if ( fp ) - { - void **pFramePtr; - - for ( pFramePtr = buffer; size > 0 && pFramePtr && *pFramePtr; pFramePtr++, size-- ) - { - Dl_info dli; - ptrdiff_t offset; - - if ( 0 != dladdr( *pFramePtr, &dli ) ) - { - if ( dli.dli_fname && dli.dli_fbase ) - { - offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; - fprintf( fp, "%s+0x%" SAL_PRI_PTRDIFFT "x", dli.dli_fname, offset ); - } - if ( dli.dli_sname && dli.dli_saddr ) - { - offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; - fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); - } - } - fprintf( fp, "[%p]\n", *pFramePtr ); - } - - fclose( fp ); - } -} +#include "backtrace_solaris.c" #elif defined FREEBSD || defined NETBSD || defined OPENBSD || defined(DRAGONFLY) -#include <dlfcn.h> -#include <pthread.h> -#include <setjmp.h> -#include <stddef.h> -#include <stdio.h> - -/* no frame.h on FreeBSD */ -struct frame { - struct frame *fr_savfp; - long fr_savpc; -}; - -#if defined(POWERPC) || defined(POWERPC64) - -#define FRAME_PTR_OFFSET 1 -#define FRAME_OFFSET 0 - -#else - -#define FRAME_PTR_OFFSET 3 -#define FRAME_OFFSET 0 - -#endif - -int backtrace( void **buffer, int max_frames ) -{ - struct frame *fp; - jmp_buf ctx; - int i; - /* get stack- and framepointer */ - setjmp(ctx); - fp = (struct frame*)(((size_t*)(ctx))[FRAME_PTR_OFFSET]); - for ( i=0; (i<FRAME_OFFSET) && (fp!=0); i++) - fp = fp->fr_savfp; - /* iterate through backtrace */ - for (i=0; fp && fp->fr_savpc && i<max_frames; i++) - { - /* store frame */ - *(buffer++) = (void *)fp->fr_savpc; - /* next frame */ - fp=fp->fr_savfp; - } - return i; -} - -char ** backtrace_symbols(void * const * buffer, int size) -{ - (void)buffer; (void)size; - return NULL; /*TODO*/ -} - -void backtrace_symbols_fd( void **buffer, int size, int fd ) -{ - FILE *fp = fdopen( fd, "w" ); - - if ( fp ) - { - void **pFramePtr; - for ( pFramePtr = buffer; size > 0 && pFramePtr && *pFramePtr; pFramePtr++, size-- ) - { - Dl_info dli; - ptrdiff_t offset; - - if ( 0 != dladdr( *pFramePtr, &dli ) ) - { - if ( dli.dli_fname && dli.dli_fbase ) - { - offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; - fprintf( fp, "%s+0x%" SAL_PRI_PTRDIFFT "x", dli.dli_fname, offset ); - } - if ( dli.dli_sname && dli.dli_saddr ) - { - offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; - fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); - } - } - fprintf( fp, "[%p]\n", *pFramePtr ); - } - fclose( fp ); - } -} +#include "backtrace_bsd.c" #else /* not GNU/BSD/Solaris */ -int backtrace( void **buffer, int max_frames ) -{ - (void)buffer; (void)max_frames; - return 0; -} - -char ** backtrace_symbols(void * const * buffer, int size) -{ - (void)buffer; (void)size; - return NULL; /*TODO*/ -} - -void backtrace_symbols_fd( void **buffer, int size, int fd ) -{ - (void)buffer; (void)size; (void)fd; -} +#include "backtrace_other.c" #endif /* not GNU/BSD/Solaris */ diff --git a/sal/osl/unx/backtrace_bsd.c b/sal/osl/unx/backtrace_bsd.c new file mode 100644 index 000000000000..f20b739cc25c --- /dev/null +++ b/sal/osl/unx/backtrace_bsd.c @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +// This file is #include from backtrace.c + +#include <dlfcn.h> +#include <pthread.h> +#include <setjmp.h> +#include <stddef.h> +#include <stdio.h> + +/* no frame.h on FreeBSD */ +struct frame { + struct frame *fr_savfp; + long fr_savpc; +}; + +#if defined(POWERPC) || defined(POWERPC64) + +#define FRAME_PTR_OFFSET 1 +#define FRAME_OFFSET 0 + +#else + +#define FRAME_PTR_OFFSET 3 +#define FRAME_OFFSET 0 + +#endif + +int backtrace( void **buffer, int max_frames ) +{ + struct frame *fp; + jmp_buf ctx; + int i; + /* get stack- and framepointer */ + setjmp(ctx); + fp = (struct frame*)(((size_t*)(ctx))[FRAME_PTR_OFFSET]); + for ( i=0; (i<FRAME_OFFSET) && (fp!=0); i++) + fp = fp->fr_savfp; + /* iterate through backtrace */ + for (i=0; fp && fp->fr_savpc && i<max_frames; i++) + { + /* store frame */ + *(buffer++) = (void *)fp->fr_savpc; + /* next frame */ + fp=fp->fr_savfp; + } + return i; +} + +char ** backtrace_symbols(void * const * buffer, int size) +{ + (void)buffer; (void)size; + return NULL; /*TODO*/ +} + +void backtrace_symbols_fd( void **buffer, int size, int fd ) +{ + FILE *fp = fdopen( fd, "w" ); + + if ( fp ) + { + void **pFramePtr; + for ( pFramePtr = buffer; size > 0 && pFramePtr && *pFramePtr; pFramePtr++, size-- ) + { + Dl_info dli; + ptrdiff_t offset; + + if ( 0 != dladdr( *pFramePtr, &dli ) ) + { + if ( dli.dli_fname && dli.dli_fbase ) + { + offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; + fprintf( fp, "%s+0x%" SAL_PRI_PTRDIFFT "x", dli.dli_fname, offset ); + } + if ( dli.dli_sname && dli.dli_saddr ) + { + offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; + fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); + } + } + fprintf( fp, "[%p]\n", *pFramePtr ); + } + fclose( fp ); + } +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/backtrace_other.c b/sal/osl/unx/backtrace_other.c new file mode 100644 index 000000000000..d5ad0a8e53b9 --- /dev/null +++ b/sal/osl/unx/backtrace_other.c @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +// This file is #include from backtrace.c + +int backtrace( void **buffer, int max_frames ) +{ + (void)buffer; (void)max_frames; + return 0; +} + +char ** backtrace_symbols(void * const * buffer, int size) +{ + (void)buffer; (void)size; + return NULL; /*TODO*/ +} + +void backtrace_symbols_fd( void **buffer, int size, int fd ) +{ + (void)buffer; (void)size; (void)fd; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/backtrace_solaris.c b/sal/osl/unx/backtrace_solaris.c new file mode 100644 index 000000000000..76f4475bfb2f --- /dev/null +++ b/sal/osl/unx/backtrace_solaris.c @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +// This file is #include from backtrace.c + +#include <dlfcn.h> +#include <pthread.h> +#include <setjmp.h> +#include <stdio.h> +#include <sys/frame.h> + +#if defined(SPARC) + +#if defined IS_LP64 + +#define FRAME_PTR_OFFSET 1 +#define FRAME_OFFSET 0 +#define STACK_BIAS 0x7ff + +#else + +#define FRAME_PTR_OFFSET 1 +#define FRAME_OFFSET 0 +#define STACK_BIAS 0 + +#endif + +#elif defined( INTEL ) + +#define FRAME_PTR_OFFSET 3 +#define FRAME_OFFSET 0 +#define STACK_BIAS 0 + +#else + +#error Unknown Solaris target platform. + +#endif /* defined SPARC or INTEL */ + +int backtrace( void **buffer, int max_frames ) +{ + jmp_buf ctx; + long fpval; + struct frame *fp; + int i; + + /* flush register windows */ +#ifdef SPARC + asm("ta 3"); +#endif + + /* get stack- and framepointer */ + setjmp(ctx); + + fpval = ((long*)(ctx))[FRAME_PTR_OFFSET]; + fp = (struct frame*)((char*)(fpval) + STACK_BIAS); + + for (i = 0; (i < FRAME_OFFSET) && (fp != 0); i++) + fp = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); + + /* iterate through backtrace */ + for (i = 0; (fp != 0) && (fp->fr_savpc != 0) && (i < max_frames); i++) + { + /* saved (prev) frame */ + struct frame * prev = (struct frame*)((char*)(fp->fr_savfp) + STACK_BIAS); + + /* store frame */ + *(buffer++) = (void*)(fp->fr_savpc); + + /* prev frame (w/ stack growing top down) */ + fp = (prev > fp) ? prev : 0; + } + + /* return number of frames stored */ + return i; +} + +char ** backtrace_symbols(void * const * buffer, int size) +{ + (void)buffer; (void)size; + return NULL; /*TODO*/ +} + +void backtrace_symbols_fd( void **buffer, int size, int fd ) +{ + FILE *fp = fdopen( fd, "w" ); + + if ( fp ) + { + void **pFramePtr; + + for ( pFramePtr = buffer; size > 0 && pFramePtr && *pFramePtr; pFramePtr++, size-- ) + { + Dl_info dli; + ptrdiff_t offset; + + if ( 0 != dladdr( *pFramePtr, &dli ) ) + { + if ( dli.dli_fname && dli.dli_fbase ) + { + offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; + fprintf( fp, "%s+0x%" SAL_PRI_PTRDIFFT "x", dli.dli_fname, offset ); + } + if ( dli.dli_sname && dli.dli_saddr ) + { + offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; + fprintf( fp, "(%s+0x%" SAL_PRI_PTRDIFFT "x)", dli.dli_sname, offset ); + } + } + fprintf( fp, "[%p]\n", *pFramePtr ); + } + + fclose( fp ); + } +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 3f8b9c845083..0bfb162e5e19 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -7551,6 +7551,9 @@ sal/osl/all/loadmodulerelative.cxx sal/osl/all/log.cxx sal/osl/all/utility.cxx sal/osl/unx/backtrace.c +sal/osl/unx/backtrace_bsd.c +sal/osl/unx/backtrace_other.c +sal/osl/unx/backtrace_solaris.c sal/osl/unx/backtrace.h sal/osl/unx/backtraceapi.cxx sal/osl/unx/conditn.cxx