Revision 74c33bed

b/linux-user/main.c
978 978
           "Linux CPU emulator (compiled for %s emulation)\n"
979 979
           "\n"
980 980
           "-h           print this help\n"
981
           "-g           wait gdb connection to port %d\n"
981
           "-g port      wait gdb connection to port\n"
982 982
           "-L path      set the elf interpreter prefix (default=%s)\n"
983 983
           "-s size      set the stack size in bytes (default=%ld)\n"
984 984
           "\n"
......
989 989
           "-d options   activate log (logfile=%s)\n"
990 990
           "-p pagesize  set the host page size to 'pagesize'\n",
991 991
           TARGET_ARCH,
992
           DEFAULT_GDBSTUB_PORT,
993 992
           interp_prefix, 
994 993
           x86_stack_size,
995 994
           DEBUG_LOGFILE);
......
1013 1012
    CPUState *env;
1014 1013
    int optind;
1015 1014
    const char *r;
1016
    int use_gdbstub = 0;
1015
    int gdbstub_port = 0;
1017 1016
    
1018 1017
    if (argc <= 1)
1019 1018
        usage();
......
1068 1067
                exit(1);
1069 1068
            }
1070 1069
        } else if (!strcmp(r, "g")) {
1071
            use_gdbstub = 1;
1070
            gdbstub_port = atoi(argv[optind++]);
1072 1071
        } else 
1073 1072
#ifdef USE_CODE_COPY
1074 1073
        if (!strcmp(r, "no-code-copy")) {
......
1247 1246
#error unsupported target CPU
1248 1247
#endif
1249 1248

  
1250
    if (use_gdbstub) {
1251
        gdbserver_start (DEFAULT_GDBSTUB_PORT);
1249
    if (gdbstub_port) {
1250
        gdbserver_start (gdbstub_port);
1252 1251
        gdb_handlesig(env, 0);
1253 1252
    }
1254 1253
    cpu_loop(env);

Also available in: Unified diff