存储过程中的核心转储

时间:2012-02-15 11:01:53

标签: c++ solaris sybase

我正在从c ++执行存储过程,如下所示:

  dbsqlexec(_bsmdb);

当我从命令行执行存储过程时,它给了我正确的输出。

2> declare @apicounter int
exec CapApi_CountTgRxObjects @apicounter output, 'subnetwork="NETSim_BAG",bsc=3> "BAG01",site="RS8000#0",mo="RXOTG-0",%'
4> go
(return status = 0)

Return parameters:


 -----------
           9


(1 row affected)

但在c ++代码中,它给了我核心转储。

以下是存储过程。

CREATE PROCEDURE CapApi_CountTgRxObjects (@count_out int output,@tgdn_in varchar
         (200))
AS
BEGIN
    declare @likeGE varchar(200),
            @likeLT varchar(200),
            @rc int

    /*
    ** Build the simulated like strings
    */
    exec @rc =
 CapApi_likeFix @likeStr=@tgdn_in, @likeGE=@likeGE OUT, @likeLT=@likeLT OUT

    if (@rc != 0)
    begin
        return 1
    end

    /*
    ** Execute the Worker procedure
    */
    exec CapApi_CountTgRxObjectsW @count_out=@count_out OUT, @tgdn_GE=@like
 GE, @tgdn_LT=@likeLT

    /*
    ** Normal exit point
    */
    return 0
END




(3 rows affected)
(return status = 0)

核心追踪如下:

-----------------  lwp# 1 / thread# 1  --------------------
 fcb16576 t_splay  (140e6958) + 1f
 fcb16454 t_delete (140e6958) + 2a
 fcb1618e realfree (140e6918) + 58
 fcb16797 cleanfree (0) + 44
 fcb15cb3 _malloc_unlocked (8, 83df9d0, 140e68c8, fc4df378, 802a988, fc44ee9b) + ad
 fcb15bdc malloc   (4) + 34
 fc44ee9b comn_malloc (4) + 1b
 fc438012 dbsvretval (83df9d0) + 3f6
 fc4369c5 dbsqlok  (83df9d0) + 115
 fc436668 dbsqlexec (83df9d0, 0) + 30
 fec1c19f __1cICACCC_tgWCheck_BTS_capabilities6FrnGcna_Mo_ri_v_ (802c24c, 821cc40) + 3ff
 fec1d4a2 __1cICACCC_tgOPerform_checks6FrnGcna_Mo_ri_v_ (802c24c, 821cc40) + 272
 fec16953 __1cICACCC_tgNDirect_checks6FrknGvector4CpnGcna_MO___rikikb_v_ (802c2b8, 821cc40, 2, 0, 0, 0) + 3c3
 feaa760d __1cJCACCC_bscNDirect_checks6FpnTCACCC_consist_check_rknGvector4CpnGcna_MO___rikikbrfkf_v_ (821cc28, 802c4b0, 821cc40, 2, 0, 821cc54) + 64d
 fe9b25ae __1cTCACCC_consist_checkJcheck_bsc6M_v_ (821cc28, 0) + 17e
 fe9ac7de __1cTCACCC_consist_checkNcheck_perform6M_i_ (821cc28, 0) + 14e
 fe9acd2b __1cTCACCC_consist_checkFcheck6M_i_ (821cc28, 0) + 9b
 0805c656 main     (2, 802d1ac, 802d1b8, 802d1a0) + 11a6
 08051ebd _start   (2, 802d95c, 802d97d, 0, 802d993, 802d9cb) + 7d
-----------------  lwp# 2 / thread# 2  --------------------
 fcb7ae55 ___nanosleep (78) + 15
 fd52a4c2 run      (821f668) + 1a2
 fcb7875b _thr_setup (fc040200) + 4e
 fcb78a60 _lwp_start (fc040200, 0, 0, fbffeff8, fcb78a60, fc040200)

有人可以帮我找到问题.....

2 个答案:

答案 0 :(得分:0)

看起来您的堆已损坏(它在malloc的免费商店管理代码中消失,而不是与DB相关的任何内容。

尝试使用内存检查工具来识别堆损坏的时间(例如,如果你有它,请使用Purify,或者IIRC Solaris有一个直接替换调试malloc lib)。

这是一个C ++错误,与存储过程无关。

答案 1 :(得分:0)

尝试使用libumem,如果它是由于双重删除而导致损坏,则可以很容易地找到它。链接在这里。 http://developers.sun.com/solaris/articles/libumem_library.html

您甚至不需要重新编译代码,只需定义启动脚本中链接中提到的变量即可。