[Crash-utility] sig -g and foreach sig -g

Dave Anderson anderson at redhat.com
Tue Oct 10 13:07:03 UTC 2006


Olivier Daudel wrote:

> Hello Dave,
>
> I think sig -g is quite OK.
> I have a problem with foreach sig -g.
> If i use malloc() and free(), it seems to work (may be the algorithmic is
> OK).
> I have tryed to use hashing on tgid to control if we have already displayed
> it.
> If i use GETBUF() and FREEBUF(), it crashes.
> May be i don't understant some conditions in using GETBUF() and FREEBUF() ?
>
> Thanks for any suggestion.

Hi Olivier,

Thanks for the update -- I'll take a look at the patch.

I don't understand off-hand why it would crash with GETBUF()/FREEBUF().
Using malloc/free for temporary buffers has always been a potential
problem because the command can be interrupted mid-stream, and
when that happens, it longjmp()'s back to the main loop, and the memory
is leaked.

GETBUF() is preferred over the malloc() of temporary per-command buffers
because even if you forget to do the FREEBUF(), it will be called automatically
prior to the next command.  In other words, the buffer returned from any
GETBUF() call can only be used for a single command, because the
buffer(s) will be subsequently freed in restore_sanity(), which is executed
just prior to the next command line being accessed.

Anyway, I'll take in your sig command changes, and see what I can do
about the foreach part.

Thanks again,
  Dave


>
>
>   ------------------------------------------------------------------------------------------------------------------------
>                 Name: sig.patch
>    sig.patch    Type: unspecified type (application/octet-stream)
>             Encoding: quoted-printable
>
>   ------------------------------------------------------------------------------------------------------------------------
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility




More information about the Crash-utility mailing list