I am currently debugging a code example for the MSFT iot-sdk-c and I am getting the following exception over and over again and can't figure out what is going on:
Code: Select all
0x400d6431: _svfprintf_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vfprintf.c:1529
0x4015a886: _vsnprintf_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vsnprintf.c:72
0x4015a8c2: vsnprintf at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vsnprintf.c:41
0x400ef3a2: STRING_construct_sprintf at /home/julian/eclipse-workspace/chaze-esp32/components/esp-azure/azure-iot-sdk-c/c-utility/src/strings.c:786
0x400e7e30: IoTHubClient_LL_UploadMultipleBlocksToBlob_Impl at /home/julian/eclipse-workspace/chaze-esp32/components/esp-azure/azure-iot-sdk-c/iothub_client/src/iothub_client_ll_uploadtoblob.c:911
0x400e6efd: IoTHubClientCore_LL_UploadMultipleBlocksToBlobEx at /home/julian/eclipse-workspace/chaze-esp32/components/esp-azure/azure-iot-sdk-c/iothub_client/src/iothub_client_core_ll.c:2595
0x400e58e6: IoTHubDeviceClient_LL_UploadMultipleBlocksToBlob at /home/julian/eclipse-workspace/chaze-esp32/components/esp-azure/azure-iot-sdk-c/iothub_client/src/iothub_device_client_ll.c:127
0x400914e6: upload_to_blob_block at /home/julian/eclipse-workspace/chaze-esp32/components/upload_to_blob_block/upload_to_blob_block.c:111
0x400d3d20: azure_task(void*) at /home/julian/eclipse-workspace/chaze-esp32/main/main.cpp:51
0x4008e741: vPortTaskWrapper at /home/julian/Documents/esp/esp-idf/components/freertos/port.c:403
Why is there a path with a different user? Who is Ivan ?
I tried increasing the stack size but apparently, that wasn't the problem. I don't think this is a MSFT-sdk side problem, but rather my own.
This is the code-section where it fails:
Code: Select all
STRING_HANDLE STRING_construct_sprintf(const char* format, ...)
{
STRING* result;
#ifdef STRINGS_C_SPRINTF_BUFFER_SIZE
size_t maxBufSize = STRINGS_C_SPRINTF_BUFFER_SIZE;
char buf[STRINGS_C_SPRINTF_BUFFER_SIZE];
#else
size_t maxBufSize = 0;
char* buf = NULL;
#endif
if (format != NULL)
{
va_list arg_list;
int length;
va_start(arg_list, format);
/* Codes_SRS_STRING_07_041: [STRING_construct_sprintf shall determine the size of the resulting string and allocate the necessary memory.] */
length = vsnprintf(buf, maxBufSize, format, arg_list);
va_end(arg_list);
if (length > 0)
{
result = (STRING*)malloc(sizeof(STRING));
if (result != NULL)
{
result->s = (char*)malloc(length+1);
if (result->s != NULL)
{
va_start(arg_list, format);
if (vsnprintf(result->s, length+1, format, arg_list) < 0)
{
/* Codes_SRS_STRING_07_040: [If any error is encountered STRING_construct_sprintf shall return NULL.] */
free(result->s);
free(result);
result = NULL;
LogError("Failure: vsnprintf formatting failed.");
}
va_end(arg_list);
}
else
{
/* Codes_SRS_STRING_07_040: [If any error is encountered STRING_construct_sprintf shall return NULL.] */
free(result);
result = NULL;
LogError("Failure: allocation sprintf value failed.");
}
}
else
{
LogError("Failure: allocation failed.");
}
}
else if (length == 0)
{
result = (STRING*)STRING_new();
}
else
{
/* Codes_SRS_STRING_07_039: [If the parameter format is NULL then STRING_construct_sprintf shall return NULL.] */
result = NULL;
LogError("Failure: vsnprintf return 0 length");
}
}
else
{
LogError("Failure: invalid argument.");
result = NULL;
}
/* Codes_SRS_STRING_07_045: [STRING_construct_sprintf shall allocate a new string with the value of the specified printf formated const char. ] */
return (STRING_HANDLE)result;
}