delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/21/11:02:55

Sender: crough45 AT amc DOT de
Message-Id: <97Aug21.165252gmt+0100.17025@internet01.amc.de>
Date: Thu, 21 Aug 1997 15:56:36 +0100
From: Chris Croughton <crough45 AT amc DOT de>
Mime-Version: 1.0
To: bokovoy AT bspu DOT ac DOT by
Cc: djgpp AT delorie DOT com
Subject: Re: SIGSEGV or SIGABRT during execution

Alexander Bokovoy wrote:

> Debugging shows that error occures in the next line:
>
>  KeyWord=new char[strlen(keyword)]; // Create and fill key field

At a rough guess, 'keyword' is pointing to something which is not
a string terminated by a zero byte.  Although your constructor
tests for 'keyword' not being a null pointer, it does't test that
it points to real memory (nor can it in a portable way).

Try running it under gdb or another debugger, and get a backtrace
(stack dump) to see what the value of 'keyword' is being passed 
in.  gdb will also allow you to do 'up' to go up to the next level
in the stack and then inspect variables there.

It also helps to run 'symify' after the fault, that will give
the actual code and file/line positions for the EIPs.  (You may
have already done that - you didn't copy that information into
your message, however.)

As a stylistic point, having two variables of which the names 
differ only in case (keyword and KeyWord) is generally regarded
as a bad thing, because it's easy to get confused.  (Having said
that, it's something I often do as well <g>...)

Chris C

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019