* [review] Reimplement tui_get_begin_asm_address
@ 2019-11-14 23:51 Tom Tromey (Code Review)
2019-12-12 2:35 ` [review v2] " Tom Tromey (Code Review)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-14 23:51 UTC (permalink / raw)
To: gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/643
......................................................................
Reimplement tui_get_begin_asm_address
tui_get_begin_asm_address looks for the inferior's "main" to display
it. I think this is incorrect in two ways.
First, it should probably instead use the user's most recent source
context, if one has been set.
Second, it uses a hard-coded list of "main" names, but gdb already has
a better approach to handling this.
This patch fixes both of these problems.
gdb/ChangeLog
2019-11-14 Tom Tromey <tom@tromey.com>
* tui/tui-disasm.c (tui_get_begin_asm_address): Use
get_current_source_symtab_and_line, and main_name.
Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
---
M gdb/ChangeLog
M gdb/tui/tui-disasm.c
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fcd7b18..a2171c3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2019-11-14 Tom Tromey <tom@tromey.com>
+ * tui/tui-disasm.c (tui_get_begin_asm_address): Use
+ get_current_source_symtab_and_line, and main_name.
+
+2019-11-14 Tom Tromey <tom@tromey.com>
+
* tui/tui.c (tui_show_source): Update.
* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 35165bf..952c853 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -258,25 +258,28 @@
{
struct tui_locator_window *locator;
struct gdbarch *gdbarch = get_current_arch ();
- CORE_ADDR addr;
+ CORE_ADDR addr = 0;
locator = tui_locator_win_info_ptr ();
if (locator->addr == 0)
{
- struct bound_minimal_symbol main_symbol;
+ if (have_full_symbols () || have_partial_symbols ())
+ {
+ set_default_source_symtab_and_line ();
+ struct symtab_and_line sal = get_current_source_symtab_and_line ();
- /* Find address of the start of program.
- Note: this should be language specific. */
- main_symbol = lookup_minimal_symbol ("main", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("MAIN", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("_start", NULL, NULL);
- if (main_symbol.minsym)
- addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
- else
- addr = 0;
+ if (sal.symtab != nullptr)
+ find_line_pc (sal.symtab, sal.line, &addr);
+ }
+
+ if (addr == 0)
+ {
+ struct bound_minimal_symbol main_symbol
+ = lookup_minimal_symbol (main_name (), nullptr, nullptr);
+ if (main_symbol.minsym != nullptr)
+ addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
+ }
}
else /* The target is executing. */
{
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
Gerrit-Change-Number: 643
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 4+ messages in thread
* [review v2] Reimplement tui_get_begin_asm_address
2019-11-14 23:51 [review] Reimplement tui_get_begin_asm_address Tom Tromey (Code Review)
@ 2019-12-12 2:35 ` Tom Tromey (Code Review)
2019-12-20 16:21 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)
2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-12 2:35 UTC (permalink / raw)
To: gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/643
......................................................................
Reimplement tui_get_begin_asm_address
tui_get_begin_asm_address looks for the inferior's "main" to display
it. I think this is incorrect in two ways.
First, it should probably instead use the user's most recent source
context, if one has been set.
Second, it uses a hard-coded list of "main" names, but gdb already has
a better approach to handling this.
This patch fixes both of these problems.
2019-12-11 Tom Tromey <tom@tromey.com>
* tui/tui-disasm.c (tui_get_begin_asm_address): Use
get_current_source_symtab_and_line, and main_name.
Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
---
M gdb/ChangeLog
M gdb/tui/tui-disasm.c
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1954ad0..58eb3bb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2019-12-11 Tom Tromey <tom@tromey.com>
+ * tui/tui-disasm.c (tui_get_begin_asm_address): Use
+ get_current_source_symtab_and_line, and main_name.
+
+2019-12-11 Tom Tromey <tom@tromey.com>
+
* tui/tui.c (tui_show_source): Update.
* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 376343b..d8f2d38 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -258,25 +258,28 @@
{
struct tui_locator_window *locator;
struct gdbarch *gdbarch = get_current_arch ();
- CORE_ADDR addr;
+ CORE_ADDR addr = 0;
locator = tui_locator_win_info_ptr ();
if (locator->addr == 0)
{
- struct bound_minimal_symbol main_symbol;
+ if (have_full_symbols () || have_partial_symbols ())
+ {
+ set_default_source_symtab_and_line ();
+ struct symtab_and_line sal = get_current_source_symtab_and_line ();
- /* Find address of the start of program.
- Note: this should be language specific. */
- main_symbol = lookup_minimal_symbol ("main", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("MAIN", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("_start", NULL, NULL);
- if (main_symbol.minsym)
- addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
- else
- addr = 0;
+ if (sal.symtab != nullptr)
+ find_line_pc (sal.symtab, sal.line, &addr);
+ }
+
+ if (addr == 0)
+ {
+ struct bound_minimal_symbol main_symbol
+ = lookup_minimal_symbol (main_name (), nullptr, nullptr);
+ if (main_symbol.minsym != nullptr)
+ addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
+ }
}
else /* The target is executing. */
{
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
Gerrit-Change-Number: 643
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pushed] Reimplement tui_get_begin_asm_address
2019-11-14 23:51 [review] Reimplement tui_get_begin_asm_address Tom Tromey (Code Review)
2019-12-12 2:35 ` [review v2] " Tom Tromey (Code Review)
@ 2019-12-20 16:21 ` Sourceware to Gerrit sync (Code Review)
2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)
2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:21 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/643
......................................................................
Reimplement tui_get_begin_asm_address
tui_get_begin_asm_address looks for the inferior's "main" to display
it. I think this is incorrect in two ways.
First, it should probably instead use the user's most recent source
context, if one has been set.
Second, it uses a hard-coded list of "main" names, but gdb already has
a better approach to handling this.
This patch fixes both of these problems.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-disasm.c (tui_get_begin_asm_address): Use
get_current_source_symtab_and_line, and main_name.
Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
---
M gdb/ChangeLog
M gdb/tui/tui-disasm.c
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f5d667e..e471536 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2019-12-20 Tom Tromey <tom@tromey.com>
+ * tui/tui-disasm.c (tui_get_begin_asm_address): Use
+ get_current_source_symtab_and_line, and main_name.
+
+2019-12-20 Tom Tromey <tom@tromey.com>
+
* tui/tui.c (tui_show_source): Update.
* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 376343b..d8f2d38 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -258,25 +258,28 @@
{
struct tui_locator_window *locator;
struct gdbarch *gdbarch = get_current_arch ();
- CORE_ADDR addr;
+ CORE_ADDR addr = 0;
locator = tui_locator_win_info_ptr ();
if (locator->addr == 0)
{
- struct bound_minimal_symbol main_symbol;
+ if (have_full_symbols () || have_partial_symbols ())
+ {
+ set_default_source_symtab_and_line ();
+ struct symtab_and_line sal = get_current_source_symtab_and_line ();
- /* Find address of the start of program.
- Note: this should be language specific. */
- main_symbol = lookup_minimal_symbol ("main", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("MAIN", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("_start", NULL, NULL);
- if (main_symbol.minsym)
- addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
- else
- addr = 0;
+ if (sal.symtab != nullptr)
+ find_line_pc (sal.symtab, sal.line, &addr);
+ }
+
+ if (addr == 0)
+ {
+ struct bound_minimal_symbol main_symbol
+ = lookup_minimal_symbol (main_name (), nullptr, nullptr);
+ if (main_symbol.minsym != nullptr)
+ addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
+ }
}
else /* The target is executing. */
{
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
Gerrit-Change-Number: 643
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pushed] Reimplement tui_get_begin_asm_address
2019-11-14 23:51 [review] Reimplement tui_get_begin_asm_address Tom Tromey (Code Review)
2019-12-12 2:35 ` [review v2] " Tom Tromey (Code Review)
2019-12-20 16:21 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)
2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:38 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
The original change was created by Tom Tromey.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/643
......................................................................
Reimplement tui_get_begin_asm_address
tui_get_begin_asm_address looks for the inferior's "main" to display
it. I think this is incorrect in two ways.
First, it should probably instead use the user's most recent source
context, if one has been set.
Second, it uses a hard-coded list of "main" names, but gdb already has
a better approach to handling this.
This patch fixes both of these problems.
gdb/ChangeLog
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-disasm.c (tui_get_begin_asm_address): Use
get_current_source_symtab_and_line, and main_name.
Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
---
M gdb/ChangeLog
M gdb/tui/tui-disasm.c
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f5d667e..e471536 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2019-12-20 Tom Tromey <tom@tromey.com>
+ * tui/tui-disasm.c (tui_get_begin_asm_address): Use
+ get_current_source_symtab_and_line, and main_name.
+
+2019-12-20 Tom Tromey <tom@tromey.com>
+
* tui/tui.c (tui_show_source): Update.
* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 376343b..d8f2d38 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -258,25 +258,28 @@
{
struct tui_locator_window *locator;
struct gdbarch *gdbarch = get_current_arch ();
- CORE_ADDR addr;
+ CORE_ADDR addr = 0;
locator = tui_locator_win_info_ptr ();
if (locator->addr == 0)
{
- struct bound_minimal_symbol main_symbol;
+ if (have_full_symbols () || have_partial_symbols ())
+ {
+ set_default_source_symtab_and_line ();
+ struct symtab_and_line sal = get_current_source_symtab_and_line ();
- /* Find address of the start of program.
- Note: this should be language specific. */
- main_symbol = lookup_minimal_symbol ("main", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("MAIN", NULL, NULL);
- if (main_symbol.minsym == 0)
- main_symbol = lookup_minimal_symbol ("_start", NULL, NULL);
- if (main_symbol.minsym)
- addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
- else
- addr = 0;
+ if (sal.symtab != nullptr)
+ find_line_pc (sal.symtab, sal.line, &addr);
+ }
+
+ if (addr == 0)
+ {
+ struct bound_minimal_symbol main_symbol
+ = lookup_minimal_symbol (main_name (), nullptr, nullptr);
+ if (main_symbol.minsym != nullptr)
+ addr = BMSYMBOL_VALUE_ADDRESS (main_symbol);
+ }
}
else /* The target is executing. */
{
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
Gerrit-Change-Number: 643
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-20 16:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 23:51 [review] Reimplement tui_get_begin_asm_address Tom Tromey (Code Review)
2019-12-12 2:35 ` [review v2] " Tom Tromey (Code Review)
2019-12-20 16:21 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)
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).