Oh, I was playing about with this earlier, but didn't get all that far: I go this far in svn.c (has breakpoint marker in it)
[[[ int main(int argc, char **argv) { apr_pool_t *pool; int exit_code = EXIT_SUCCESS; svn_error_t *err; const char **argv_org; /* Initialize the app. */ if (svn_cmdline_init("svn", stderr) != EXIT_SUCCESS) return EXIT_FAILURE; /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); { int i; argv_org = apr_palloc(pool, sizeof(argv)); B for(i = 0; i < argc; i++) { argv_org[i] = apr_pstrdup(pool, argv[i]); if (i > 2 && !strcmp(argv[i-1],"--password")) { argv[i-1] = "#####\0"; } if (i > 2 && !strcmp(argv[i-1],"--username")) { argv[i-1] = "#####\0"; } } } ]]] it compiles and runs and in gdb the vars do change, but the compiler isn't happy: subversion/svn/svn.c: In function 'main': subversion/svn/svn.c:3048:23: warning: assignment discards 'const' qualifier from pointer target type [enable\ d by default] argv[i-1] = "#####\0"; ^ subversion/svn/svn.c:3052:23: warning: assignment discards 'const' qualifier from pointer target type [enable\ d by default] argv[i-1] = "#####\0"; At breakpoint B, gdb gives me: (gdb) p argv $1 = (char **) 0x7fffffffe468 (gdb) p argv[1] $2 = 0x7fffffffe81e "svn" (gdb) p argv[2] $3 = 0x7fffffffe822 "help" (gdb) p argv[3] $4 = 0x4438b3 "#####" (gdb) So it def. does change it. On Fri, Jul 4, 2014 at 12:40 AM, Ben Reser <b...@reser.org> wrote: > On 7/3/14 4:23 PM, Gabriela Gibson wrote: > > Could that be because of the libtool svn-lt script that sits in the > middle? > > Because in gdb it does change, but not in ps. > > No because I wasn't even doing anything with Subversion yet let alone > libtool. > It was just a very basic C program with nothing more than a main. It's > probably because the argv array belongs to the process itself and then it > points to memory that the kernel owns (or at least watches). I'm not sure > on > all the details of how the kernel starts the binary and passes in the > arguments. > > I've attached the example I was working with that didn't make it to this > list > already. > > -- Visit my Coding Diary: http://gabriela-gibson.blogspot.com/