mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 09:58:55 +08:00
Fix printf issue with printing pointers from 32bit kernel on 64bit system.
Change-Id: I77771b4ebe6c4335d51dc1834f0b8f9df2a069a4
This commit is contained in:
committed by
sys_ocldev
parent
2e4a64f1e0
commit
5946a2cd15
@@ -749,7 +749,7 @@ TEST_F(PrintFormatterTest, GivenPrintfFormatWhenPointerThenInsertAddress) {
|
||||
storeData(reinterpret_cast<void *>(&temp));
|
||||
|
||||
// on 32bit configurations add extra 4 bytes when storing pointers, IGC always stores pointers on 8 bytes
|
||||
if (!is64bit) {
|
||||
if (is32bit) {
|
||||
uint32_t padding = 0;
|
||||
storeData(padding);
|
||||
}
|
||||
@@ -764,6 +764,33 @@ TEST_F(PrintFormatterTest, GivenPrintfFormatWhenPointerThenInsertAddress) {
|
||||
EXPECT_STREQ(referenceOutput, actualOutput);
|
||||
}
|
||||
|
||||
TEST_F(PrintFormatterTest, GivenPrintfFormatWhenPointerWith32BitKernelThenPrint32BitPointer) {
|
||||
auto stringIndex = injectFormatString("%p");
|
||||
storeData(stringIndex);
|
||||
kernelInfo->gpuPointerSize = 4;
|
||||
|
||||
storeData(PRINTF_DATA_TYPE::POINTER);
|
||||
|
||||
// store pointer
|
||||
uint32_t addressValue = 0;
|
||||
storeData(addressValue);
|
||||
|
||||
void *pointer = nullptr;
|
||||
|
||||
// store non zero padding
|
||||
uint32_t padding = 0xdeadbeef;
|
||||
storeData(padding);
|
||||
|
||||
char actualOutput[PrintFormatter::maxPrintfOutputLength];
|
||||
char referenceOutput[PrintFormatter::maxPrintfOutputLength];
|
||||
|
||||
snprintf(referenceOutput, sizeof(referenceOutput), "%p", pointer);
|
||||
|
||||
printFormatter->printKernelOutput([&actualOutput](char *str) { strncpy_s(actualOutput, PrintFormatter::maxPrintfOutputLength, str, PrintFormatter::maxPrintfOutputLength); });
|
||||
|
||||
EXPECT_STREQ(referenceOutput, actualOutput);
|
||||
}
|
||||
|
||||
TEST_F(PrintFormatterTest, GivenPrintfFormatWhen2ByteVectorsThenParseDataBufferProperly) {
|
||||
int channelCount = 4;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user