Kaydet (Commit) f57604a4 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw dbg_lay: make it easer to match log entries with code locations

Also warn when logging stops due to a limit, not because the layout
finished.

Change-Id: Ifd44901602edec001839ab4ee88f459b45e36da6
Reviewed-on: https://gerrit.libreoffice.org/43362Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 643e9001
...@@ -496,6 +496,7 @@ certain functionality. ...@@ -496,6 +496,7 @@ certain functionality.
@li @c sw.html - Writer HTML import/export @li @c sw.html - Writer HTML import/export
@li @c sw.idle @li @c sw.idle
@li @c sw.layout - Writer core view: document layout @li @c sw.layout - Writer core view: document layout
@li @c sw.layout.debug - Writer layout dbg_lay output
@li @c sw.level2 @li @c sw.level2
@li @c sw.mailmerge - Writer mail merge @li @c sw.mailmerge - Writer mail merge
@li @c sw.pageframe - debug lifecycle of SwPageFrame @li @c sw.pageframe - debug lifecycle of SwPageFrame
......
...@@ -113,8 +113,8 @@ static sal_uLong lcl_GetFrameId( const SwFrame* pFrame ) ...@@ -113,8 +113,8 @@ static sal_uLong lcl_GetFrameId( const SwFrame* pFrame )
if( bFrameId ) if( bFrameId )
return pFrame->GetFrameId(); return pFrame->GetFrameId();
#endif #endif
if( pFrame && pFrame->IsTextFrame() ) if( pFrame )
return static_cast<const SwTextFrame*>(pFrame)->GetTextNode()->GetIndex(); return pFrame->GetFrameId();
return 0; return 0;
} }
...@@ -439,11 +439,11 @@ static void lcl_Start(OStringBuffer& rOut, OStringBuffer& rLay, DbgAction nActio ...@@ -439,11 +439,11 @@ static void lcl_Start(OStringBuffer& rOut, OStringBuffer& rLay, DbgAction nActio
/// of the frame; "+" stands for valid, "-" stands for invalid. /// of the frame; "+" stands for valid, "-" stands for invalid.
static void lcl_Flags(OStringBuffer& rOut, const SwFrame* pFrame) static void lcl_Flags(OStringBuffer& rOut, const SwFrame* pFrame)
{ {
rOut.append(" Sz"); rOut.append(" ValidSize");
rOut.append(pFrame->GetValidSizeFlag() ? '+' : '-'); rOut.append(pFrame->GetValidSizeFlag() ? '+' : '-');
rOut.append(" Ps"); rOut.append(" ValidPos");
rOut.append(pFrame->GetValidPosFlag() ? '+' : '-'); rOut.append(pFrame->GetValidPosFlag() ? '+' : '-');
rOut.append(" PA"); rOut.append(" ValidPrtArea");
rOut.append(pFrame->GetValidPrtAreaFlag() ? '+' : '-'); rOut.append(pFrame->GetValidPrtAreaFlag() ? '+' : '-');
} }
...@@ -451,44 +451,44 @@ static void lcl_Flags(OStringBuffer& rOut, const SwFrame* pFrame) ...@@ -451,44 +451,44 @@ static void lcl_Flags(OStringBuffer& rOut, const SwFrame* pFrame)
static void lcl_FrameType( OStringBuffer& rOut, const SwFrame* pFrame ) static void lcl_FrameType( OStringBuffer& rOut, const SwFrame* pFrame )
{ {
if( pFrame->IsTextFrame() ) if( pFrame->IsTextFrame() )
rOut.append("Text "); rOut.append("SwTextFrame ");
else if( pFrame->IsLayoutFrame() ) else if( pFrame->IsLayoutFrame() )
{ {
if( pFrame->IsPageFrame() ) if( pFrame->IsPageFrame() )
rOut.append("Page "); rOut.append("SwPageFrame ");
else if( pFrame->IsColumnFrame() ) else if( pFrame->IsColumnFrame() )
rOut.append("Col "); rOut.append("SwColumnFrame ");
else if( pFrame->IsBodyFrame() ) else if( pFrame->IsBodyFrame() )
{ {
if( pFrame->GetUpper() && pFrame->IsColBodyFrame() ) if( pFrame->GetUpper() && pFrame->IsColBodyFrame() )
rOut.append("(Col)"); rOut.append("(Col)");
rOut.append("Body "); rOut.append("SwBodyFrame ");
} }
else if( pFrame->IsRootFrame() ) else if( pFrame->IsRootFrame() )
rOut.append("Root "); rOut.append("SwRootFrame ");
else if( pFrame->IsCellFrame() ) else if( pFrame->IsCellFrame() )
rOut.append("Cell "); rOut.append("SwCellFrame ");
else if( pFrame->IsTabFrame() ) else if( pFrame->IsTabFrame() )
rOut.append("Tab "); rOut.append("SwTabFrame ");
else if( pFrame->IsRowFrame() ) else if( pFrame->IsRowFrame() )
rOut.append("Row "); rOut.append("SwRowFrame ");
else if( pFrame->IsSctFrame() ) else if( pFrame->IsSctFrame() )
rOut.append("Sect "); rOut.append("SwSectionFrame ");
else if( pFrame->IsHeaderFrame() ) else if( pFrame->IsHeaderFrame() )
rOut.append("Header "); rOut.append("SwHeaderFrame ");
else if( pFrame->IsFooterFrame() ) else if( pFrame->IsFooterFrame() )
rOut.append("Footer "); rOut.append("SwFooterFrame ");
else if( pFrame->IsFootnoteFrame() ) else if( pFrame->IsFootnoteFrame() )
rOut.append("Footnote "); rOut.append("SwFootnoteFrame ");
else if( pFrame->IsFootnoteContFrame() ) else if( pFrame->IsFootnoteContFrame() )
rOut.append("FootnoteCont "); rOut.append("SwFootnoteContFrame ");
else if( pFrame->IsFlyFrame() ) else if( pFrame->IsFlyFrame() )
rOut.append("Fly "); rOut.append("SwFlyFrame ");
else else
rOut.append("Layout "); rOut.append("SwLayoutFrame ");
} }
else if( pFrame->IsNoTextFrame() ) else if( pFrame->IsNoTextFrame() )
rOut.append("NoText "); rOut.append("SwNoTextFrame");
else else
rOut.append("Not impl. "); rOut.append("Not impl. ");
} }
...@@ -534,7 +534,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n ...@@ -534,7 +534,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
{ {
case PROT::Snapshot: lcl_Flags( aOut, pFrame ); case PROT::Snapshot: lcl_Flags( aOut, pFrame );
break; break;
case PROT::MakeAll: aOut.append("MakeAll"); case PROT::MakeAll: aOut.append("SwFrame::MakeAll");
lcl_Start( aOut, aLayer, nAct ); lcl_Start( aOut, aLayer, nAct );
if( nAct == DbgAction::Start ) if( nAct == DbgAction::Start )
lcl_Flags( aOut, pFrame ); lcl_Flags( aOut, pFrame );
...@@ -543,9 +543,9 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n ...@@ -543,9 +543,9 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
case PROT::MoveBack: case PROT::MoveBack:
if (nFunction == (bTmp ? PROT::Init : PROT::FileInit)) if (nFunction == (bTmp ? PROT::Init : PROT::FileInit))
aOut.append("Fwd"); aOut.append("SwFlowFrame::MoveFwd");
else else
aOut.append("Bwd"); aOut.append("SwFlowFrame::MoveBwd");
lcl_Start( aOut, aLayer, nAct ); lcl_Start( aOut, aLayer, nAct );
if( pParam ) if( pParam )
{ {
...@@ -553,26 +553,26 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n ...@@ -553,26 +553,26 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
aOut.append(static_cast<sal_Int32>(*static_cast<sal_uInt16*>(pParam))); aOut.append(static_cast<sal_Int32>(*static_cast<sal_uInt16*>(pParam)));
} }
break; break;
case PROT::GrowTest: if( DbgAction::Start != nAct ) case PROT::GrowTest:
return; aOut.append("SwFrame::Grow (test)");
aOut.append("TestGrow"); lcl_Start( aOut, aLayer, nAct );
break; break;
case PROT::ShrinkTest: if( DbgAction::Start != nAct ) case PROT::ShrinkTest:
return; aOut.append("SwFrame::Shrink (test)");
aOut.append("TestShrink"); lcl_Start( aOut, aLayer, nAct );
break; break;
case PROT::AdjustN : case PROT::AdjustN :
case PROT::Shrink: bTmp = true; case PROT::Shrink: bTmp = true;
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
case PROT::Grow: case PROT::Grow:
if (!bTmp) if (!bTmp)
aOut.append("Grow"); aOut.append("SwFrame::Grow");
else else
{ {
if (nFunction == PROT::Shrink) if (nFunction == PROT::Shrink)
aOut.append("Shrink"); aOut.append("SwFrame::Shrink");
else else
aOut.append("AdjustNgbhd"); aOut.append("SwFrame::AdjustNeighbourhood");
} }
lcl_Start( aOut, aLayer, nAct ); lcl_Start( aOut, aLayer, nAct );
if( pParam ) if( pParam )
...@@ -582,15 +582,15 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n ...@@ -582,15 +582,15 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
} }
break; break;
case PROT::Pos: break; case PROT::Pos: break;
case PROT::PrintArea: aOut.append("PrtArea"); case PROT::PrintArea: aOut.append("PROT::PrintArea");
lcl_Start( aOut, aLayer, nAct ); lcl_Start( aOut, aLayer, nAct );
break; break;
case PROT::Size: aOut.append("Size"); case PROT::Size: aOut.append("PROT::Size");
lcl_Start( aOut, aLayer, nAct ); lcl_Start( aOut, aLayer, nAct );
aOut.append(' '); aOut.append(' ');
aOut.append(static_cast<sal_Int64>(pFrame->Frame().Height())); aOut.append(static_cast<sal_Int64>(pFrame->Frame().Height()));
break; break;
case PROT::Leaf: aOut.append("Prev/NextLeaf"); case PROT::Leaf: aOut.append("SwFrame::GetPrev/NextSctLeaf");
lcl_Start( aOut, aLayer, nAct ); lcl_Start( aOut, aLayer, nAct );
aOut.append(' '); aOut.append(' ');
if( pParam ) if( pParam )
...@@ -608,13 +608,13 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n ...@@ -608,13 +608,13 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
case PROT::Paste: case PROT::Paste:
if (bTmp) if (bTmp)
aOut.append("Cut from "); aOut.append("PROT::Cut from ");
else else
aOut.append("Paste to "); aOut.append("PROT::Paste to ");
aOut.append(static_cast<sal_Int64>(lcl_GetFrameId(static_cast<SwFrame*>(pParam)))); aOut.append(static_cast<sal_Int64>(lcl_GetFrameId(static_cast<SwFrame*>(pParam))));
break; break;
case PROT::TestFormat: case PROT::TestFormat:
aOut.append("Test"); aOut.append("SwTextFrame::TestFormat");
lcl_Start( aOut, aLayer, nAct ); lcl_Start( aOut, aLayer, nAct );
if( DbgAction::Start == nAct ) if( DbgAction::Start == nAct )
nTestMode |= 2; nTestMode |= 2;
...@@ -630,7 +630,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n ...@@ -630,7 +630,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
aOut.append(static_cast<sal_Int64>(rFrame.Left())); aOut.append(static_cast<sal_Int64>(rFrame.Left()));
aOut.append(", "); aOut.append(", ");
aOut.append(static_cast<sal_Int64>(rFrame.Top())); aOut.append(static_cast<sal_Int64>(rFrame.Top()));
aOut.append(") ("); aOut.append(") -> (");
aOut.append(static_cast<sal_Int64>(pFrame->Frame().Left())); aOut.append(static_cast<sal_Int64>(pFrame->Frame().Left()));
aOut.append(", "); aOut.append(", ");
aOut.append(static_cast<sal_Int64>(pFrame->Frame().Top())); aOut.append(static_cast<sal_Int64>(pFrame->Frame().Top()));
...@@ -659,8 +659,12 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n ...@@ -659,8 +659,12 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT nFunction, DbgAction n
pStream->WriteCharPtr( aOut.getStr() ); pStream->WriteCharPtr( aOut.getStr() );
(*pStream) << endl; // output (*pStream) << endl; // output
pStream->Flush(); // to the disk, so we can read it immediately pStream->Flush(); // to the disk, so we can read it immediately
SAL_INFO("sw.layout.debug", aOut.getStr());
if( ++nLineCount >= nMaxLines ) // max number of lines reached? if( ++nLineCount >= nMaxLines ) // max number of lines reached?
{
SAL_WARN("sw.layout.debug", "max number of lines reached");
SwProtocol::SetRecord( PROT::FileInit ); // => end f logging SwProtocol::SetRecord( PROT::FileInit ); // => end f logging
}
} }
/// Handle the output of the SectionFrames. /// Handle the output of the SectionFrames.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment