Crash while using jason lib for yahoo login. | developer.brewmp.com Crash while using jason lib for yahoo login. | developer.brewmp.com

Developer

Crash while using jason lib for yahoo login.

Forums:

Hi,

 

My app is an IM client where one of the IM cient is yahoo. While login in to yahoo service i am end up with a crash while creating a session request content. The same is working in simulator. The jason libraries i was using was along with the SDK 1.0.4.433 Pro. please find the code below i was using.

 

JSONGen_Ctor(&gen, 0,0, MunduIterOPUtil::JSONGen_ReallocFunc,(void

*)GETIENV());

 

nStatus = JSONGen_BeginObject(&gen);

 

 

int iLen = STRLEN(KJSON_PRESENCESTATE);

 

 

JSONGen_PutKey(&gen, KJSON_PRESENCESTATE, iLen ); "In this API the crash is happenning" 

  

int MunduIterOPUtil::JSONGen_ReallocFunc(void *pv, int nSize, void**ppv)

 

{

 

 

int iResult = 0;

DBGPRINTF(" JSONGen_ReallocFunc >>>> Entry size[%d]" , nSize);

iResult = IEnv_ErrRealloc((IEnv *)pv, nSize, ppv);

DBGPRINTF(" JSONGen_ReallocFunc >>>> Exit Status[%d]" , iResult);

 

 

return iResult;

}

 

please help me why crash is happenning in this API.

 

 

Can you name the device model and device software build?

Can you name the device model and device software build?

 
I tried to reproduced the issue with my sample application on QRD 6270 and it didn't produce any crash on both device/simulator.Can you please try running below sample code on your side, may be the application issue, if still you see the crash can you please send device to qualcomm phone center to flash with RD9670_DS_V0.1.0. Also follow below given configuration for genarating MOD.
Device : QRD 6270
Latest Build: RD9670_DS_V0.1.0
Also below is the configuration in MSVS in order to genarate MOD using LIB files.
Open BrewMP properties-> Go to Advanced-> Uncheck Disable Automatic Makefile Generation-> enter the Libraries
ex. jsongen.lib;jsonparser.lib;a1std.lib
 
Select Appropriate configuration and compiler
Browse for Library directories
ex.
C:\Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.2.549.1\platform\languages\lib\Win32_Release;
Click on Apply and OK button.
below is the sample code:
 
 
#include "AEEModGen.h"
#include "AEEAppGen.h"
#include "AEEShell.h"

#include "AEEIEnv.h"
#include "AEEEnv.bid" // IEnv class id
#include "myhelloworld.bid"
#include "myhelloworld_res.h"
#include "aeestdlib.h"
#include "AEEFile.h"
#include "AEEJSONGen.h"
#include "AEEIEnv.h"
#include "AEEStdErr.h"
#include "AEEstd.h"
#include "AEEIEnv.h"
#include "AEEIJSONTree.h"
#include "AEEJSONParser.h"
#include "AEEJSONGen.h"
#include "AEEJSONTree.bid"

typedef struct _myhelloworld {
AEEApplet applet; // First element of this structure must be AEEApplet.
IDisplay * piDisplay; // Copy of IDisplay Interface pointer for easy access.
IShell * piShell; // Copy of IShell Interface pointer for easy access.
AEEDeviceInfo deviceInfo; // Copy of device info for easy access.
IEnv* piEnv;
myhelloworld;

static boolean myhelloworld_HandleEvent(myhelloworld* pMe, AEEEvent eCode,
uint16 wParam, uint32 dwParam);
boolean myhelloworld_InitAppData(myhelloworld* pMe);
void myhelloworld_FreeAppData(myhelloworld* pMe);
static void myhelloworld_DrawScreen(myhelloworld * pMe);
static void jsoncheck(myhelloworld *me);
static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv);

