| OLD | NEW |
| 1 /* Handle Native Client manifest files. | 1 /* Handle Native Client manifest files. |
| 2 | 2 |
| 3 Copyright (C) 2011 Free Software Foundation, Inc. | 3 Copyright (C) 2011 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| 11 | 11 |
| 12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
| 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 |
| 20 #include "defs.h" | 20 #include "defs.h" |
| 21 | 21 |
| 22 #include "command.h" | 22 #include "command.h" |
| 23 #include "completer.h" | 23 #include "completer.h" |
| 24 #include "exec.h" | 24 #include "exec.h" |
| 25 #include "observer.h" | 25 #include "observer.h" |
| 26 #include "readline/readline.h" | 26 #include "readline/readline.h" |
| 27 #include "solib.h" | 27 #include "solib.h" |
| 28 #include "symfile.h" | 28 #include "symfile.h" |
| 29 #include "objfiles.h" |
| 29 | 30 |
| 30 #include <ctype.h> | 31 #include <ctype.h> |
| 31 #include <stdio.h> | 32 #include <stdio.h> |
| 32 #include <string.h> | 33 #include <string.h> |
| 33 | 34 |
| 34 #define MANIFEST_MAX_NESTING 4 | 35 #define MANIFEST_MAX_NESTING 4 |
| 35 | 36 |
| 36 #define MANIFEST_MAX_STRING_SIZE 256 | 37 #define MANIFEST_MAX_STRING_SIZE 256 |
| 37 | 38 |
| 38 struct file_list | 39 struct file_list |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 | 50 |
| 50 /* Mapping of 64-bit *.so libraries. */ | 51 /* Mapping of 64-bit *.so libraries. */ |
| 51 static struct file_list *nacl_file_list_64 = NULL; | 52 static struct file_list *nacl_file_list_64 = NULL; |
| 52 | 53 |
| 53 /* runnable-ld.so or statically linked 32-bit program name. */ | 54 /* runnable-ld.so or statically linked 32-bit program name. */ |
| 54 static char *nacl_program_filename_32 = NULL; | 55 static char *nacl_program_filename_32 = NULL; |
| 55 | 56 |
| 56 /* runnable-ld.so or statically linked 64-bit program name. */ | 57 /* runnable-ld.so or statically linked 64-bit program name. */ |
| 57 static char *nacl_program_filename_64 = NULL; | 58 static char *nacl_program_filename_64 = NULL; |
| 58 | 59 |
| 59 static char *nacl_irt_filename = NULL; | |
| 60 | |
| 61 const char * | 60 const char * |
| 62 nacl_manifest_find (char *original_name) | 61 nacl_manifest_find (char *original_name) |
| 63 { | 62 { |
| 64 struct file_list *curr; | 63 struct file_list *curr; |
| 65 int addr_bit; | 64 int addr_bit; |
| 66 | 65 |
| 67 /* HACK: NaCl uses "/lib/" library path to inform service runtime that the | 66 /* HACK: NaCl uses "/lib/" library path to inform service runtime that the |
| 68 file should be opened as solib vs. ordinary file. Split that prefix | 67 file should be opened as solib vs. ordinary file. Split that prefix |
| 69 here so that GDB can find these files via manifest or as is. */ | 68 here so that GDB can find these files via manifest or as is. */ |
| 70 if (strncmp (original_name, "/lib/", 5) == 0) | 69 if (strncmp (original_name, "/lib/", 5) == 0) |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 334 } |
| 336 } | 335 } |
| 337 | 336 |
| 338 /* GDB commands for specifying Native Client files. */ | 337 /* GDB commands for specifying Native Client files. */ |
| 339 | 338 |
| 340 static void | 339 static void |
| 341 nacl_irt_command (char *args, int from_tty) | 340 nacl_irt_command (char *args, int from_tty) |
| 342 { | 341 { |
| 343 if (args) | 342 if (args) |
| 344 { | 343 { |
| 344 char *nacl_irt_filename; |
| 345 nacl_irt_filename = tilde_expand (args); |
| 346 symbol_file_add (nacl_irt_filename, from_tty ? SYMFILE_VERBOSE : 0, |
| 347 NULL, OBJF_USERLOADED); |
| 345 xfree (nacl_irt_filename); | 348 xfree (nacl_irt_filename); |
| 346 nacl_irt_filename = tilde_expand (args); | |
| 347 | |
| 348 solib_add (NULL, from_tty, NULL, 1); | |
| 349 } | 349 } |
| 350 } | 350 } |
| 351 | 351 |
| 352 static struct observer *about_to_proceed_observer = NULL; | 352 static struct observer *about_to_proceed_observer = NULL; |
| 353 | 353 |
| 354 static void | 354 static void |
| 355 about_to_proceed_hook () | 355 about_to_proceed_hook () |
| 356 { | 356 { |
| 357 if (exec_bfd == NULL) | 357 if (exec_bfd == NULL) |
| 358 { | 358 { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 405 |
| 406 c = add_com ("nacl-irt", class_files, nacl_irt_command, | 406 c = add_com ("nacl-irt", class_files, nacl_irt_command, |
| 407 _("Use FILE as Native Client IRT to be debugged.")); | 407 _("Use FILE as Native Client IRT to be debugged.")); |
| 408 set_cmd_completer (c, filename_completer); | 408 set_cmd_completer (c, filename_completer); |
| 409 | 409 |
| 410 c = add_com ("nacl-manifest", class_files, nacl_manifest_command, | 410 c = add_com ("nacl-manifest", class_files, nacl_manifest_command, |
| 411 _("Use FILE as Native Client manifest for the program" | 411 _("Use FILE as Native Client manifest for the program" |
| 412 " to be debugged.")); | 412 " to be debugged.")); |
| 413 set_cmd_completer (c, filename_completer); | 413 set_cmd_completer (c, filename_completer); |
| 414 } | 414 } |
| OLD | NEW |