Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

[x86/Linux] Fix framepointer while unwinding#9678

Merged
janvorli merged 1 commit into
dotnet:masterfrom
seanshpark:fixgenericeh
Feb 22, 2017
Merged

[x86/Linux] Fix framepointer while unwinding#9678
janvorli merged 1 commit into
dotnet:masterfrom
seanshpark:fixgenericeh

Conversation

@seanshpark
Copy link
Copy Markdown

Use pCallerContext when getting frame pointer

@seanshpark
Copy link
Copy Markdown
Author

Fixes issue #9626

@seanshpark
Copy link
Copy Markdown
Author

This patch also fixes unit test

  • JIT/Generics/Exceptions/specific_class_instance01
  • JIT/Generics/Exceptions/specific_class_static01
  • JIT/Generics/Exceptions/specific_struct_instance01

@seanshpark
Copy link
Copy Markdown
Author

@parjong, I 've found in

#ifdef WIN64EXCEPTIONS
used WIN64EXCEPTIONS. Should I use this also?

Comment thread src/vm/eetwain.cpp
{
_ASSERTE(stackDepth == 0);
#if defined(_TARGET_X86_) && defined(FEATURE_PAL)
taArgBase = GetCallerSp(pContext) - 2 * sizeof(TADDR);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is already in _TARGET_X86_ region, and thus _TARGET_X86_ is unnecessary.

I think that it would be better to use WIN64EXCEPTIONS instead of FEATURE_PAL.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread src/vm/eetwain.cpp Outdated
#if defined(_TARGET_X86_) && defined(FEATURE_PAL)
taArgBase = GetCallerSp(pContext) - 2 * sizeof(TADDR);
#else
taArgBase = *pContext->GetEbpLocation();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this region is not shared between Windows and Linux, and thus it would be better to use *pContext->pEbp instead of *pContext->GetEbpLocation().

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was originally *pContext->GetEbpLocation(). Should I change it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below line (5180 ?) has direct access to pContext->SP

taArgBase =  pContext->SP + stackDepth;

Would it be better to use like this?

taArgBase = pContext->SP - 2 * sizeof(TADDR);

Copy link
Copy Markdown

@parjong parjong Feb 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanshpark It was *pContext->pEbp;, but revised as the current form while x86/Linux bring up (#9121).

The code around 5180 line takes care of esp-based frames (not ebp-based frames), and thus it would be better to leave it as the current form.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanshpark If you intend to use pContext->SP instead of GetCallerSp(pContext) in 5173 line, I'm not sure about that.

As I understand, pContext->SP stores current stack pointer, and thus it looks strange for me to infer current frame pointer using pContext->SP.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thank you

Copy link
Copy Markdown
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Comment thread src/vm/eetwain.cpp Outdated
#if defined(WIN64EXCEPTIONS)
taArgBase = GetCallerSp(pContext) - 2 * sizeof(TADDR);
#else
taArgBase = *pContext->Ebp;
Copy link
Copy Markdown

@parjong parjong Feb 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use pEbp instead of Ebp here (please refer to inc/regdisp.h for details).

Copy link
Copy Markdown

@parjong parjong Feb 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, it seems reasonable to use GetRegdisplayFP(pContext) here (similarly as below).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thansk, I'll go with pEbp for now.

Use pCallerContext when getting frame pointer
@seanshpark
Copy link
Copy Markdown
Author

@janvorli , PTAL

@janvorli janvorli merged commit 2d7eedb into dotnet:master Feb 22, 2017
@seanshpark
Copy link
Copy Markdown
Author

Thank you!

@seanshpark seanshpark deleted the fixgenericeh branch February 22, 2017 23:06
jorive pushed a commit to guhuro/coreclr that referenced this pull request May 4, 2017
Use pCallerContext when getting frame pointer
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Use pCallerContext when getting frame pointer

Commit migrated from dotnet/coreclr@2d7eedb
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants