This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] A small cleanup in blockframe.c
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 23 May 2003 19:00:00 +0200 (CEST)
- Subject: [PATCH] A small cleanup in blockframe.c
Checked in as obvious.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* blockframe.c (get_pc_function_start): Rewrite to avoid
asignments in if-statements.
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.70
diff -u -p -r1.70 blockframe.c
--- blockframe.c 14 May 2003 17:43:16 -0000 1.70
+++ blockframe.c 23 May 2003 16:57:40 -0000
@@ -223,28 +223,31 @@ get_frame_block (struct frame_info *fram
CORE_ADDR
get_pc_function_start (CORE_ADDR pc)
{
- register struct block *bl;
- register struct symbol *symbol;
- register struct minimal_symbol *msymbol;
- CORE_ADDR fstart;
+ struct block *bl;
+ struct minimal_symbol *msymbol;
- if ((bl = block_for_pc (pc)) != NULL &&
- (symbol = block_function (bl)) != NULL)
+ bl = block_for_pc (pc);
+ if (bl)
{
- bl = SYMBOL_BLOCK_VALUE (symbol);
- fstart = BLOCK_START (bl);
- }
- else if ((msymbol = lookup_minimal_symbol_by_pc (pc)) != NULL)
- {
- fstart = SYMBOL_VALUE_ADDRESS (msymbol);
- if (!find_pc_section (fstart))
- return 0;
+ struct symbol *symbol = block_function (bl);
+
+ if (symbol)
+ {
+ bl = SYMBOL_BLOCK_VALUE (symbol);
+ return BLOCK_START (bl);
+ }
}
- else
+
+ msymbol = lookup_minimal_symbol_by_pc (pc);
+ if (msymbol)
{
- fstart = 0;
+ CORE_ADDR fstart = SYMBOL_VALUE_ADDRESS (msymbol);
+
+ if (find_pc_section (fstart))
+ return fstart;
}
- return (fstart);
+
+ return 0;
}
/* Return the symbol for the function executing in frame FRAME. */