[GRASS-dev] g.region -g crashes in a latlon location

Maciej Sieczka tutey at o2.pl
Mon Jul 21 07:00:01 EDT 2008


Glynn Clements pisze:
> Maciej Sieczka wrote:
> 
>>> In any case, this doesn't help identify the real problem. Can you
>>> step through the g.region code from the beginning and find where in 
>>> g.region (or the GRASS libraries) that it's going out of control?
>> If you can tell how to do it I'd try.
> 
> $ gdb g.region
>> break main
>> run -g
> Starting program: /usr/local/src/grass/svn/dist.i686-pc-linux-gnu/bin/g.region -g
> ...
> Breakpoint 1, main (argc=2, argv=0xbfc241a4) at main.c:31
> 31		int print_flag = 0;
>> next
> 35		int row_flag=0, col_flag=0;
> 
> Then keep pressing Return (which repeats the last command) until it
> crashes.

Here's the result:

873		if (print_flag)
(gdb)
874		    print_window (&window, print_flag);
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x00007f3fa74b369e in sincos (val=0.90594848802138783, 
sin_val=0x7fffb0ac7040, cos_val=0x7fffb0ac7038) at GDapi.c:6265
6265	    *sin_val = sin(val);
(gdb)

> The crash will probably have occured during a call to some library
> function. Set a breakpoint on that function ("break <name>") then type
> "run -g" to start again. When it hits the first breakpoint (main),
> type "cont". When it hits the second breakpoint, start single-stepping
> (next, Return, Return ...) until it crashes.

So I did:

(gdb) break print_window
Breakpoint 2 at 0x404380: file printwindow.c, line 9.

	<snip>

D3/10: region item: t-b resol:  1
D3/10: G_adjust_Cell_head: epsilon_ns: 8.32639e-07, epsilon_ew: 1e-06
D3/10: G_adjust_Cell_head: epsilon_ns: 8.32639e-07, epsilon_ew: 1e-06

Breakpoint 2, print_window (window=0x7fffd3fd5fe0, print_flag=3) at 
printwindow.c:9
9	{
(gdb) next
20	    if (print_flag & PRINT_SH)
(gdb)
9	{
(gdb)
20	    if (print_flag & PRINT_SH)
(gdb)
25	    G_format_northing(window->north, north, x);
(gdb)
26	    G_format_northing(window->south, south, x);
(gdb)
27	    G_format_easting(window->east, east, x);
(gdb)
28	    G_format_easting(window->west, west, x);
(gdb)
29	    G_format_resolution(window->ew_res, ewres, x);
(gdb)
30	    G_format_resolution(window->ew_res3, ewres3, x);
(gdb)
31	    G_format_resolution(window->ns_res, nsres, x);
(gdb)
32	    G_format_resolution(window->ns_res3, nsres3, x);
(gdb)
33	    G_format_resolution(window->tb_res, tbres, x);
(gdb)
34	    G_begin_distance_calculations();
(gdb)
37	    ew_dist1 =
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x00007fa1ca1c369e in sincos (val=0.90594848802138783, 
sin_val=0x7fffd37d7030, cos_val=0x7fffd37d7028) at GDapi.c:6265
6265	    *sin_val = sin(val);
(gdb)

> Repeat this procedure until the crash occurs on a statement which
> either isn't a function call or which isn't a GRASS function.

I don't know how to tell the difference.

Maciek

-- 
Maciej Sieczka
www.sieczka.org


More information about the grass-dev mailing list