* [Question] does GDB have a commands to get the end address of a function? @ 2012-06-11 9:37 Hui Zhu 2012-06-11 19:36 ` Matt Rice 2012-06-11 20:42 ` Andreas Schwab 0 siblings, 2 replies; 3+ messages in thread From: Hui Zhu @ 2012-06-11 9:37 UTC (permalink / raw) To: gdb Now, I get the end address of a function with command "disassemble function_name". Does GDB have an command to output the end address of a function? Thanks, Hui ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Question] does GDB have a commands to get the end address of a function? 2012-06-11 9:37 [Question] does GDB have a commands to get the end address of a function? Hui Zhu @ 2012-06-11 19:36 ` Matt Rice 2012-06-11 20:42 ` Andreas Schwab 1 sibling, 0 replies; 3+ messages in thread From: Matt Rice @ 2012-06-11 19:36 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb On Mon, Jun 11, 2012 at 2:36 AM, Hui Zhu <teawater@gmail.com> wrote: > Now, I get the end address of a function with command "disassemble > function_name". > Does GDB have an command to output the end address of a function? i'm not aware of anything, there is the following which could be made into a user defined command or something. py gdb.execute("p/x %s" % gdb.block_for_pc(gdb.decode_line("*main")[1][0].pc).end) seems to differ slightly from 'disassemble' I suppose by the length of the last instruction ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Question] does GDB have a commands to get the end address of a function? 2012-06-11 9:37 [Question] does GDB have a commands to get the end address of a function? Hui Zhu 2012-06-11 19:36 ` Matt Rice @ 2012-06-11 20:42 ` Andreas Schwab 1 sibling, 0 replies; 3+ messages in thread From: Andreas Schwab @ 2012-06-11 20:42 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb Hui Zhu <teawater@gmail.com> writes: > Does GDB have an command to output the end address of a function? The end address of a function is not well defined (and neither is the beginning address of a function). It is perfectly valid for two functions to be interleaved in some way, or having their code spread out in non-contiguous regions. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-11 20:42 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-06-11 9:37 [Question] does GDB have a commands to get the end address of a function? Hui Zhu 2012-06-11 19:36 ` Matt Rice 2012-06-11 20:42 ` Andreas Schwab
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).