您能告訴我代碼中是否有任何錯誤,我的應用程序正在隨機崩潰 我找不到任何可能的邏輯或內存錯誤,請幫助,因爲這將超出我的範圍。代碼中的編程/內存/邏輯問題
#define __FN__ "CGD9_gd_ParseAddFieldsProC"
int CGD9_gd_ParseAddFieldsProC (CGD_gd_ParseAddFields_Iparam_t *i_param_st_p)
{
t_gd9adfld_t *p_ext_fields_s = NULL;
t_gd9sbdat_t *p_buff =
(t_gd9sbdat_t *)(i_param_st_p->i_add_fields_st);
Trace(__FN__);
DEBUG_GD_1("\n\n Function %s - started. \n\n", __FN__);
if(*(i_param_st_p->o_add_fields) == NULL) {
ERR_Report_1(DGD_ERR_IN_FUNCTION,
__FN__ "ERROR - program will crash, input extended struct\
has not been initialized!");
ERR_Report_1(DGD_ERR_IN_FUNCTION, __FN__\
"Check that exit point CMI9_auxc_A_GUIDING_init_forProc \
is used in GD table!");
fflush(NULL);
return FAILURE;
}
p_ext_fields_s = *(i_param_st_p->o_add_fields);
memset (p_ext_fields_s, ' ', sizeof (t_gd9adfld_t));
/* Copy all extended fields from GD tables to buffer one by one*/
memcpy(&p_ext_fields_s->rowid,
&p_buff[i_param_st_p->output_index].rowid,
sizeof(p_buff[i_param_st_p->output_index].rowid));
memset(p_ext_fields_s->rowid,'0',18);
memcpy(&p_ext_fields_s->l9_legacy_prod_type,
&p_buff[i_param_st_p->output_index].l9_legacy_prod_type,
sizeof(p_ext_fields_s->l9_legacy_prod_type));
/* Free the memory allocated for extended fields */
free(i_param_st_p -> i_add_fields_st);
i_param_st_p -> i_add_fields_st = NULL;
DEBUG_GD_1("\n\n Function %s - completed successuflly. \n\n", __FN__);
return SUCCESS;
}
大多數編譯器預定義與你函數名的宏 - 通常是'__FUNCTION__'或一些接近。這至少可以讓你免於自己做這件事。 – 2010-07-18 17:51:57
你的調試器應告訴你哪一行崩潰,並給你一個回溯,找出你是怎麼到這種狀態。到目前爲止你做了什麼? – 2010-07-18 17:55:12
退出點寫在上層,從那裏我用它來創建我自己的代碼在下面的圖層。 的pstack會: ffffffff6e908e84 CGD9_gd_ParseAddFieldsProC(ffffffff427eecd8,0,1144963b0,10e318c90,1144963b0,ffffffff427ef098)+ 13C – Kimi 2010-07-18 18:14:46