Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-user] debugging locally with PTP synchronized project

On Friday 20 March 2015 10:22:00 Greg Watson <g.watson@xxxxxxxxxxxx> wrote:

> The sdm tries to parse the gdb version. You could check the

> CLIGetGDBVersion() function here:

> https://git.eclipse.org/c/ptp/org.eclipse.ptp.git/tree/debug/org.eclipse.pt

> p.debug.sdm/libmi/CLIOutput.c

>

> Greg

 

Greg,

 

actually, the above code snippet looks innocent to me.

 

		/*
		 * Linux: GUN gdb 6.5.0
		 * Fedora: GNU gdb Red Hat Linux (6.5-8.fc6rh)
		 * Mac OS X: GNU gdb 6.1-20040303 (Apple version gdb-384) (Mon Mar 21 00:05:26 GMT 2005)
		 * Ubuntu: GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2
		 */
		if (strncmp(text, "GNU gdb", 7) == 0) {
			/*
			 * bypass "GNU gdb"
			 */
			text += 8;

			/*
			 * find first digit
			 */
			while (*text != '\0' && !isdigit(*text))
				text++;

			/*
			 * Convert whatever is here to a double
			 */
			if (*text != '\0')
				return strtod(text, NULL);
		}
	}
	return -1.0;

"text" should have the value "GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1"

prior to the first strncmp, "7.7.1-0ubuntu5~14.04.2) 7.7.1" when passed to

strtod(). To check that this works OK, I wrote the following C program.

 

cp@sirius:~/strtod_test$ cat strtod_test.c

#include <stdio.h>

#include <stdlib.h>

 

int main(int arrgc, char *argv[]) {

 

double res = strtod(argv[1], NULL);

 

printf("%s -> %8.2f\n", argv[1], res);

return 0;

}

cp@sirius:~/strtod_test$ strtod_test 4.5test

4.5test -> 4.50

cp@sirius:~/strtod_test$ strtod_test "7.7.1-0ubuntu5~14.04.2) 7.7.1"

7.7.1-0ubuntu5~14.04.2) 7.7.1 -> 7.70

 

To me that looks like a clean version number.

 

Please comment !

 

--

 

Mit freundlichen Grüßen / Kind regards

 

Dr. Christoph Pospiech

High Performance & Parallel Computing

Phone: +49-351 86269826

Mobile: +49-171-765 5871

E-Mail: cpospiech@xxxxxxxxxx

-----------------------------------------------------------------------------

Attention: Effective January 1st, 2015 I'm transitioning to Lenovo.

My new Email address will be: cpospiech@xxxxxxxxxx

-----------------------------------------------------------------------------

Geschäftsführung: Bernhard Fauser

Sitz der Gesellschaft: Stuttgart

HRB-Nr.: 25189, AG Stuttgart

WEEE-Reg.-Nr.: DE79679404


Back to the top