Hi,
what is r2 command is needed to get gdb list like output ?
KInd Regards
Susann E.
the command is CL. Please try and give some feedback. Because iirc nobody but me used that thing :)
Thanks
On 04 Dec 2014, at 09:54, Susanne588586 [email protected] wrote:
Hi,
what is r2 command is needed to get gdb list like output ?
KInd Regards
Susann E.—
Reply to this email directly or view it on GitHub.
can you give real example? because
[0x004048bf]> C?~show
| CL[-][*] [file:line] [addr] show or add 'code line' information (bininfo)
[0x004048bf]> iz~GPLv3
vaddr=0x00418238 paddr=0x00018238 ordinal=415 sz=203 len=202 section=.rodata
type=a string=\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/
gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is
NO WARRANTY, to the extent permitted by law.\n\n
[0x004048bf]> CL /bin/ls:233 0x00418238
[0x004048bf]> CL* /bin/ls:233 0x00418238
CL /bin/ls:100 0x418308
CL /bin/ls:1000 0x418308
CL /bin/ls:232 0x418238
CL /bin/ls:233 0x418238
[0x004048bf]> q
$ grep -an 'GPLv3' /bin/ls
233:License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
But I expected it to show some printf("GPLv3...\n") instead.
CL sym.main or without arg it should handle the curseek
On 04 Dec 2014, at 13:36, Susanne588586 [email protected] wrote:
can you give real example? because
[0x004048bf]> C?~show
| CL[-][_] [file:line] [addr] show or add 'code line' information (bininfo)
[0x004048bf]> iz~GPLv3
vaddr=0x00418238 paddr=0x00018238 ordinal=415 sz=203 len=202 section=.rodata type=a string=\nLicense GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\n
[0x004048bf]> CL /bin/ls:233 0x00418238
[0x004048bf]> CL_ /bin/ls:233 0x00418238
CL /bin/ls:100 0x418308
CL /bin/ls:1000 0x418308
CL /bin/ls:232 0x418238
CL /bin/ls:233 0x418238
[0x004048bf]> q
$ grep -an 'GPLv3' /bin/ls
233:License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
But I expected it to show some printf("GPLv3...\n") instead.—
Reply to this email directly or view it on GitHub.
/bin/ls does not contain debugging symbols. But even with debugging symbols, nothing is shown with r2 ( 18ef89dfa0493b29467a8f221b39de03dc54a070 ) Can you give an example session ?
$ r2 -d ./a
Process with PID 13055 started...
PID = 13055
pid = 13055 tid = 13055
r_debug_select: 13055 13055
Using BADDR 400000
bits 64
pid = 13055 tid = 13055
-- To remove this message, put `dbxenv suppress_startup_message 7.5' in your .dbxrc
[0x7ff163790dc0]> db main
[0x7ff163790dc0]> db memset
[0x7ff163790dc0]> CL sym.main
Cannot find meta information at 0x7ff163790dc0
^D
Do you want to quit? (Y/n)
Do you want to kill the process? (Y/n)
$ gdb -q ./a
Reading symbols from ./a...done.
(gdb) b main
Breakpoint 1 at 0x40070b: file krash.c, line 6.
(gdb) b memset
Breakpoint 2 at 0x4005d0
(gdb) l
1 /* gcc krash.c `pkg-config --cflags --libs r_util` */
2 #include <r_util.h>
3
4 main() {
5 char buf[4096];
6 memset (buf, 'A', sizeof (buf));
7 buf[sizeof (buf)-1] = '\0';
8 char *p = r_file_abspath (buf);
9 free (p);
10 }
(gdb) quit
$ file a
a: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.32, not stripped
In the last example gdb displays source just fine.
ok, will look at it/fix todady :)
On 12/05/2014 01:01 PM, Susanne588586 wrote:
/bin/ls does not contain debugging symbols. But even with debugging
symbols, nothing is shown with r2 ( 18ef89d
https://github.com/radare/radare2/commit/18ef89dfa0493b29467a8f221b39de03dc54a070
) Can you give an example session ?|$ r2 -d ./a
Process with PID 13055 started...
PID = 13055
pid = 13055 tid = 13055
r_debug_select: 13055 13055
Using BADDR 400000
bits 64
pid = 13055 tid = 13055
-- To remove this message, putdbxenv suppress_startup_message 7.5' in your .dbxrc [0x7ff163790dc0]> db main [0x7ff163790dc0]> db memset [0x7ff163790dc0]> CL sym.main Cannot find meta information at 0x7ff163790dc0 ^D Do you want to quit? (Y/n) Do you want to kill the process? (Y/n) $ gdb -q ./a Reading symbols from ./a...done. (gdb) b main Breakpoint 1 at 0x40070b: file krash.c, line 6. (gdb) b memset Breakpoint 2 at 0x4005d0 (gdb) l 1 /* gcc krash.cpkg-config --cflags --libs r_util` */
2 #include
3
4 main() {
5 char buf[4096];
6 memset (buf, 'A', sizeof (buf));
7 buf[sizeof (buf)-1] = '\0';
8 char *p = r_file_abspath (buf);
9 free (p);
10 }
(gdb) quit
$ file a
a: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.32, not stripped
|In the last example gdb displays source just fine.
—
Reply to this email directly or view it on GitHub
https://github.com/radare/radare2/issues/1783#issuecomment-65781245.
+1 for the list feature
This still throws the same error for me:
[0x7f4662920d70]> CL sym.main
Cannot find meta information at 0x7f4662920d70
Was this closed because it was fixed?
works perfectly fine for me:
[0x0040052d]> CL $$
file /tmp/r2-regressions/.//dwarftest.c
line 4
002
003 int main(void)
> 004 {
005 int i;
006
[0x0040052d]>
and obviously /bin/ls doesnt have debugging information
I did that on a binary with debugging information, though, not on /bin/ls.
using the last version from git of today?
this was fixed this morning
On 16 Nov 2016, at 16:25, Denis Kasak [email protected] wrote:
I did that on a binary with debugging information, though, not on /bin/ls.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/1783#issuecomment-260973957, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-lknGfiL1y-Iess-_7DY45a5ulEFlks5q-yBPgaJpZM4DEJVN.
Oh. That's quite a coincidence. I didn't notice and was going by the closing date of this issue. Thanks!
@radare @dkasak
[0x004004a6]> CL $$
Cannot find meta information at 0x004004a6
[0x004004a6]> !date
Tue Jan 31 14:28:32 CET 2017
[0x004004a6]> !cat oob.c
//#include <stdio.h>
int main() {
int i[3] = { 3, 1,2 };
printf("%i\n", i[3]);
}
is there another command before needed?
[0x004004a6]> CL oob.c:2
No meta info for oob.c|2 found
If the bin is not compiled with dwarf CL will not work
On 31 Jan 2017, at 14:32, Susanne588586 notifications@github.com wrote:
[0x004004a6]> CL oob.c:2
No meta info for oob.c|2 found—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
I'm not sure how the file:line argument is supposed to work (I can't get it to work either), but a plain CL works for me to list the source code of the current location. You can then use @ to get source code of an arbitrary symbol, like this:
CL @ sym.main
However, that's not quite like gdb yet since CL source.c:<num> doesn't seem to work. Also, the bin is compiled with DWARF.
I should note I don't have the latest master however, since it doesn't compile for me at the moment, so it may have been fixed later on.
@radare is dwarf the same as -g ?
ok, works with CL @ sym.main, maybe that is more useful, then displaying only one line of source
Most helpful comment
+1 for the list feature