int AEEClsCreateInstance(AEECLSID ClsId, IShell * piShell, IModule * piModule,
void ** ppObj)
{
*ppObj = NULL;

// Confirm this applet is the one intended to be created (classID matches):
if( AEECLSID_MYHELLOWORLD == ClsId ) {
// Create the applet and make room for the applet structure.
// NOTE: FreeAppData is called after EVT_APP_STOP is sent to HandleEvent.
if( TRUE == AEEApplet_New(sizeof(myhelloworld),
ClsId,
piShell,
piModule,
(IApplet**)ppObj,
(AEEHANDLER)myhelloworld_HandleEvent,
(PFNFREEAPPDATA)myhelloworld_FreeAppData) ) {

// Initialize applet data. This is called before EVT_APP_START is
// sent to the HandleEvent function.
if(TRUE == myhelloworld_InitAppData((myhelloworld*)*ppObj)) {
return AEE_SUCCESS; // Data initialized successfully.
}
else {
// Release the applet. This will free the memory allocated for
// the applet when AEEApplet_New was called.
IApplet_Release((IApplet*)*ppObj);
return AEE_EFAILED;
}
} // End AEEApplet_New
}
return AEE_EFAILED;

boolean myhelloworld_InitAppData(myhelloworld * pMe)
{
// Save local copy for easy access:
int err=0;
pMe->piDisplay = pMe->applet.m_pIDisplay;
pMe->piShell = pMe->applet.m_pIShell;

// Get the device information for this handset.
// Reference all the data by looking at the pMe->deviceInfo structure.
// Check the API reference guide for all the handy device info you can get.
pMe->deviceInfo.wStructSize = sizeof(pMe->deviceInfo);
ISHELL_GetDeviceInfo(pMe->applet.m_pIShell,&pMe->deviceInfo);

if ((err = ISHELL_CreateInstance(pMe->piShell, AEECLSID_Env , (void**)&pMe->piEnv)) != SUCCESS )
{
DBGPRINTF("AEECLSID_Env instance failed");
return FALSE;
}
return TRUE;// No failures up to this point, so return success.

void myhelloworld_FreeAppData(myhelloworld * pMe)
{

static boolean myhelloworld_HandleEvent(myhelloworld* pMe,
AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
DBGPRINTF("####ecode=%d wparam=%d",eCode,wParam);

switch (eCode) {
// Event to inform app to start, so start-up code is here:
case EVT_APP_START:
jsoncheck(pMe);
return TRUE;

// Event to inform app to exit, so shut-down code is here:
case EVT_APP_STOP:
DBGPRINTF("####EVT_APP_STOP");
return TRUE;

// Event to inform app to suspend, so suspend code is here:
case EVT_APP_SUSPEND:
DBGPRINTF("####EVT_APP_SUSPEND");
return TRUE;

// Event to inform app to resume, so resume code is here:
case EVT_APP_RESUME:
return TRUE;
case EVT_APP_MESSAGE:
return TRUE;
case EVT_SCR_ROTATE:
DBGPRINTF("EVT_SCR_ROTATE");
return TRUE;

case EVT_KEY:

return TRUE;
case EVT_APP_NO_SLEEP:
DBGPRINTF("####EVT_APP_NO_SLEEP");
return TRUE;

// If event wasn't handled here, then break out:
default:
break;
}
return FALSE; // Event wasn't handled.

static void jsoncheck(myhelloworld *me)
{

JSONGen gen = {0};
int nErr=AEE_EFAILED;
char szBuf[256];
const char *psz;
int nSize;

DBGPRINTF("####START");

JSONGen_Ctor(&gen, 0,0, JSONGen_ReallocFunc, (void *)me->piEnv);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_EndObject(&gen);
DBGPRINTF("#######JSONGen_EndObject=%d",nErr);

nErr = JSONGen_GetJSON(&gen, &psz, &nSize);
DBGPRINTF("#######JSONGen_GetJSON=%d",nErr);

if (0 != std_strncmp(psz, "{}", nSize)) {
DBGPRINTF("####IF- JSONGen_GetJSON");
} else {
DBGPRINTF("####ELSE- JSONGen_GetJSON");
}
JSONGen_Dtor(&gen);

JSONGen_Ctor(&gen, szBuf, 256, 0, 0);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_PutKey(&gen, "my int", std_strlen("my int"));
DBGPRINTF("#######JSONGen_PutKey=%d",nErr);

nErr = JSONGen_PutInt(&gen, 123456);
DBGPRINTF("#######JSONGen_PutInt=%d",nErr);

nErr = JSONGen_EndObject(&gen);
DBGPRINTF("#######JSONGen_EndObject=%d",nErr);

JSONGen_GetJSON(&gen, &psz, &nSize);
if (0 != std_strncmp(psz, "{\"my int\"": 123456}"", nSize)) {
DBGPRINTF(""####IF- JSONGen_GetJSON"");
} else {
DBGPRINTF(""####ELSE- JSONGen_GetJSON"");
}
JSONGen_Dtor(&gen);
DBGPRINTF(""####END"");

static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv)
{
return IEnv_ErrRealloc((IEnv *)pv, nSize, ppv);

Logs:
1980/02/05 08:18:43 3058 ####ecode=20 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:01 7666 ####ecode=0 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:03 8178 #####myhelloworld myhelloworld.c 472 3
1980/02/05 08:19:26 14066 ####START myhelloworld.c 918 3
1980/02/05 08:19:26 14066 #######JSONGen_BeginObject=0 myhelloworld.c 922 3
1980/02/05 08:19:34 16114 #######JSONGen_EndObject=0 myhelloworld.c 925 3
1980/02/05 08:19:34 16114 #######JSONGen_GetJSON=0 myhelloworld.c 928 3
1980/02/05 08:19:37 16882 ####ELSE- JSONGen_GetJSON myhelloworld.c 933 3
1980/02/05 08:19:38 17138 #######JSONGen_BeginObject=0 myhelloworld.c 939 3
1980/02/05 08:19:38 17138 #######JSONGen_PutKey=0 myhelloworld.c 942 3
1980/02/05 08:19:38 17138 #######JSONGen_PutInt=0 myhelloworld.c 945 3
1980/02/05 08:19:38 17138 #######JSONGen_EndObject=0 myhelloworld.c 948 3
1980/02/05 08:19:38 17138 ####ELSE- JSONGen_GetJSON myhelloworld.c 954 3
1980/02/05 08:19:38 17138 ####END myhelloworld.c 957 3
Thanks
 "

 
I tried to reproduced the issue with my sample application on QRD 6270 and it didn't produce any crash on both device/simulator.Can you please try running below sample code on your side, may be the application issue, if still you see the crash can you please send device to qualcomm phone center to flash with RD9670_DS_V0.1.0. Also follow below given configuration for genarating MOD.
Device : QRD 6270
Latest Build: RD9670_DS_V0.1.0
Also below is the configuration in MSVS in order to genarate MOD using LIB files.
Open BrewMP properties-> Go to Advanced-> Uncheck Disable Automatic Makefile Generation-> enter the Libraries
ex. jsongen.lib;jsonparser.lib;a1std.lib
 
Select Appropriate configuration and compiler
Browse for Library directories
ex.
C:\Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.2.549.1\platform\languages\lib\Win32_Release;
Click on Apply and OK button.
below is the sample code:
 
 
#include "AEEModGen.h"
#include "AEEAppGen.h"
#include "AEEShell.h"

#include "AEEIEnv.h"
#include "AEEEnv.bid" // IEnv class id
#include "myhelloworld.bid"
#include "myhelloworld_res.h"
#include "aeestdlib.h"
#include "AEEFile.h"
#include "AEEJSONGen.h"
#include "AEEIEnv.h"
#include "AEEStdErr.h"
#include "AEEstd.h"
#include "AEEIEnv.h"
#include "AEEIJSONTree.h"
#include "AEEJSONParser.h"
#include "AEEJSONGen.h"
#include "AEEJSONTree.bid"

typedef struct _myhelloworld {
AEEApplet applet; // First element of this structure must be AEEApplet.
IDisplay * piDisplay; // Copy of IDisplay Interface pointer for easy access.
IShell * piShell; // Copy of IShell Interface pointer for easy access.
AEEDeviceInfo deviceInfo; // Copy of device info for easy access.
IEnv* piEnv;
myhelloworld;

static boolean myhelloworld_HandleEvent(myhelloworld* pMe, AEEEvent eCode,
uint16 wParam, uint32 dwParam);
boolean myhelloworld_InitAppData(myhelloworld* pMe);
void myhelloworld_FreeAppData(myhelloworld* pMe);
static void myhelloworld_DrawScreen(myhelloworld * pMe);
static void jsoncheck(myhelloworld *me);
static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv);

int AEEClsCreateInstance(AEECLSID ClsId, IShell * piShell, IModule * piModule,
void ** ppObj)
{
*ppObj = NULL;

// Confirm this applet is the one intended to be created (classID matches):
if( AEECLSID_MYHELLOWORLD == ClsId ) {
// Create the applet and make room for the applet structure.
// NOTE: FreeAppData is called after EVT_APP_STOP is sent to HandleEvent.
if( TRUE == AEEApplet_New(sizeof(myhelloworld),
ClsId,
piShell,
piModule,
(IApplet**)ppObj,
(AEEHANDLER)myhelloworld_HandleEvent,
(PFNFREEAPPDATA)myhelloworld_FreeAppData) ) {

// Initialize applet data. This is called before EVT_APP_START is
// sent to the HandleEvent function.
if(TRUE == myhelloworld_InitAppData((myhelloworld*)*ppObj)) {
return AEE_SUCCESS; // Data initialized successfully.
}
else {
// Release the applet. This will free the memory allocated for
// the applet when AEEApplet_New was called.
IApplet_Release((IApplet*)*ppObj);
return AEE_EFAILED;
}
} // End AEEApplet_New
}
return AEE_EFAILED;

boolean myhelloworld_InitAppData(myhelloworld * pMe)
{
// Save local copy for easy access:
int err=0;
pMe->piDisplay = pMe->applet.m_pIDisplay;
pMe->piShell = pMe->applet.m_pIShell;

// Get the device information for this handset.
// Reference all the data by looking at the pMe->deviceInfo structure.
// Check the API reference guide for all the handy device info you can get.
pMe->deviceInfo.wStructSize = sizeof(pMe->deviceInfo);
ISHELL_GetDeviceInfo(pMe->applet.m_pIShell,&pMe->deviceInfo);

if ((err = ISHELL_CreateInstance(pMe->piShell, AEECLSID_Env , (void**)&pMe->piEnv)) != SUCCESS )
{
DBGPRINTF("AEECLSID_Env instance failed");
return FALSE;
}
return TRUE;// No failures up to this point, so return success.

void myhelloworld_FreeAppData(myhelloworld * pMe)
{

static boolean myhelloworld_HandleEvent(myhelloworld* pMe,
AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
DBGPRINTF("####ecode=%d wparam=%d",eCode,wParam);

switch (eCode) {
// Event to inform app to start, so start-up code is here:
case EVT_APP_START:
jsoncheck(pMe);
return TRUE;

// Event to inform app to exit, so shut-down code is here:
case EVT_APP_STOP:
DBGPRINTF("####EVT_APP_STOP");
return TRUE;

// Event to inform app to suspend, so suspend code is here:
case EVT_APP_SUSPEND:
DBGPRINTF("####EVT_APP_SUSPEND");
return TRUE;

// Event to inform app to resume, so resume code is here:
case EVT_APP_RESUME:
return TRUE;
case EVT_APP_MESSAGE:
return TRUE;
case EVT_SCR_ROTATE:
DBGPRINTF("EVT_SCR_ROTATE");
return TRUE;

case EVT_KEY:

return TRUE;
case EVT_APP_NO_SLEEP:
DBGPRINTF("####EVT_APP_NO_SLEEP");
return TRUE;

// If event wasn't handled here, then break out:
default:
break;
}
return FALSE; // Event wasn't handled.

static void jsoncheck(myhelloworld *me)
{

JSONGen gen = {0};
int nErr=AEE_EFAILED;
char szBuf[256];
const char *psz;
int nSize;

DBGPRINTF("####START");

JSONGen_Ctor(&gen, 0,0, JSONGen_ReallocFunc, (void *)me->piEnv);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_EndObject(&gen);
DBGPRINTF("#######JSONGen_EndObject=%d",nErr);

nErr = JSONGen_GetJSON(&gen, &psz, &nSize);
DBGPRINTF("#######JSONGen_GetJSON=%d",nErr);

if (0 != std_strncmp(psz, "{}", nSize)) {
DBGPRINTF("####IF- JSONGen_GetJSON");
} else {
DBGPRINTF("####ELSE- JSONGen_GetJSON");
}
JSONGen_Dtor(&gen);

JSONGen_Ctor(&gen, szBuf, 256, 0, 0);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_PutKey(&gen, "my int", std_strlen("my int"));
DBGPRINTF("#######JSONGen_PutKey=%d",nErr);

nErr = JSONGen_PutInt(&gen, 123456);
DBGPRINTF("#######JSONGen_PutInt=%d",nErr);

nErr = JSONGen_EndObject(&gen);
DBGPRINTF("#######JSONGen_EndObject=%d",nErr);

JSONGen_GetJSON(&gen, &psz, &nSize);
if (0 != std_strncmp(psz, "{\"my int\"": 123456}"", nSize)) {
DBGPRINTF(""####IF- JSONGen_GetJSON"");
} else {
DBGPRINTF(""####ELSE- JSONGen_GetJSON"");
}
JSONGen_Dtor(&gen);
DBGPRINTF(""####END"");

static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv)
{
return IEnv_ErrRealloc((IEnv *)pv, nSize, ppv);

Logs:
1980/02/05 08:18:43 3058 ####ecode=20 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:01 7666 ####ecode=0 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:03 8178 #####myhelloworld myhelloworld.c 472 3
1980/02/05 08:19:26 14066 ####START myhelloworld.c 918 3
1980/02/05 08:19:26 14066 #######JSONGen_BeginObject=0 myhelloworld.c 922 3
1980/02/05 08:19:34 16114 #######JSONGen_EndObject=0 myhelloworld.c 925 3
1980/02/05 08:19:34 16114 #######JSONGen_GetJSON=0 myhelloworld.c 928 3
1980/02/05 08:19:37 16882 ####ELSE- JSONGen_GetJSON myhelloworld.c 933 3
1980/02/05 08:19:38 17138 #######JSONGen_BeginObject=0 myhelloworld.c 939 3
1980/02/05 08:19:38 17138 #######JSONGen_PutKey=0 myhelloworld.c 942 3
1980/02/05 08:19:38 17138 #######JSONGen_PutInt=0 myhelloworld.c 945 3
1980/02/05 08:19:38 17138 #######JSONGen_EndObject=0 myhelloworld.c 948 3
1980/02/05 08:19:38 17138 ####ELSE- JSONGen_GetJSON myhelloworld.c 954 3
1980/02/05 08:19:38 17138 ####END myhelloworld.c 957 3
Thanks
 "

Hi Mahesh,
Thanks for your reply.
We used the jsoncheck() function provided by you as it is in a sample application and able to see the crash in the  JSONGen_PutKey() function.
In further analysis of the issue we found that the crash is happening due to the std_*****()  APIs calls from JSON libs.

nStatus = JSONGen_PutKey(&gen, "value", 5);   (Crashing with this call).

Internally the following std_s******() functions were referenced  from JSON libraries.

 
C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_Dtor':c:\p4c\json-main-build\json\src/jsgen.c:34: undefined reference to `std_memset'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `AssertSpaceFor':c:\p4c\json-main-build\json\src/jsgen.c:60: undefined reference to `std_memmove'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `PutStr':c:\p4c\json-main-build\json\src/jsgen.c:98: undefined reference to `std_strlen'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutInt':c:\p4c\json-main-build\json\src/jsgen.c:211: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutUInt':c:\p4c\json-main-build\json\src/jsgen.c:228: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutDouble':c:\p4c\json-main-build\json\src/jsgen.c:245: undefined reference to `std_snprintf'

 

So to cross check the crash with std functions we called the std_strlen(), std_strncmp() directly in our code and observed  that each call is crashing in QRD6240/6270 device.

 

Here is the code for your reference.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

static
 
void

jsoncheck(jsonapp *me)
{
JSONGen gen = {0};

 
int
nErr=AEE_EFAILED;
 

char
szBuf[256];
 

const char
*psz;
 

int
nSize;
 

const char
* mystring;
DBGPRINTF(

"####START STD LIB test"
);
mystring = STRDUP(

"{}"
);
nSize = STRLEN(mystring);
DBGPRINTF(

"####START STD LIB STRLEN %d"
, nSize );
nSize = std_strlen(mystring);  // This is crashing in QRD 6240/6270 device.

DBGPRINTF(
"####START STD LIB std_strlen %d"
, nSize );
 

if (0 != std_strncmp(mystring, "{}"
, nSize)) {
DBGPRINTF(

"####IF- JSONGen_GetJSON"
);
}

else
{
DBGPRINTF(

"####ELSE- JSONGen_GetJSON"
);
}
DBGPRINTF(

"####START"
);
JSONGen_Ctor(&gen, 0,0, JSONGen2_ReallocFunc, (

void
*)me->pIEnv);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF(

"#######JSONGen_BeginObject=%d"
,nErr);

 

 
So finally the issue is with A1std lib we linked in MAKE file to generate the application MOD file. 

#armgcc_Debug settingsifeq ($(V), armgcc_Debug)jsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsongenjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsonparserjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/system/lib/armgcc_Debug/a1stdDEFINES+=_DEBUGendif
A) JSON libs were taken from the following path and copied to 1.0.3.956  path.
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.4.433 Pro\platform\languages\lib\armgcc_Debug
B) A1std lib taken from
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.3.956 Pro\platform\system\lib\armgcc_Debug
C)  SDK version used to generate MOD file is  1.0.3.956 (Code sourcery - Debug)
D)  SDK version present in the device is 1.0.3.916
 
So please let me know what might be the issue with the A1std lib we are using  in build. 
 
Thanks & Regards,
Anjani.
 
 
 
 
 
 
 
 

Hi Mahesh,
Thanks for your reply.
We used the jsoncheck() function provided by you as it is in a sample application and able to see the crash in the  JSONGen_PutKey() function.
In further analysis of the issue we found that the crash is happening due to the std_*****()  APIs calls from JSON libs.

nStatus = JSONGen_PutKey(&gen, "value", 5);   (Crashing with this call).

Internally the following std_s******() functions were referenced  from JSON libraries.

 
C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_Dtor':c:\p4c\json-main-build\json\src/jsgen.c:34: undefined reference to `std_memset'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `AssertSpaceFor':c:\p4c\json-main-build\json\src/jsgen.c:60: undefined reference to `std_memmove'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `PutStr':c:\p4c\json-main-build\json\src/jsgen.c:98: undefined reference to `std_strlen'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutInt':c:\p4c\json-main-build\json\src/jsgen.c:211: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutUInt':c:\p4c\json-main-build\json\src/jsgen.c:228: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutDouble':c:\p4c\json-main-build\json\src/jsgen.c:245: undefined reference to `std_snprintf'

 

So to cross check the crash with std functions we called the std_strlen(), std_strncmp() directly in our code and observed  that each call is crashing in QRD6240/6270 device.

 

Here is the code for your reference.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

static
 
void

jsoncheck(jsonapp *me)
{
JSONGen gen = {0};

 
int
nErr=AEE_EFAILED;
 

char
szBuf[256];
 

const char
*psz;
 

int
nSize;
 

const char
* mystring;
DBGPRINTF(

"####START STD LIB test"
);
mystring = STRDUP(

"{}"
);
nSize = STRLEN(mystring);
DBGPRINTF(

"####START STD LIB STRLEN %d"
, nSize );
nSize = std_strlen(mystring);  // This is crashing in QRD 6240/6270 device.

DBGPRINTF(
"####START STD LIB std_strlen %d"
, nSize );
 

if (0 != std_strncmp(mystring, "{}"
, nSize)) {
DBGPRINTF(

"####IF- JSONGen_GetJSON"
);
}

else
{
DBGPRINTF(

"####ELSE- JSONGen_GetJSON"
);
}
DBGPRINTF(

"####START"
);
JSONGen_Ctor(&gen, 0,0, JSONGen2_ReallocFunc, (

void
*)me->pIEnv);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF(

"#######JSONGen_BeginObject=%d"
,nErr);

 

 
So finally the issue is with A1std lib we linked in MAKE file to generate the application MOD file. 

#armgcc_Debug settingsifeq ($(V), armgcc_Debug)jsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsongenjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsonparserjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/system/lib/armgcc_Debug/a1stdDEFINES+=_DEBUGendif
A) JSON libs were taken from the following path and copied to 1.0.3.956  path.
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.4.433 Pro\platform\languages\lib\armgcc_Debug
B) A1std lib taken from
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.3.956 Pro\platform\system\lib\armgcc_Debug
C)  SDK version used to generate MOD file is  1.0.3.956 (Code sourcery - Debug)
D)  SDK version present in the device is 1.0.3.916
 
So please let me know what might be the issue with the A1std lib we are using  in build. 
 
Thanks & Regards,
Anjani.
 
 
 
 
 
 
 
 

Hi Mahesh,
Thanks for your reply.
We used the jsoncheck() function provided by you as it is in a sample application and able to see the crash in the  JSONGen_PutKey() function.
In further analysis of the issue we found that the crash is happening due to the std_*****()  APIs calls from JSON libs.

nStatus = JSONGen_PutKey(&gen, "value", 5);   (Crashing with this call).

Internally the following std_s******() functions were referenced  from JSON libraries.

 
C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_Dtor':c:\p4c\json-main-build\json\src/jsgen.c:34: undefined reference to `std_memset'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `AssertSpaceFor':c:\p4c\json-main-build\json\src/jsgen.c:60: undefined reference to `std_memmove'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `PutStr':c:\p4c\json-main-build\json\src/jsgen.c:98: undefined reference to `std_strlen'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutInt':c:\p4c\json-main-build\json\src/jsgen.c:211: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutUInt':c:\p4c\json-main-build\json\src/jsgen.c:228: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutDouble':c:\p4c\json-main-build\json\src/jsgen.c:245: undefined reference to `std_snprintf'

 

So to cross check the crash with std functions we called the std_strlen(), std_strncmp() directly in our code and observed  that each call is crashing in QRD6240/6270 device.

 

Here is the code for your reference.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

static
 
void

jsoncheck(jsonapp *me)
{
JSONGen gen = {0};

 
int
nErr=AEE_EFAILED;
 

char
szBuf[256];
 

const char
*psz;
 

int
nSize;
 

const char
* mystring;
DBGPRINTF(

"####START STD LIB test"
);
mystring = STRDUP(

"{}"
);
nSize = STRLEN(mystring);
DBGPRINTF(

"####START STD LIB STRLEN %d"
, nSize );
nSize = std_strlen(mystring);  // This is crashing in QRD 6240/6270 device.

DBGPRINTF(
"####START STD LIB std_strlen %d"
, nSize );
 

if (0 != std_strncmp(mystring, "{}"
, nSize)) {
DBGPRINTF(

"####IF- JSONGen_GetJSON"
);
}

else
{
DBGPRINTF(

"####ELSE- JSONGen_GetJSON"
);
}
DBGPRINTF(

"####START"
);
JSONGen_Ctor(&gen, 0,0, JSONGen2_ReallocFunc, (

void
*)me->pIEnv);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF(

"#######JSONGen_BeginObject=%d"
,nErr);

 

 
So finally the issue is with A1std lib we linked in MAKE file to generate the application MOD file. 

#armgcc_Debug settingsifeq ($(V), armgcc_Debug)jsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsongenjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsonparserjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/system/lib/armgcc_Debug/a1stdDEFINES+=_DEBUGendif
A) JSON libs were taken from the following path and copied to 1.0.3.956  path.
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.4.433 Pro\platform\languages\lib\armgcc_Debug
B) A1std lib taken from
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.3.956 Pro\platform\system\lib\armgcc_Debug
C)  SDK version used to generate MOD file is  1.0.3.956 (Code sourcery - Debug)
D)  SDK version present in the device is 1.0.3.916
 
So please let me know what might be the issue with the A1std lib we are using  in build. 
 
Thanks & Regards,
Anjani.
 
 
 
 
 
 
 
 

Hi Mahesh,
Thanks for your reply.
We used the jsoncheck() function provided by you as it is in a sample application and able to see the crash in the  JSONGen_PutKey() function.
In further analysis of the issue we found that the crash is happening due to the std_*****()  APIs calls from JSON libs.

nStatus = JSONGen_PutKey(&gen, "value", 5);   (Crashing with this call).

Internally the following std_s******() functions were referenced  from JSON libraries.

 
C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_Dtor':c:\p4c\json-main-build\json\src/jsgen.c:34: undefined reference to `std_memset'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `AssertSpaceFor':c:\p4c\json-main-build\json\src/jsgen.c:60: undefined reference to `std_memmove'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `PutStr':c:\p4c\json-main-build\json\src/jsgen.c:98: undefined reference to `std_strlen'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutInt':c:\p4c\json-main-build\json\src/jsgen.c:211: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutUInt':c:\p4c\json-main-build\json\src/jsgen.c:228: undefined reference to `std_snprintf'C:/PROGRA~1/Qualcomm/BREWMP~1/PLATFO~1/103~1.956/platform/languages/lib/armgcc_Debug/jsongen.lib(jsgen.o): In function `JSONGen_PutDouble':c:\p4c\json-main-build\json\src/jsgen.c:245: undefined reference to `std_snprintf'

 

So to cross check the crash with std functions we called the std_strlen(), std_strncmp() directly in our code and observed  that each call is crashing in QRD6240/6270 device.

 

Here is the code for your reference.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

static
 
void

jsoncheck(jsonapp *me)
{
JSONGen gen = {0};

 
int
nErr=AEE_EFAILED;
 

char
szBuf[256];
 

const char
*psz;
 

int
nSize;
 

const char
* mystring;
DBGPRINTF(

"####START STD LIB test"
);
mystring = STRDUP(

"{}"
);
nSize = STRLEN(mystring);
DBGPRINTF(

"####START STD LIB STRLEN %d"
, nSize );
nSize = std_strlen(mystring);  // This is crashing in QRD 6240/6270 device.

DBGPRINTF(
"####START STD LIB std_strlen %d"
, nSize );
 

if (0 != std_strncmp(mystring, "{}"
, nSize)) {
DBGPRINTF(

"####IF- JSONGen_GetJSON"
);
}

else
{
DBGPRINTF(

"####ELSE- JSONGen_GetJSON"
);
}
DBGPRINTF(

"####START"
);
JSONGen_Ctor(&gen, 0,0, JSONGen2_ReallocFunc, (

void
*)me->pIEnv);
nErr = JSONGen_BeginObject(&gen);
DBGPRINTF(

"#######JSONGen_BeginObject=%d"
,nErr);

 

 
So finally the issue is with A1std lib we linked in MAKE file to generate the application MOD file. 

#armgcc_Debug settingsifeq ($(V), armgcc_Debug)jsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsongenjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/languages/lib/armgcc_Debug/jsonparserjsonapp_LIBS += $(BREWMP_PLATFORM_DIR)/system/lib/armgcc_Debug/a1stdDEFINES+=_DEBUGendif
A) JSON libs were taken from the following path and copied to 1.0.3.956  path.
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.4.433 Pro\platform\languages\lib\armgcc_Debug
B) A1std lib taken from
Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.3.956 Pro\platform\system\lib\armgcc_Debug
C)  SDK version used to generate MOD file is  1.0.3.956 (Code sourcery - Debug)
D)  SDK version present in the device is 1.0.3.916
 
So please let me know what might be the issue with the A1std lib we are using  in build. 
 
Thanks & Regards,
Anjani.
 
 
 
 
 
 
 
 

I used ARM compliler and found no crash with std_strlen and std_strncmp , looks like you are seeing issue using codesourcery library A1std.lib
I would suggest to use STRLEN() and STRNCMP instead.

I used ARM compliler and found no crash with std_strlen and std_strncmp , looks like you are seeing issue using codesourcery library A1std.lib
I would suggest to use STRLEN() and STRNCMP instead.

Hi Mahesh,
Even when we use STRLEN() and STRNCMP() functions the crash is happened.  Our initial ussage is with these functions then we found the crash happenning and we have switched to use a1std.lib. Even we have tried hardcoding the lenghth of that string parameter, even then the crash is happenning.
Thank you,
Anjani

Hi Mahesh,
Even when we use STRLEN() and STRNCMP() functions the crash is happened.  Our initial ussage is with these functions then we found the crash happenning and we have switched to use a1std.lib. Even we have tried hardcoding the lenghth of that string parameter, even then the crash is happenning.
Thank you,
Anjani

Hi Mahesh,
Even when we use STRLEN() and STRNCMP() functions the crash is happened.  Our initial ussage is with these functions then we found the crash happenning and we have switched to use a1std.lib. Even we have tried hardcoding the lenghth of that string parameter, even then the crash is happenning.
Thank you,
Anjani

Hi Mahesh,
Even when we use STRLEN() and STRNCMP() functions the crash is happened.  Our initial ussage is with these functions then we found the crash happenning and we have switched to use a1std.lib. Even we have tried hardcoding the lenghth of that string parameter, even then the crash is happenning.
Thank you,
Anjani

As per your saying if you are seeing issue even not using these functions and hard coding the string length values, i don't think the issue is with these functions. Can you try using ARM complier instead? In the mean time I am trying to build with code sourcery.

As per your saying if you are seeing issue even not using these functions and hard coding the string length values, i don't think the issue is with these functions. Can you try using ARM complier instead? In the mean time I am trying to build with code sourcery.

Hi Mahesh,
Thnak you. since we don not have any ARM complier we are using code sourcery.

Hi Mahesh,
Thnak you. since we don not have any ARM complier we are using code sourcery.

Hi Mahesh,
Are you able to build the same with code sourecery and successfully run the app?
 
Thnak you,
Anjani

Hi Mahesh,
Are you able to build the same with code sourecery and successfully run the app?
 
Thnak you,
Anjani

Hi Mahesh,
Are you able to build the same with code sourecery and successfully run the app?
 
Thnak you,
Anjani

Hi Mahesh,
Are you able to build the same with code sourecery and successfully run the app?
 
Thnak you,
Anjani

I couldn't find ARMGCC version of json libraries(only ARM, RVCT and WIN are avialble), it is not avaialble in any of installed plateforms with me.

I couldn't find ARMGCC version of json libraries(only ARM, RVCT and WIN are avialble), it is not avaialble in any of installed plateforms with me.

armgcc version of json libraries are available in the version 1.0.4.433 Pro SDK.

armgcc version of json libraries are available in the version 1.0.4.433 Pro SDK.

armgcc version of json libraries are available in the version 1.0.4.433 Pro SDK.

armgcc version of json libraries are available in the version 1.0.4.433 Pro SDK.

These libraries are supported in 1.0.4 onwards and may be running on 1.0.2 device it is not working. Please use ARM/RVCT version of libs uisng ARM/RVCT compiler.

These libraries are supported in 1.0.4 onwards and may be running on 1.0.2 device it is not working. Please use ARM/RVCT version of libs uisng ARM/RVCT compiler.