Strange debugging problem with gdb (convert.c)!!

Arvind Jagannath <[email protected]>
Newsgroups gmane.comp.video.image-magick.devel
Message-ID <[email protected]>
Hi,

I was trying to step through the convert utility code
in imagemagick 5.4.7, convert.c (& mogrify.c)

void ConvertUtility(int argc,char **argv)

I was just trying to convert a PseudoClass image into
a TrueColor, DirectClass image.

While stepping through gdb, I noticed that gdb would
step back into some lines of code which were already
executed.(its not in any sort of a loop or goto!!)

For eg., gdb would keep going back to a line
having the CloneImage() call until it got a non-NULL
image_info.

=======================================
(gdb) n
365       image_info=CloneImageInfo((ImageInfo *)
NULL);
(gdb) n
363       image=(Image *) NULL;
(gdb) p *image_info
Cannot access memory at address 0x0
(gdb) n
364       image_list=(Image *) NULL;
(gdb) 
365       image_info=CloneImageInfo((ImageInfo *)
NULL);
(gdb) 
366       (void)
strncpy(image_info->filename,argv[argc-1],MaxTextExtent-1);
(gdb) p *image_info
Cannot access memory at address 0x0
(gdb) n
365       image_info=CloneImageInfo((ImageInfo *)
NULL);
(gdb) 
366       (void)
strncpy(image_info->filename,argv[argc-1],MaxTextExtent-1);
(gdb) p *image_info
$1 = {compression = UndefinedCompression, temporary =
0, adjoin = 1, 
  affirm = 0, antialias = 1, subimage = 0, subrange =
0, depth = 16, 
  size = 0x0, tile = 0x0, page = 0x0, interlace =
NoInterlace, 
  endian = UndefinedEndian, units =
UndefinedResolution, quality = 75, 
  sampling_factor = 0x0, server_name = 0x0, font =
0x0, texture = 0x0, 
  density = 0x0, pointsize = 12, fuzz = 0, pen = {blue
= 0, green = 0, 
    red = 0, opacity = 0}, background_color = {blue =
65535, green = 65535, 
    red = 65535, opacity = 0}, border_color = {blue =
57311, green = 57311, 
    red = 57311, opacity = 0}, matte_color = {blue =
48573, green = 48573, 
    red = 48573, opacity = 0}, dither = 1, monochrome
= 0, 
  colorspace = UndefinedColorspace, type =
UndefinedType, 
  preview_type = UndefinedPreview, group = 0, ping =
0, verbose = 0, 
  debug = 0, view = 0x0, attributes = 0x0, client_data
= 0x0, fifo = 0, 
  file = 0x0, blob = 0x0, length = 0, magick = '\0'
<repeats 2052 times>, 
  unique = '\0' <repeats 2052 times>, zero = '\0'
<repeats 2052 times>, 
  filename = '\0' <repeats 2052 times>, signature =
2880220587}
(gdb) n
367       (void)
SetImageInfo(image_info,True,&exception);

=======================================

Can somebody please explain to me about what's
happening ???
I really NEED to understand this in order to be able
to proceed!!

(Its not about the convert itself but the debugging
which I'm curious about.., the conversion succeeds.)
I saw this behavior of gdb in many other parts of the
code too.


I can do the conversion easily using the cmd-line also
========================================
bash-2.05b# ./identify warning4.jpg 
identify: Unable to open file (magic.mgk).
warning4.jpg JPEG 150x55 PseudoClass 256c 8-bit 2575b
0.0u 0:01
bash-2.05b#
bash-2.05b# ./convert -type TrueColor warning4.jpg
warning8.jpg
convert: Unable to open file (delegates.mgk).
bash-2.05b#
bash-2.05b# ./identify warning8.jpg 
identify: Unable to open file (magic.mgk).
warning8.jpg JPEG 150x55 DirectClass 8-bit 2756b 0.0u
0:01
bash-2.05b# 
=====================================

Thanks in advance!!
Arvind

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.