diff options
author | Joel Brobecker <brobecker@gnat.com> | 2009-04-16 17:16:18 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2009-04-16 17:16:18 +0000 |
commit | f9bc20b9bed700cb200d59ef8afb4745ad6bfc0f (patch) | |
tree | ed5e86f1d37237e761e981362b5762be173f272a /gdb/ada-lang.c | |
parent | 34adf976079a1903e0b513410889588ba7d90ec4 (diff) | |
download | gdb-f9bc20b9bed700cb200d59ef8afb4745ad6bfc0f.zip gdb-f9bc20b9bed700cb200d59ef8afb4745ad6bfc0f.tar.gz gdb-f9bc20b9bed700cb200d59ef8afb4745ad6bfc0f.tar.bz2 |
* ada-lang.c (extract_string): Delete.
(ada_main_name): Reimplement using target_read_string instead of
extract_string.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 54f2590..814a793 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -679,8 +679,7 @@ char * ada_main_name (void) { struct minimal_symbol *msym; - CORE_ADDR main_program_name_addr; - static char main_program_name[1024]; + static char *main_program_name = NULL; /* For Ada, the name of the main procedure is stored in a specific string constant, generated by the binder. Look for that symbol, @@ -691,11 +690,19 @@ ada_main_name (void) if (msym != NULL) { + CORE_ADDR main_program_name_addr; + int err_code; + main_program_name_addr = SYMBOL_VALUE_ADDRESS (msym); if (main_program_name_addr == 0) error (_("Invalid address for Ada main program name.")); - extract_string (main_program_name_addr, main_program_name); + xfree (main_program_name); + target_read_string (main_program_name_addr, &main_program_name, + 1024, &err_code); + + if (err_code != 0) + return NULL; return main_program_name; } |