Setting future conditional breakpoints using --command

I’m trying to set a conditional breakpoint, but the condition depends on a local device variable. So I put ‘set breakpoint pending on’ in the gdb script. I also put ‘show breakpoint pending’ right after it, and the setting is actually on.

Using --command to load the gdb script results in ‘No symbol “i” in current context.
Make conditional breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]’
If I remove the condition, the breakpoint is used correctly.
If I manually add the breakpoint before running, and answer yes on whether gdb should make the breakpoint pending, it works correctly.
The old GCC or Ubuntu could explain it.

Setup:
CUDA 7.5, gcc 4.9.2, Ubuntu 7.9

Compile command:

nvcc -G -g main.cu

Debug command:

cuda-gdb a.out --command script_gdb

Script:

set breakpoint pending on
show breakpoint pending
break main.cu:8 if i == 3

run

main.cpp:

#include <stdio.h>

__global__ void kernel(double *x){
	double sum = 0.0;
	for(int i = 0; i < 5; ++i){
		sum += x[i];
	}
	x[0] = sum;
}

int main(){

	double x[] = {1, 2, 3, 4, 5}, *d_x;

	cudaSetDevice(0);
	cudaMalloc((void**)&d_x, sizeof(double)*5);
	cudaMemcpy(d_x, x, sizeof(double)*5, cudaMemcpyHostToDevice);

	kernel<<<1, 1>>>(d_x);
	cudaDeviceSynchronize();

	cudaMemcpy(x, d_x, sizeof(double)*5, cudaMemcpyDeviceToHost);

	for(int i = 0; i < 5; ++i){
		printf("x[%d]: %f\n", i, x[i]);
	}

	cudaFree(d_x);

	return 0;
}

cuda-gdb output:

...
Reading symbols from /home/test/a.out...done.
Debugger's behavior regarding pending breakpoints is on.
No symbol "i" in current context.
Make conditional breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
...