public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-remove-obj_section: change somread to search for a text section Date: Thu, 20 Dec 2012 22:09:00 -0000 [thread overview] Message-ID: <20121220220900.20924.qmail@sourceware.org> (raw) The branch, archer-tromey-remove-obj_section has been updated via 6e53645cf8a5770ef3f83408bc97bfb50e52550f (commit) via f3a3162efb2920fd6e75947dde482a3539fae49a (commit) from 91ca1b7f115b2ff6d2099293d7776dbc809003fc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 6e53645cf8a5770ef3f83408bc97bfb50e52550f Author: Tom Tromey <tromey@redhat.com> Date: Thu Dec 20 15:07:36 2012 -0700 change somread to search for a text section This changes somread.c to search all the BFD sections for a text section. It uses the first one. It also fixes a spot in som_symtab_read to use the proper section offsets. commit f3a3162efb2920fd6e75947dde482a3539fae49a Author: Tom Tromey <tromey@redhat.com> Date: Thu Dec 20 09:26:22 2012 -0700 add completion for "set gnutarget" ----------------------------------------------------------------------- Summary of changes: gdb/cli/cli-decode.c | 7 +++++-- gdb/command.h | 21 +++++++++++---------- gdb/corefile.c | 39 ++++++++++++++++++++++++++++++++++----- gdb/somread.c | 27 ++++++++++++++++++++++----- 4 files changed, 72 insertions(+), 22 deletions(-) First 500 lines of diff: diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 6dd4180..fbcf95a 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -598,7 +598,7 @@ add_setshow_string_cmd (char *name, enum command_class class, /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). */ -void +struct cmd_list_element * add_setshow_string_noescape_cmd (char *name, enum command_class class, char **var, const char *set_doc, const char *show_doc, @@ -608,11 +608,14 @@ add_setshow_string_noescape_cmd (char *name, enum command_class class, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { + struct cmd_list_element *set_cmd; + add_setshow_cmd_full (name, class, var_string_noescape, var, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list, - NULL, NULL); + &set_cmd, NULL); + return set_cmd; } /* Add element named NAME to both the set and show command LISTs (the diff --git a/gdb/command.h b/gdb/command.h index 8eb86ba..1bab105 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -292,16 +292,17 @@ extern void add_setshow_string_cmd (char *name, struct cmd_list_element **set_list, struct cmd_list_element **show_list); -extern void add_setshow_string_noescape_cmd (char *name, - enum command_class class, - char **var, - const char *set_doc, - const char *show_doc, - const char *help_doc, - cmd_sfunc_ftype *set_func, - show_value_ftype *show_func, - struct cmd_list_element **set_list, - struct cmd_list_element **show_list); +extern struct cmd_list_element *add_setshow_string_noescape_cmd + (char *name, + enum command_class class, + char **var, + const char *set_doc, + const char *show_doc, + const char *help_doc, + cmd_sfunc_ftype *set_func, + show_value_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list); extern void add_setshow_optional_filename_cmd (char *name, enum command_class class, diff --git a/gdb/corefile.c b/gdb/corefile.c index eab715d..e12736e 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -35,6 +35,7 @@ #include "completer.h" #include "exceptions.h" #include "observer.h" +#include "cli/cli-utils.h" /* Local function declarations. */ @@ -420,12 +421,38 @@ static void set_gnutarget_command (char *ignore, int from_tty, struct cmd_list_element *c) { + char *gend = gnutarget_string + strlen (gnutarget_string); + + gend = remove_trailing_whitespace (gnutarget_string, gend); + *gend = '\0'; + if (strcmp (gnutarget_string, "auto") == 0) gnutarget = NULL; else gnutarget = gnutarget_string; } +static VEC (char_ptr) * +complete_set_gnutarget (struct cmd_list_element *cmd, char *text, char *word) +{ + const char **bfd_targets = bfd_target_list (); + struct cleanup *cleanup = make_cleanup (free_current_contents, &bfd_targets); + int len; + VEC (char_ptr) *result; + + for (len = 0; bfd_targets[len] != NULL; ++len) + ; + + bfd_targets = xrealloc (bfd_targets, (len + 1) * sizeof (const char **)); + bfd_targets[len - 1] = "auto"; + bfd_targets[len] = NULL; + + result = complete_on_enum (bfd_targets, text, word); + do_cleanups (cleanup); + + return result; +} + /* Set the gnutarget. */ void set_gnutarget (char *newtarget) @@ -448,14 +475,16 @@ No arg means have no core file. This command has been superseded by the\n\ set_cmd_completer (c, filename_completer); - add_setshow_string_noescape_cmd ("gnutarget", class_files, - &gnutarget_string, _("\ + c = add_setshow_string_noescape_cmd ("gnutarget", class_files, + &gnutarget_string, _("\ Set the current BFD target."), _("\ Show the current BFD target."), _("\ Use `set gnutarget auto' to specify automatic detection."), - set_gnutarget_command, - show_gnutarget_string, - &setlist, &showlist); + set_gnutarget_command, + show_gnutarget_string, + &setlist, &showlist); + set_cmd_completer (c, complete_set_gnutarget); + add_alias_cmd ("g", "gnutarget", class_files, 1, &setlist); if (getenv ("GNUTARGET")) diff --git a/gdb/somread.c b/gdb/somread.c index 5f9e185..e9822fd 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -58,8 +58,8 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, CORE_ADDR text_offset, data_offset; - text_offset = ANOFFSET (section_offsets, 0); - data_offset = ANOFFSET (section_offsets, 1); + text_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); + data_offset = ANOFFSET (section_offsets, SECT_OFF_DATA (objfile)); number_of_symbols = bfd_get_symcount (abfd); @@ -362,6 +362,25 @@ som_symfile_init (struct objfile *objfile) objfile->flags |= OBJF_REORDERED; } +/* A callback for bfd_map_over_sections that may set the objfile's + text section offset. */ + +static void +set_text_section_offset (bfd *abfd, asection *sect, void *arg) +{ + struct objfile *objfile = arg; + flagword aflag; + + if (objfile->sect_index_text >= 0) + return; + + aflag = bfd_get_section_flags (abfd, sect); + if ((aflag & SEC_ALLOC) != 0 + && (aflag & SEC_CODE) != 0 + && bfd_section_size (abfd, sect) > 0) + objfile->sect_index_text = sect->index; +} + /* SOM specific parsing routine for section offsets. Plain and simple for now. */ @@ -378,9 +397,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); - sect = bfd_get_section_by_name (objfile->obfd, "$CODE$"); - if (sect != NULL) - objfile->sect_index_text = sect->index; + bfd_map_over_sections (objfile->obfd, set_text_section_offset, objfile); sect = bfd_get_section_by_name (objfile->obfd, "$DATA$"); if (sect != NULL) objfile->sect_index_data = sect->index; hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2012-12-20 22:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20121220220900.20924.qmail@sourceware.org \ --to=tromey@sourceware.org \ --cc=archer-commits@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).