bugDDD - Bugs: bug #42370, Machine Code Window does not work...

 
 

bug #42370: Machine Code Window does not work with newer GDBs

Submitted by:  None
Submitted on:  Thu 15 May 2014 01:25:17 PM UTC  
 
Category: Gdb integrationSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenRelease: 3.3.12-rc2

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 29 Jun 2014 06:39:39 PM UTC, comment #1:

Patch by René Schipp von Branitz Nielsen got reformatted in the message body, so I attached the same patch but correctly formatted.
See attachment patch-yuri-ddd-fixed-machine-window-problem

Yuri <yurivict>
Thu 15 May 2014 01:25:17 PM UTC, original submission:

Hello,

Back in 2010, Paolo Canceda reported a Machine Code Window DDD bug (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597328). The GDB ‘disassemble’ command had changed to use a comma instead of a space as separator for its two arguments, causing the message “A syntax error in expression, near ‘<hex_address>’” to appear in the Machine Code Window.

Paolo also supplied a patch. His fix, however, only made new GDBs work with DDD.

Below is a more complete patch that auto-detects whether GDB expects the comma in the ‘disassemble’ command and inserts it whenever needed.

BR,
René Schipp von Branitz Nielsen

diff -ur ddd-3.3.12.old/ddd/GDBAgent.C ddd-3.3.12.new/ddd/GDBAgent.C
--- ddd-3.3.12.old/ddd/GDBAgent.C 2009-02-11 18:25:06.000000000 +0100
+++ ddd-3.3.12.new/ddd/GDBAgent.C 2014-05-14 17:23:14.000000000 +0200
@@ -223,6 +223,7 @@
_has_addproc_command(false),
_has_debug_command(true),
_is_windriver_gdb(false),
+ _wants_disassemble_comma(false),
_program_language((tp == BASH) ? LANGUAGE_BASH :
(tp == DBG) ? LANGUAGE_PHP :
(tp == JDB) ? LANGUAGE_JAVA :
@@ -317,6 +318,7 @@
_has_addproc_command(gdb.has_addproc_command()),
_has_debug_command(gdb.has_debug_command()),
_is_windriver_gdb(gdb.is_windriver_gdb()),
+ _wants_disassemble_comma(gdb.wants_disassemble_comma()),
_program_language(gdb.program_language()),
_verbatim(gdb.verbatim()),
_recording(gdb.recording()),
@@ -3200,8 +3202,12 @@
{
string end_( end );
normalize_address(end_);
- cmd += ' ';
- cmd += end_;
+ if (start != "" && start.lastchar() != ',') {
+ // No comma if only an end address or if #start
+ // already ends with a comma.
+ cmd += wants_disassemble_comma() ? ',' : ' ';
+ }
+ cmd += end_;
}
return cmd;
}
diff -ur ddd-3.3.12.old/ddd/GDBAgent.h ddd-3.3.12.new/ddd/GDBAgent.h
--- ddd-3.3.12.old/ddd/GDBAgent.h 2009-02-11 18:25:06.000000000 +0100
+++ ddd-3.3.12.new/ddd/GDBAgent.h 2014-05-14 14:44:09.000000000 +0200
@@ -191,6 +191,7 @@
bool _has_addproc_command;
bool _has_debug_command;
bool _is_windriver_gdb;
+ bool _wants_disassemble_comma;

ProgramLanguage _program_language; // Current program language

@@ -427,6 +428,10 @@
bool has_debug_command() const { return _has_debug_command; }
bool has_debug_command(bool val) { return _has_debug_command = val; }

+ // True if debugger wants 'disassemble' arguments separated by `,'
+ bool wants_disassemble_comma() const { return
_wants_disassemble_comma; }
+ bool wants_disassemble_comma(bool val){ return
+ _wants_disassemble_comma = val; }
+
// True if debugger is the Windriver variant of GDB
bool is_windriver_gdb() const { return _is_windriver_gdb; }
bool is_windriver_gdb(bool val) { return _is_windriver_gdb = val; } diff -ur ddd-3.3.12.old/ddd/comm-manag.C ddd-3.3.12.new/ddd/comm-manag.C
--- ddd-3.3.12.old/ddd/comm-manag.C 2009-02-11 18:25:07.000000000 +0100
+++ ddd-3.3.12.new/ddd/comm-manag.C 2014-05-14 17:24:10.000000000 +0200
@@ -273,7 +273,7 @@
bool config_regs; // try 'help regs'
bool config_named_values; // try 'print "ddd"'
bool config_when_semicolon; // try 'help when'
- bool config_delete_comma; // try 'delete 4711 4712'
+ bool config_delete_comma; // try 'delete 4711 4711'
bool config_err_redirection; // try 'help run'
bool config_givenfile; // try 'help givenfile'
bool config_cont_sig; // try 'help cont'
@@ -283,6 +283,7 @@
bool config_output; // try 'output'
bool config_program_language; // try 'show language'
bool config_gdb_version; // try 'show version'
+ bool config_disassemble_comma; // try 'disassemble 4711 4711'
(Newer GDBs (2009+) use ',' as separator. Old GDBs use ' ')

OACProc user_callback; // callback
void *user_data; // user data
@@ -344,6 +345,7 @@
config_output(false),
config_program_language(false),
config_gdb_version(false),
+ config_disassemble_comma(false),

user_callback(0),
user_data(0)
@@ -458,6 +460,7 @@
// Fetch initialization commands
string init;
string settings;
+
switch (gdb->type())
{
case BASH:
@@ -542,6 +545,11 @@
extra_data->config_program_language = true;
cmds += "show version";
extra_data->config_gdb_version = true;
+ if (config)
+ {
+ cmds += "disassemble " + print_cookie + " " + print_cookie;
+ extra_data->config_disassemble_comma = true;
+ }
cmds += "pwd";
extra_data->refresh_pwd = true;
cmds += "info breakpoints";
@@ -694,7 +702,6 @@
extra_completed,
(void *)extra_data,
extra_registered);
-
if (!extra_registered)
delete extra_data;

@@ -1627,6 +1634,7 @@
assert(!extra_data->config_output);
assert(!extra_data->config_program_language);
assert(!extra_data->config_gdb_version);
+ assert(!extra_data->config_disassemble_comma);

// Annotate state
if (extra_data->refresh_breakpoints) @@ -2885,6 +2893,10 @@
}
}

+static void process_config_disassemble_comma(const string& answer) {
+ gdb->wants_disassemble_comma(!is_known_command(answer));
+}

//--------------------------------------------------------------------------
---
@@ -3117,6 +3129,9 @@
if (extra_data->config_gdb_version)
process_config_gdb_version(answers[qu_count++]);

+ if (extra_data->config_disassemble_comma)
+ process_config_disassemble_comma(answers[qu_count++]);
+
if (extra_data->refresh_pwd)
source_view->process_pwd(answers[qu_count++]);

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #31635:  patch-yuri-ddd-fixed-machine-window-problem added by yurivict (5kB - application/octet-stream - Correctly formatted the patch (it was reformatted as medsage body))

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by yurivict (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 29 Jun 2014 06:27:41 PM UTCyurivictAttached File-=>Added patch-yuri-ddd-fixed-machine-window-problem, #31635

    Back to the top


    Powered by Savane 3.1-cleanup