passing parameters to gdb lazarus / 12-Debugger ---------------------------------------------------------------------- scribly · 2010-02-26 07:22 I'm trying to pass the command line parameter Code: [Select]--eval-command="set disassembly-flavor intel" to gdb so the assembler output is in a syntax I am more used to running it from the command prompt works fine, and just doing "set disassembly-flavor intel" in the gdb session works as well. But I can't seem to manage to get lazarus to pass it on to gdb. Is there a specific format that debugger_startup_options needs to have ? ---------------------------------------------------------------------- Marc · 2010-02-26 10:31 how do you pass it to gdb in lazarus ? ---------------------------------------------------------------------- scribly · 2010-02-26 13:25 in environment->options->debugger I tried setting debugger_startup_options to: Code: [Select]set disassembly-flavor intel Code: [Select]disassembly-flavor intel and Code: [Select]--eval-command="set disassembly-flavor intel" none have worked I also have tried changing the executable path from the normal gdb.exe to "gdb.exe --eval-command="set disassembly-flavor intel"" but then it fails saying it's not a valid file ---------------------------------------------------------------------- Marc · 2010-02-27 16:13 Quote from: scribly on February 26, 2010, 02:25:28 pmCode: [Select]--eval-command="set disassembly-flavor intel" allmost there, itsCode: [Select]-eval-command="set disassembly-flavor intel" ---------------------------------------------------------------------- scribly · 2010-02-27 19:59 Thanks, in the end it looks like '--eval-command="set disassembly- flavor intel"' was correct after all, but because gdb doesn't get restarted between debug sessions, the change in parameter didn't get passed on I did find that these settings aren't saved, so for now I've just hardcoded this parameter into gdbmidebugger.pp ---------------------------------------------------------------------- Marc · 2010-02-28 11:43 no, it was not correct, look at the difference between -- and - --eval-command (wrong) vs. -eval-command (correct) ---------------------------------------------------------------------- scribly · 2010-02-28 12:03 Both methods seem to work properly. gdb help output: Code: [Select]  --eval-command=COMMAND, -ex                      Execute a single GDB command.                      May be used multiple times and in conjunction                      with --command. ---------------------------------------------------------------------- Marc · 2010-02-28 14:11 On my gdb (6.8 ) the one with -- resulted in an error and was not in the docs (gdb.pdf). Storing the extra commandline is indeed a todo. I've been thinking to add a switchable asm syntax, but I haven't found a nice way yet (i like intel asm too). A quick soulutions would be debugger options, but those are only used when the debugger is started. ---------------------------------------------------------------------- Ahi · 2010-03-11 08:27 Quote from: scribly on February 28, 2010, 01:03:29 pmBoth methods seem to work properly. gdb help output: Code: [Select]  --eval-command=COMMAND, -ex                      Execute a single GDB command.                      May be used multiple times and in conjunction                      with --command. Have you found out a way to actually make lazarus to use the intel syntax for a disassembly ? I tried entering: -eval-command="set disassembly-flavor intel" into the environment->options->debugger -> debugger_startup_options but: 1) they do not take effect immediately 2) they are not being saved to disk, so if you close and restart lazarus, this setting is lost so the only way seems to be: restart lazarus -> set this option BEFORE using the debugger. But even this attempt did not work. Instead I got this error message: Debugger Initialization output: "Undefined command: \"\".  Try \"help\".\n" [OK] or do you need to modify the source and recompile lazarus to make this change apply ? btw: could there be another way ? Is it somehow possible to make gdb always execute some textfile's content as command immediately when gdb is started ? That way, if it's possible, it could be done outside of lazarus but it would still apply. ---------------------------------------------------------------------- Marc · 2010-03-11 08:45 Yes, I get that error too if i use --eval...  use -eval... ---------------------------------------------------------------------- Ahi · 2010-03-11 09:01 Quote from: Marc on March 11, 2010, 09:45:49 amYes, I get that error too if i use --eval...  use -eval... Code: [Select]-eval-command="set disassembly-flavor intel" is exactly the line I did put into that environment->options->debugger -> debugger_startup_options so this problem remains unsolved ... ---------------------------------------------------------------------- Marc · 2010-03-11 12:21 it sure worked for me. Can you try with single quotes instead of double ? I cannot remember what I used ---------------------------------------------------------------------- scribly · 2010-03-14 17:26 It might be worth mentioning that I use gdb version 7.0.50 as for the problem of not working immediately, open the taskmanager and close gdb, or even better just hardcode it into gdbmidebugger.pp (don't forget to rebuild) Also, look at the registers to see if it's intel assembly, because some of the opcode names are still written in a weird way. e.g "movabs" , which should just be a "mov", but the registers will be using normal intel syntax Quote"Undefined command: \"\". and could of course be a matter of passing the wrong parameter (e.g placing -eval-command between quotes while you really shouldn't) QuoteIs it somehow possible to make gdb always execute some textfile's content as command immediately when gdb is started ? Yes, gd command parameter: Code: [Select]"--command=FILE, -x Execute GDB commands from FILE.But obviously, this brings us back to the parameter passing problem edit: I just experimented a bit with it on the command prompt: Code: [Select]gdb --eval-command='set disassembly-flavor intel'gives: Undefined command: "".  Try "help". but Code: [Select]gdb --eval-command="set disassembly-flavor intel"works fine ---------------------------------------------------------------------- Marc · 2010-03-15 08:03 Quote from: scribly on March 14, 2010, 06:26:49 pmedit: I just experimented a bit with it on the command prompt: Code: [Select]gdb --eval-command='set disassembly-flavor intel'gives: Undefined command: "".  Try "help". but Code: [Select]gdb --eval-command="set disassembly-flavor intel"works fine This is how your shell the ' interprets, this doesn't have to be the same as TProcess interprets them.