bash$ gdb gdb (gdb) b parse_number Breakpoint 3 at 0x53793e: parse_number. (7 locations) (top-gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y 0x00000000006edb0c in internal_error at ../../src/gdb/utils.c:956 2 breakpoint keep y 0x00000000004ed3e8 in info_command at ../../src/gdb/cli/cli-cmds.c:221 silent return 3 breakpoint keep y <MULTIPLE> 3.1 y 0x000000000053793e in parse_number at ../../src/gdb/cp-name-parser.y:1360 3.2 y 0x000000000054c986 in parse_number at ../../src/gdb/p-exp.y:861 3.3 y 0x0000000000549dd8 in parse_number at ../../src/gdb/m2-exp.y:665 3.4 y 0x00000000005469cc in parse_number at ../../src/gdb/go-exp.y:711 3.5 y 0x00000000005442bc in parse_number at ../../src/gdb/f-exp.y:674 3.6 y 0x00000000005414a8 in parse_number at ../../src/gdb/jv-exp.y:701 3.7 y 0x0000000000531185 in parse_number at ../../src/gdb/c-exp.y:1654 (top-gdb) disas p-exp.y:parse_number No symbol "p" in current context. (top-gdb) b p-exp.y:parse_number Note: breakpoint 3 also set at pc 0x54c986. Breakpoint 4 at 0x54c986: file ../../src/gdb/p-exp.y, line 861. (top-gdb) If "b p-exp.y:parse_number" works, why doesn't "disas p-exp.y:parse_number" ?
(In reply to comment #0) > If "b p-exp.y:parse_number" works, > why doesn't "disas p-exp.y:parse_number" ? disassemble takes expressions, not linespecs.
Re: disassemble takes expressions, not linespecs. That's not really my point though, is it. Let's take a step back. How do I explain to a user that while, yes, s/he can set a breakpoint on p-exp.y:parse_number, s/he cannot disassemble it (in any easy way). I could be missing something of course. btw, somewhat related and somewhat tangential, I think we'll want to expand expressions to take file names. How do I (easily) print foo.c:baz instead of bar.c:baz from an arbitrary point in the program? "print foo.c:baz" is the obvious choice of course, but I if necessary (and acceptable) I could see "print -f foo.c baz". It does preclude expressions based on multiple files, but I can live with that. [Some might want /X instead of -f, where X is some as yet unused display option for print, but I'm not convinced it's better.] [Again, this is all assuming "print foo.c:baz" can't work. Plus, while linespecs don't always rquire filenames to be quoted, I could live with "print 'foo.c':baz" too, if necessary.] But getting back to disassemble, from a u/i perspective I can't rationalize the current behaviour.
btw, for completeness sake, and all that :-) I realize one can do "info line p-exp.y:parse_number", examine the output, and pass that to disassemble. But it's a hack, not a solution.
(In reply to comment #2) > Re: disassemble takes expressions, not linespecs. > > That's not really my point though, is it. I didn't know. I thought it was an actual question. > Let's take a step back. > How do I explain to a user that while, yes, s/he can set a breakpoint on > p-exp.y:parse_number, s/he cannot disassemble it (in any easy way). > I could be missing something of course. > > btw, somewhat related and somewhat tangential, I think we'll want to expand > expressions to take file names. > How do I (easily) print foo.c:baz instead of bar.c:baz from an arbitrary point > in the program? There's already an extension for this. Try: disassemble 'p-exp.y'::parse_number > But getting back to disassemble, > from a u/i perspective I can't rationalize the current behaviour. Linespecs might have been a better choice, but the choice has already been made.
Blech. Silly me for applying sane rules of design to gdb. It's break foo.c:bar, but it's disassemble 'foo.c'::bar. Except that disassemble 'foo.c'::bar doesn't work if the current language is c++, which is what my testcase was written in when I checked whether it worked [filed as http://sourceware.org/bugzilla/show_bug.cgi?id=15109] I consider this bug still open though. :-) At least until a compelling reason is given for why neither of the following can be done: 1) allow :: in linespecs 2) allow : in disassemble, et.al.
I found another spot where it would be better for disassemble to take a linespec rather than an expression. Like Pascal, in Ada a call of a parameter-less function does not require parens. So you can end up with confusing output like: (gdb) disassemble Mult_Float Too few arguments in function call. Oops, this is trying to call a function; you have to stick an "&" or "'address" in there.