S32K312 - a MCAL pointer variable point to a self-defined variable

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K312 - a MCAL pointer variable point to a self-defined variable

524 Views
yumi
Contributor III

Hi, I am using s32k312 and MCAL version is 5.0.0, the startup and linker files is based on MCAL package.

I defined a bool variable named LibDiagCom_Initialized, and I found in the LiveWatch and memory it was changed unexpectedly. I set a data breakpoint and found a struct variable with a pointer was changing the memory. 

So is this pointer a wilder pointer?

0 Kudos
Reply
3 Replies

434 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@yumi

From the screenshot you provided, I don't see any relationship between "LibDiagCom_Initialized" and "Lpspi_Ip_axStateStructure". Is there a problem?

My understanding of a "dangling pointer"(野指针) is usually that it points to an unknown, random location. I don't see that problem here.

0 Kudos
Reply

333 Views
yumi
Contributor III

Hi Selent,

From the Live Watch, you can see the location of 'LibDiagCom_Initialized' is 0x2040 37df, and the pointer RxBuffer in Lpspi_Ip_axStateStructure point to 0x204037DC. 

I set a data breakpoint for LibDiagCom_Initialized, the scenery is LibDiagCom_Initialized value is changed by the RxBuffer at the data breakpoint, as shows in another picture.

So my question is:

Shouldn't the RxBuffer in Lpspi_Ip_axStateStructure point to somewhere at initialization? If not, is it a dangling pointer? 

0 Kudos
Reply

309 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@yumi

In the image you provided, I did not see that the value of "LibDiagCom_Initialized" had changed.

You'd better provide me with your test routine, because I still don't understand it. I don't see any problems in the images you provided.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2245903%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K312%20-%20a%20MCAL%20pointer%20variable%20point%20to%20a%20self-defined%20variable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2245903%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%EF%BC%8C%20I%20am%20using%20s32k312%20and%20MCAL%20version%20is%205.0.0%2C%20the%20startup%20and%20linker%20files%20is%20based%20on%20MCAL%20package.%3C%2FP%3E%3CP%3EI%20defined%20a%20bool%20variable%20named%26nbsp%3BLibDiagCom_Initialized%2C%20and%20I%20found%20in%20the%20LiveWatch%20and%20memory%20it%20was%20changed%20unexpectedly.%20I%20set%20a%20data%20breakpoint%20and%20found%20a%20struct%20variable%20with%20a%20pointer%20was%20changing%20the%20memory.%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20is%20this%20pointer%20a%20wilder%20pointer%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2246635%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K312%20-%20a%20MCAL%20pointer%20variable%20point%20to%20a%20self-defined%20variable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2246635%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%40%3CSPAN%3Eyumi%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFrom%20the%20screenshot%20you%20provided%2C%20I%20don't%20see%20any%20relationship%20between%20%22LibDiagCom_Initialized%22%20and%20%22Lpspi_Ip_axStateStructure%22.%20Is%20there%20a%20problem%3F%3C%2FP%3E%0A%3CP%3EMy%20understanding%20of%20a%20%22dangling%20pointer%22%EF%BC%88%E9%87%8E%E6%8C%87%E9%92%88%EF%BC%89%20is%20usually%20that%20it%20points%20to%20an%20unknown%2C%20random%20location.%20I%20don't%20see%20that%20problem%20here.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2251607%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K312%20-%20a%20MCAL%20pointer%20variable%20point%20to%20a%20self-defined%20variable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2251607%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Selent%2C%3C%2FP%3E%3CP%3EFrom%20the%20Live%20Watch%2C%20you%20can%20see%20the%20location%20of%20'LibDiagCom_Initialized'%20is%200x2040%2037df%2C%20and%20the%20pointer%20RxBuffer%20in%20Lpspi_Ip_axStateStructure%20point%20to%200x204037DC.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20set%20a%20data%20breakpoint%20for%26nbsp%3BLibDiagCom_Initialized%2C%20the%20scenery%20is%26nbsp%3BLibDiagCom_Initialized%20value%20is%20changed%20by%20the%20RxBuffer%20at%20the%20data%20breakpoint%EF%BC%8C%20as%20shows%20in%20another%20picture.%3C%2FP%3E%3CP%3ESo%20my%20question%20is%3A%3C%2FP%3E%3CP%3EShouldn't%20the%20RxBuffer%20in%26nbsp%3BLpspi_Ip_axStateStructure%20point%20to%20somewhere%20at%20initialization%3F%20If%20not%2C%20is%20it%20a%20dangling%20pointer%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252152%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K312%20-%20a%20MCAL%20pointer%20variable%20point%20to%20a%20self-defined%20variable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252152%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CA%20href%3D%22mailto%3AHi%40yumi%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EHi%40yumi%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EIn%20the%20image%20you%20provided%2C%20I%20did%20not%20see%20that%20the%20value%20of%20%22LibDiagCom_Initialized%22%20had%20changed.%3C%2FP%3E%0A%3CP%3EYou'd%20better%20provide%20me%20with%20your%20test%20routine%2C%20because%20I%20still%20don't%20understand%20it.%20I%20don't%20see%20any%20problems%20in%20the%20images%20you%20provided.%3C%2FP%3E%3C%2FLINGO-BODY%3E