garmintools on FreeBSD 8.1

slaney

New Member


Messages: 2

Hello,

I have gotten garmintools (http://code.google.com/p/garmintools/) to compile and work on FreeBSD 8.1, however I had to hard code a path in the source to make it work, and was hoping someone here might be able to give me some ideas for why the original source isn't working.

After changing the configure script to not rely on libusb-config, the source compiles and installs with a make/make install.

However it seg faults when you run `garmin_save_runs`.

Code:
# garmin_save_runs 
Extracting data from Garmin Forerunner305 Software Version 2.90
Segmentation fault: 11 (core dumped)
Firing up gdb, I can see where the problem is:

Code:
#4  0x000000080065de63 in garmin_save_runs (garmin=0x7fffffffea90) at run.c:219
That line is:

Code:
printf("Files will be saved in '%s'\n",filedir);

The prototype, and assignment of filedir/path are:

Code:
  char *              filedir = NULL;
  char                path[PATH_MAX];
Code:
  if ( filedir == NULL ) {
    filedir = getcwd(path,sizeof(path));
  }
And if I set a breakpoint and attempt to dump either filedir or path, I get some weird behavior:

Code:
Breakpoint 1, garmin_save_runs (garmin=0x7fffffffea90) at run.c:219
219       printf("Files will be saved in '%s'\n",filedir);
(gdb) p filedir
$3 = 0xffffffffffffe230 <Error reading address 0xffffffffffffe230: Bad address>
(gdb) p path
$4 = "/root\000\000\000\001", '\0' <repeats 15 times>, "\\ZP\000\b\000\000\0002é6
\n\000\000\000\000\001\000\000\000\000\000\000\0000\000S\000\b", '\0' <repeats 
15 times>, "\b\000\002\000\000\000\000\000\000\000\000\000\200ãÿÿÿ\177\000\000gO
\226\000\b\000\000\000Øãÿÿÿ\177\000\000\bäÿÿÿ\177\000\000\000\000\000\000\000
\000\000\000gO\226\000\b\000\000\000øãÿÿÿ\177\000\000(äÿÿÿ\177\000\000\000
\000\000\000\000\000\000\000øãÿÿÿ\177\000\000u\000\000\000\000\000\000\0000B
\227\000\b\000\000\000\001\000\000\000\000\000\000\000\001\000\000\000\000\000
\000\000 çÿÿÿ\177\000\000[\203\225\000\b\000\000\000\t\000"...
I tried just creating a little C file that used getcwd() to see if I could get the same behavior, but I can not.

If I just comment out all that other stuff, and put 'filedir = "/tmp/foo";', it works fine.

I am not a C programmer by any stretch, so I was hoping maybe someone here had some ideas as to what might cause this.

Thanks!
 

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 2,793
Messages: 11,286

[ bump, was stuck in mod queue ]
 
Top